Compare commits

...

No commits in common. "c9-beta" and "c8" have entirely different histories.
c9-beta ... c8

31 changed files with 942 additions and 5313 deletions

View File

@ -1 +0,0 @@
13c23ad59254438ffcd0cde6400fd991cbfe194e SOURCES/rear-2.6.tar.gz

View File

@ -1,47 +0,0 @@
From df5e18b8d7c8359b48bc133bfa29734934d18160 Mon Sep 17 00:00:00 2001
From: Johannes Meixner <jsmeix@suse.com>
Date: Mon, 10 Aug 2020 16:20:38 +0200
Subject: [PATCH] Merge pull request #2469 from
rear/skip-kernel-builtin-modules-issue2414
In 400_copy_modules.sh skip copying kernel modules that are builtin modules.
The new behaviour is that when modules are listed in modules.builtin
and are also shown by modinfo then those modules are now skipped.
Before for such modules the modules file(s) would have been included
in the recovery system.
See https://github.com/rear/rear/issues/2414
---
usr/share/rear/build/GNU/Linux/400_copy_modules.sh | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/usr/share/rear/build/GNU/Linux/400_copy_modules.sh b/usr/share/rear/build/GNU/Linux/400_copy_modules.sh
index d8d733d2..641b7f83 100644
--- a/usr/share/rear/build/GNU/Linux/400_copy_modules.sh
+++ b/usr/share/rear/build/GNU/Linux/400_copy_modules.sh
@@ -133,8 +133,13 @@ for dummy in "once" ; do
module=${module#.o}
# Strip trailing ".ko" if there:
module=${module#.ko}
- # Continue with the next module if the current one does not exist:
+ # Continue with the next module if the current one does not exist as a module file:
modinfo $module 1>/dev/null || continue
+ # Continue with the next module if the current one is a kernel builtin module
+ # cf. https://github.com/rear/rear/issues/2414#issuecomment-668632798
+ # Quoting the grep search value is mandatory here ($module might be empty or blank),
+ # cf. "Beware of the emptiness" in https://github.com/rear/rear/wiki/Coding-Style
+ grep -q "$( echo $module | tr '_-' '..' )" /lib/modules/$KERNEL_VERSION/modules.builtin && continue
# Resolve module dependencies:
# Get the module file plus the module files of other needed modules.
# This is currently only a "best effort" attempt because
@@ -166,7 +171,10 @@ done
# Remove those modules that are specified in the EXCLUDE_MODULES array:
for exclude_module in "${EXCLUDE_MODULES[@]}" ; do
- # Continue with the next module if the current one does not exist:
+ # Continue with the next module only if the current one does not exist as a module file
+ # but do not continue with the next module if the current one is a kernel builtin module
+ # so when a module file exists that gets removed regardless if it is also a builtin module
+ # cf. https://github.com/rear/rear/issues/2414#issuecomment-669115481
modinfo $exclude_module 1>/dev/null || continue
# In this case it is ignored when a module exists but 'modinfo -F filename' cannot show its filename
# because then it is assumed that also no module file had been copied above:

View File

@ -0,0 +1,36 @@
diff --git a/usr/share/rear/output/PXE/default/820_copy_to_net.sh b/usr/share/rear/output/PXE/default/820_copy_to_net.sh
new file mode 100644
index 00000000..dba1e526
--- /dev/null
+++ b/usr/share/rear/output/PXE/default/820_copy_to_net.sh
@@ -0,0 +1,30 @@
+
+# 820_copy_to_net.sh
+
+# Check if we have a target location OUTPUT_URL
+test "$OUTPUT_URL" || return 0
+
+local scheme=$( url_scheme $OUTPUT_URL )
+local result_file=""
+local path=""
+
+case "$scheme" in
+ (nfs|cifs|usb|tape|file|davfs)
+ # The ISO has already been transferred by NETFS.
+ return 0
+ ;;
+ (fish|ftp|ftps|hftp|http|https|sftp)
+ # output/default/950_copy_result_files.sh will transfer them
+ return 0
+ ;;
+ (rsync)
+ LogPrint "Transferring PXE files to $OUTPUT_URL"
+ for result_file in "${RESULT_FILES[@]}" ; do
+ LogPrint "Transferring file: $result_file"
+ rsync -a $v "$result_file" "$OUTPUT_URL" || Error "Problem transferring '$result_file' to $OUTPUT_URL"
+ done
+ ;;
+ (*) Error "Invalid scheme '$scheme' in '$OUTPUT_URL'."
+ ;;
+esac
+

584
SOURCES/rear-asciidoc.patch Normal file
View File

@ -0,0 +1,584 @@
diff --git a/doc/user-guide/12-BLOCKCLONE.adoc b/doc/user-guide/12-BLOCKCLONE.adoc
index 061f0f49..2d4e0ed1 100644
--- a/doc/user-guide/12-BLOCKCLONE.adoc
+++ b/doc/user-guide/12-BLOCKCLONE.adoc
@@ -40,17 +40,17 @@ First we need to set some global options in _local.conf_,
In our small example backups will be stored in _/mnt/rear_ directory
on BACKUP_URL NFS server.
-```
+--------------------------
# cat local.conf
OUTPUT=ISO
BACKUP=NETFS
BACKUP_OPTIONS="nfsvers=3,nolock"
BACKUP_URL=nfs://<hostname>/mnt/rear
-```
+--------------------------
Now we will define variables that will apply only for targeted block device
-```
+--------------------------
# cat alien.conf
BACKUP=BLOCKCLONE # Define BLOCKCLONE as backup method
BACKUP_PROG_ARCHIVE="alien" # Name of image file
@@ -66,16 +66,16 @@ BLOCKCLONE_MBR_FILE="alien_boot_strap.img" # Output filename for b
BLOCKCLONE_PARTITIONS_CONF_FILE="alien_partitions.conf" # Output filename for partition configuration
BLOCKCLONE_ALLOW_MOUNTED="yes" # Device can be mounted during backup (default NO)
-```
+--------------------------
==== Running backup
Save partitions configuration, bootstrap code and create actual backup of /dev/sdc1
-```
+--------------------------
# rear -C alien mkbackuponly
-```
+--------------------------
==== Running restore from ReaR restore/recovery system
-```
+--------------------------
# rear -C alien restoreonly
Restore alien.dd.img to device: [/dev/sdc1] # User is always prompted for restore destination
Device /dev/sdc1 was not found. # If destination does not exist ReaR will try to create it (or fail if BLOCKCLONE_SAVE_MBR_DEV was not set during backup)
@@ -102,7 +102,7 @@ Device Boot Start End Sectors Size Id Type
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
-```
+--------------------------
==== Summary
In first example we have run backup of /dev/sdc1 partition and stored it on NFS
@@ -127,37 +127,37 @@ In next example we will do backup/restore using BLOCKCLONE and `ntfsclone`
of Linux (installed on /dev/sda) and Windows 10 (installed on /dev/sdb).
TIP: You can locate right disk devices using `df` and `os-prober`
-```
+--------------------------
# df -h /boot
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 10G 4.9G 5.2G 49% / # Linux is most probably installed on /dev/sda
# os-prober
/dev/sdb1:Windows 10 (loader):Windows:chain # Windows 10 is most probably installed on /dev/sdb
-```
+--------------------------
First we will configure some ReaR backup global options
(similar to link:12-BLOCKCLONE.adoc#1-backuprestore-of-arbitrary-block-device-with-blockclone-and-dd-on-nfs-server[first example]
we will do backup/restore with help of NFS server).
-```
+--------------------------
# cat local.conf
OUTPUT=ISO
BACKUP=NETFS
BACKUP_OPTIONS="nfsvers=3,nolock"
BACKUP_URL=nfs://<hostname>/mnt/rear
REQUIRED_PROGS+=( ntfsclone )
-```
+--------------------------
Now we will define backup parameters for Linux.
-```
+--------------------------
# cat base_os.conf
this_file_name=$( basename ${BASH_SOURCE[0]} )
LOGFILE="$LOG_DIR/rear-$HOSTNAME-$WORKFLOW-${this_file_name%.*}.log"
BACKUP_PROG_ARCHIVE="backup-${this_file_name%.*}"
BACKUP_PROG_EXCLUDE+=( '/media/*' )
-```
+--------------------------
Our Windows 10 is by default installed on two separate partitions
(partition 1 for boot data and partition 2 for disk C:),
@@ -165,7 +165,7 @@ Our Windows 10 is by default installed on two separate partitions
Windows boot partition:
-```
+--------------------------
# cat windows_boot.conf
BACKUP=BLOCKCLONE
BACKUP_PROG_ARCHIVE="windows_boot"
@@ -179,10 +179,10 @@ BLOCKCLONE_PROG_OPTS="--quiet"
BLOCKCLONE_SAVE_MBR_DEV="/dev/sdb"
BLOCKCLONE_MBR_FILE="windows_boot_strap.img"
BLOCKCLONE_PARTITIONS_CONF_FILE="windows_partitions.conf"
-```
+--------------------------
Windows data partition (disk C:\):
-```
+--------------------------
# cat windows_data.conf
BACKUP=BLOCKCLONE
BACKUP_PROG_ARCHIVE="windows_data"
@@ -196,35 +196,35 @@ BLOCKCLONE_PROG_OPTS="--quiet"
BLOCKCLONE_SAVE_MBR_DEV="/dev/sdb"
BLOCKCLONE_MBR_FILE="windows_boot_strap.img"
BLOCKCLONE_PARTITIONS_CONF_FILE="windows_partitions.conf"
-```
+--------------------------
==== Running backup
First we will create backup of Linux. `mkbackup` command will create bootable
ISO image with ReaR rescue/recovery system that will be later used for
booting broken system and consecutive recovery.
-```
+--------------------------
# rear -C base_os mkbackup
-```
+--------------------------
Now we create backup of Windows 10 boot partition. Command `mkbackuponly`
will ensure that only partition data and partition layout will be saved
(ReaR rescue/recovery system will not be created which is exactly what we want).
-```
+--------------------------
# rear -C windows_boot mkbackuponly
-```
+--------------------------
Similarly, we create backup of Windows 10 data partition (disk C:\)
-```
+--------------------------
# rear -C windows_data mkbackuponly
-```
+--------------------------
==== Running restore from ReaR restore/recovery system
As a first step after ReaR rescue/recovery system booted,
we will recover Linux. This step will recover all Linux file systems,
OS data and bootloader. Windows disk will remain untouched.
-```
+--------------------------
# rear -C base_os recover
-```
+--------------------------
In second step will recover Windows 10 boot partition. During this step ReaR
will detect that destination partition is not present and ask us for device
@@ -234,25 +234,25 @@ In second step will recover Windows 10 boot partition. During this step ReaR
partition(s) configuration (currently mounted under _/mnt/local_) will
remain untouched. Before starting Windows 10 recovery we should identify
right disk for recovery, as mentioned earlier disk size could be a good start.
-```
+--------------------------
# fdisk -l /dev/sdb
Disk /dev/sdb: 50 GiB, 53687091200 bytes, 104857600 sectors
-```
+--------------------------
_/dev/sdb_ looks to be right destination, so we can proceed with restore.
-```
+--------------------------
# rear -C windows_boot restoreonly
Restore windows_boot.img to device: [/dev/sdb1]
Device /dev/sdb1 was not found.
Restore partition layout to (^c to abort): [/dev/sdb]
Checking that no-one is using this disk right now ... OK
...
-```
+--------------------------
Last step is to recover Windows 10 OS data (C:\).
Partitions on _/dev/sdb_ were already created in previous step,
hence ReaR will skip prompt for restoring partition layout.
-```
+--------------------------
# rear -C windows_data restoreonly
Restore windows_data.img to device: [/dev/sdb2]
Ntfsclone image version: 10.1
@@ -263,7 +263,7 @@ Space in use : 9396 MB (27.8%)
Offset to image data : 56 (0x38) bytes
Restoring NTFS from image ...
...
-```
+--------------------------
At this stage Linux together with Windows 10 is successfully restored.
@@ -286,7 +286,7 @@ In this example we will do backup/restore using BLOCKCLONE and `ntfsclone`
Backups will be stored on NFS server.
First we set global ReaR options
-```
+--------------------------
# cat local.conf
OUTPUT=ISO
BACKUP=NETFS
@@ -300,23 +300,23 @@ BLOCKCLONE_SAVE_MBR_DEV="/dev/sda"
BLOCKCLONE_MBR_FILE="boot_strap.img"
BLOCKCLONE_PARTITIONS_CONF_FILE="partitions.conf"
-```
+--------------------------
IMPORTANT: BLOCKCLONE_STRICT_PARTITIONING is mandatory if backing up
Linux / Windows that shares one disk. Not using this option might result to
unbootable Windows 10 installation.
Linux configuration
-```
+--------------------------
# cat base_os.conf
this_file_name=$( basename ${BASH_SOURCE[0]} )
LOGFILE="$LOG_DIR/rear-$HOSTNAME-$WORKFLOW-${this_file_name%.*}.log"
BACKUP_PROG_ARCHIVE="backup-${this_file_name%.*}"
BACKUP_PROG_EXCLUDE+=( '/media/*' )
-```
+--------------------------
Windows 10 boot partition configuration
-```
+--------------------------
# cat windows_boot.conf
BACKUP=BLOCKCLONE
@@ -328,10 +328,10 @@ BLOCKCLONE_PROG=ntfsclone
BLOCKCLONE_PROG_OPTS="--quiet"
BLOCKCLONE_SOURCE_DEV="/dev/sda1"
-```
+--------------------------
Windows 10 data partition configuration
-```
+--------------------------
# cat windows_data.conf
BACKUP=BLOCKCLONE
BACKUP_PROG_ARCHIVE="windows_data"
@@ -342,42 +342,42 @@ BLOCKCLONE_PROG=ntfsclone
BLOCKCLONE_PROG_OPTS="--quiet"
BLOCKCLONE_SOURCE_DEV="/dev/sda2"
-```
+--------------------------
==== Running backup
Backup of Linux
-```
+--------------------------
# rear -C base_os mkbackup
-```
+--------------------------
Backup of Windows 10 boot partition
-```
+--------------------------
# rear -C windows_boot mkbackuponly
-```
+--------------------------
Backup of Windows 10 data partition
-```
+--------------------------
# rear -C windows_data mkbackuponly
-```
+--------------------------
==== Running restore from ReaR restore/recovery system
Restore Linux
-```
+--------------------------
# rear -C base_os recover
-```
+--------------------------
During this step ReaR will also create both Windows 10 partitions
Restore Windows 10 data partition
-```
+--------------------------
# rear -C windows_data restoreonly
-```
+--------------------------
Restore Windows 10 boot partition
-```
+--------------------------
# rear -C windows_boot restoreonly
-```
+--------------------------
=== 4. Backup/restore of Linux / Windows 10 dual boot setup sharing same disk with USB as destination
@@ -389,7 +389,7 @@ In this example we will do backup/restore using BLOCKCLONE and `ntfsclone`
Backups will be stored on USB disk drive (_/dev/sdb_ in this example).
Global options
-```
+--------------------------
# cat local.conf
OUTPUT=USB
BACKUP=NETFS
@@ -407,10 +407,10 @@ BLOCKCLONE_SAVE_MBR_DEV="/dev/sda"
BLOCKCLONE_MBR_FILE="boot_strap.img"
BLOCKCLONE_PARTITIONS_CONF_FILE="partitions.conf"
-```
+--------------------------
Options used during Linux backup/restore.
-```
+--------------------------
# cat local.conf
OUTPUT=USB
BACKUP=NETFS
@@ -428,14 +428,14 @@ BLOCKCLONE_SAVE_MBR_DEV="/dev/sda"
BLOCKCLONE_MBR_FILE="boot_strap.img"
BLOCKCLONE_PARTITIONS_CONF_FILE="partitions.conf"
-```
+--------------------------
IMPORTANT: USB_SUFFIX option is mandatory as it avoids ReaR to hold every
backup in separate directory, this behavior is essential for BLOCKCLONE
backup method to work correctly.
Windows boot partition options
-```
+--------------------------
# cat windows_boot.conf
BACKUP=BLOCKCLONE
@@ -447,10 +447,10 @@ BLOCKCLONE_PROG=ntfsclone
BLOCKCLONE_PROG_OPTS="--quiet"
BLOCKCLONE_SOURCE_DEV="/dev/sda1"
-```
+--------------------------
Windows data partition options
-```
+--------------------------
# cat windows_data.conf
BACKUP=BLOCKCLONE
BACKUP_PROG_ARCHIVE="windows_data"
@@ -461,11 +461,11 @@ BLOCKCLONE_PROG=ntfsclone
BLOCKCLONE_PROG_OPTS="--quiet"
BLOCKCLONE_SOURCE_DEV="/dev/sda2"
-```
+--------------------------
==== Running backup
First we need to format target USB device, with `rear format` command
-```
+--------------------------
# rear -v format /dev/sdb
Relax-and-Recover 2.00 / Git
Using log file: /var/log/rear/rear-centosd.log
@@ -477,15 +477,15 @@ Creating ReaR data partition up to 100% of '/dev/sdb'
Setting 'boot' flag on /dev/sdb
Creating ext3 filesystem with label 'REAR-000' on '/dev/sdb1'
Adjusting filesystem parameters on '/dev/sdb1'
-```
+--------------------------
Backup of Linux
-```
+--------------------------
# rear -C base_os mkbackup
-```
+--------------------------
Backup of Windows 10 boot partition
-```
+--------------------------
# rear -C windows_boot mkbackuponly
NTFS volume version: 3.1
Cluster size : 4096 bytes
@@ -496,10 +496,10 @@ Accounting clusters ...
Space in use : 338 MB (64.4%)
Saving NTFS to image ...
Syncing ...
-```
+--------------------------
Backup of Windows 10 data partition
-```
+--------------------------
# rear -C windows_data mkbackuponly
NTFS volume version: 3.1
Cluster size : 4096 bytes
@@ -510,7 +510,7 @@ Accounting clusters ...
Space in use : 9833 MB (54.3%)
Saving NTFS to image ...
Syncing ...
-```
+--------------------------
==== Running restore from ReaR restore/recovery system
For sake of this demonstration I've purposely used ReaR's rescue/recovery media
@@ -519,7 +519,7 @@ For sake of this demonstration I've purposely used ReaR's rescue/recovery media
demonstrate possibility of ReaR to recover backup to arbitrary disk. +
As first step Linux will be restored, this will create all the partitions
needed, even those used by Windows 10.
-```
+--------------------------
RESCUE centosd:~ # rear -C base_os recover
Relax-and-Recover 2.00 / Git
Using log file: /var/log/rear/rear-centosd.log
@@ -541,13 +541,13 @@ Original disk /dev/sda does not exist in the target system. Please choose an app
2) /dev/sdb
3) Do not map disk.
#?
-```
+--------------------------
Now ReaR recover command stops as it detected that disk layout is not identical.
As our desired restore target is _/dev/sdb_ we choose right disk and continue
recovery. ReaR will ask to check created restore scripts, but this is not
needed in our scenario.
-```
+--------------------------
#? 2
2017-01-25 20:54:01 Disk /dev/sdb chosen as replacement for /dev/sda.
Disk /dev/sdb chosen as replacement for /dev/sda.
@@ -607,11 +607,11 @@ Skip installing GRUB Legacy boot loader because GRUB 2 is installed (grub-probe
Installing GRUB2 boot loader
Finished recovering your system. You can explore it under '/mnt/local'.
Saving /var/log/rear/rear-centosd.log as /var/log/rear/rear-centosd-recover-base_os.log
-```
+--------------------------
Now we have Linux part restored, GRUB installed and partitions created, hence
we can continue with Windows 10 boot partition recovery.
-```
+--------------------------
RESCUE centosd:~ # rear -C windows_boot restoreonly
Restore windows_boot.nc.img to device: [/dev/sda1] /dev/sdb1
Ntfsclone image version: 10.1
@@ -622,12 +622,12 @@ Space in use : 338 MB (64.4%)
Offset to image data : 56 (0x38) bytes
Restoring NTFS from image ...
Syncing ...
-```
+--------------------------
Similarly to Linux restore, we were prompted for restore destination, which
is /dev/sdb1 in our case. +
As the last step we will recover Windows 10 data partition
-```
+--------------------------
RESCUE centosd:~ # rear -C windows_data restoreonly
Restore windows_data.nc.img to device: [/dev/sda2] /dev/sdb2
Ntfsclone image version: 10.1
@@ -638,7 +638,7 @@ Space in use : 9867 MB (54.5%)
Offset to image data : 56 (0x38) bytes
Restoring NTFS from image ...
Syncing ...
-```
+--------------------------
Again after restoreonly command is launched, ReaR prompts for restore
destination. +
@@ -662,25 +662,25 @@ The _BLOCKCLONE_TRY_UNMOUNT_ is important here: it will attempt to unmount the
run the risk that the data may be inconsistent.
Global options
-```
+--------------------------
# cat site.conf
OUTPUT=ISO
KEEP_OLD_OUTPUT_COPY=1
BACKUP_URL="nfs://<hostname>/Stations_bkup/rear/"
-```
+--------------------------
Options used for the base OS backup:
-```
+--------------------------
# cat base_system.conf
this_file_name=$( basename ${BASH_SOURCE[0]} )
LOGFILE="$LOG_DIR/rear-$HOSTNAME-$WORKFLOW-${this_file_name%.*}.log"
BACKUP_PROG_EXCLUDE+=( '/products/*' )
BACKUP_PROG_ARCHIVE="backup-${this_file_name%.*}"
BACKUP=NETFS
-```
+--------------------------
Options used to take the encrypted filesystem image:
-```
+--------------------------
this_file_name=$( basename ${BASH_SOURCE[0]} )
LOGFILE="$LOG_DIR/rear-$HOSTNAME-$WORKFLOW-${this_file_name%.*}.log"
BACKUP=BLOCKCLONE
@@ -694,18 +694,18 @@ BLOCKCLONE_SOURCE_DEV="/dev/vg00/lvol4"
BLOCKCLONE_ALLOW_MOUNTED="yes"
BLOCKCLONE_TRY_UNMOUNT="yes"
-```
+--------------------------
==== Running backup
Base OS backup:
-```
+--------------------------
# rear -C base_system mkbackup
-```
+--------------------------
Create image of encrypted filesystem:
-```
+--------------------------
# rear -C products_backup mkbackuponly
-```
+--------------------------
==== Running restore from ReaR restore/recovery system
First recover the base OS. This will create all the partitions needed, including
@@ -713,7 +713,7 @@ First recover the base OS. This will create all the partitions needed, including
As illustrated below, you will be prompted to chose a new encryption passphrase.
Please provide one, but you need not care about its value as it will get overwritten
during the next phase:
-```
+--------------------------
RESCUE pc-pan:~ # rear -C base_system.conf recover
[...]
Please enter the password for LUKS device cr_vg00-lvol4 (/dev/mapper/vg00-lvol4):
@@ -724,7 +724,7 @@ Creating filesystem of type xfs with mount point /products on /dev/mapper/cr_vg0
Mounting filesystem /products
Disk layout created.
[...]
-```
+--------------------------
Now we can proceed and restore the encrypted filesystem image. The target filesystem
will have been mounted by ReaR during the previous phase, but this will be
@@ -732,12 +732,12 @@ Now we can proceed and restore the encrypted filesystem image. The target filesy
to "yes". +
As illustrated below, you will be prompted for the target block device to use.
Confirm by pressing Enter or type in another value:
-```
+--------------------------
RESCUE pc-pan:~ # rear -C products_backup.conf restoreonly
[...]
Restore backup-products_backup.dd.img to device: [/dev/vg00/lvol4]
[...]
-```
+--------------------------
Please note that the target device will not be re-mounted by the script at the end
of the restore phase. If needed, this should be done manually. +
diff --git a/doc/user-guide/16-Rubrik-CDM.adoc b/doc/user-guide/16-Rubrik-CDM.adoc
index 41f37d20..3ac23b7b 100644
--- a/doc/user-guide/16-Rubrik-CDM.adoc
+++ b/doc/user-guide/16-Rubrik-CDM.adoc
@@ -84,7 +84,7 @@ To make CentOS v8.0 work the following line was needed:
== Test Matrix
.Test Matrix
-[%header,format=csv]
+[options="header",format="csv"]
|===
Operating System,DHCP,Static IP,Virtual,Physical,LVM Root Disk,Plain Root Disk,EXT3,EXT4,XFS,BTRFS,Original Cluster,Replication Cluster
CentOS 7.3,,pass,Pass,,Pass,,,,Pass,,Pass,

View File

@ -1,58 +0,0 @@
commit 389e5026df575ad98695191044257cf2b33d565b
Author: pcahyna <pcahyna@users.noreply.github.com>
Date: Mon Jul 4 15:48:43 2022 +0200
Merge pull request #2825 from lzaoral/replace-mkinitrd-with-dracut
Replace `mkinitrd` with `dracut` on Fedora and RHEL
diff --git a/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh b/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh
index 3476b77f..f296e624 100644
--- a/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh
+++ b/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh
@@ -61,7 +61,7 @@ NEW_INITRD_MODULES=( $(tr " " "\n" <<< "${NEW_INITRD_MODULES[*]}" | sort | uniq
Log "New INITRD_MODULES='${OLD_INITRD_MODULES[@]} ${NEW_INITRD_MODULES[@]}'"
INITRD_MODULES="${OLD_INITRD_MODULES[@]} ${NEW_INITRD_MODULES[@]}"
-WITH_INITRD_MODULES=$( printf '%s\n' ${INITRD_MODULES[@]} | awk '{printf "--with=%s ", $1}' )
+WITH_INITRD_MODULES=$( printf '%s\n' ${INITRD_MODULES[@]} | awk '{printf "--add-drivers=%s ", $1}' )
# Recreate any initrd or initramfs image under $TARGET_FS_ROOT/boot/ with new drivers
# Images ignored:
@@ -76,19 +76,19 @@ for INITRD_IMG in $( ls $TARGET_FS_ROOT/boot/initramfs-*.img $TARGET_FS_ROOT/boo
# Do not use KERNEL_VERSION here because that is readonly in the rear main script:
kernel_version=$( basename $( echo $INITRD_IMG ) | cut -f2- -d"-" | sed s/"\.img"// )
INITRD=$( echo $INITRD_IMG | egrep -o "/boot/.*" )
- LogPrint "Running mkinitrd..."
- # Run mkinitrd directly in chroot without a login shell in between (see https://github.com/rear/rear/issues/862).
- # We need the mkinitrd binary in the chroot environment i.e. the mkinitrd binary in the recreated system.
- # Normally we would use a login shell like: chroot $TARGET_FS_ROOT /bin/bash --login -c 'type -P mkinitrd'
+ LogPrint "Running dracut..."
+ # Run dracut directly in chroot without a login shell in between (see https://github.com/rear/rear/issues/862).
+ # We need the dracut binary in the chroot environment i.e. the dracut binary in the recreated system.
+ # Normally we would use a login shell like: chroot $TARGET_FS_ROOT /bin/bash --login -c 'type -P dracut'
# because otherwise there is no useful PATH (PATH is only /bin) so that 'type -P' won't find it
# but we cannot use a login shell because that contradicts https://github.com/rear/rear/issues/862
# so that we use a plain (non-login) shell and set a (hopefully) reasonable PATH:
- local mkinitrd_binary=$( chroot $TARGET_FS_ROOT /bin/bash -c 'PATH=/sbin:/usr/sbin:/usr/bin:/bin type -P mkinitrd' )
- # If there is no mkinitrd in the chroot environment plain 'chroot $TARGET_FS_ROOT' will hang up endlessly
+ local dracut_binary=$( chroot $TARGET_FS_ROOT /bin/bash -c 'PATH=/sbin:/usr/sbin:/usr/bin:/bin type -P dracut' )
+ # If there is no dracut in the chroot environment plain 'chroot $TARGET_FS_ROOT' will hang up endlessly
# and then "rear recover" cannot be aborted with the usual [Ctrl]+[C] keys.
# Use plain $var because when var contains only blanks test "$var" results true because test " " results true:
- if test $mkinitrd_binary ; then
- if chroot $TARGET_FS_ROOT $mkinitrd_binary -v -f ${WITH_INITRD_MODULES[@]} $INITRD $kernel_version >&2 ; then
+ if test $dracut_binary ; then
+ if chroot $TARGET_FS_ROOT $dracut_binary -v -f ${WITH_INITRD_MODULES[@]} $INITRD $kernel_version >&2 ; then
LogPrint "Updated initrd with new drivers for kernel $kernel_version."
else
LogPrint "WARNING:
@@ -99,7 +99,7 @@ and decide yourself, whether the system will boot or not.
fi
else
LogPrint "WARNING:
-Cannot create initrd (found no mkinitrd in the recreated system).
+Cannot create initrd (found no dracut in the recreated system).
Check the recreated system (mounted at $TARGET_FS_ROOT)
and decide yourself, whether the system will boot or not.
"

View File

@ -1,130 +0,0 @@
commit b06d059108db9b0c46cba29cc174f60e129164f1
Author: Johannes Meixner <jsmeix@suse.com>
Date: Tue Mar 9 14:40:59 2021 +0100
Merge pull request #2580 from rear/jsmeix-load-nvram-module
In etc/scripts/system-setup.d/41-load-special-modules.sh
load the nvram kernel module if possible to make /dev/nvram appear
because /dev/nvram should be there when installing GRUB,
see https://github.com/rear/rear/issues/2554
and include the nvram kernel module in the recovery system
because nvram could be a module in particular on POWER architecture
see https://github.com/rear/rear/issues/2554#issuecomment-764720180
diff --git a/usr/share/rear/build/GNU/Linux/400_copy_modules.sh b/usr/share/rear/build/GNU/Linux/400_copy_modules.sh
index d8d733d2..a0ca9084 100644
--- a/usr/share/rear/build/GNU/Linux/400_copy_modules.sh
+++ b/usr/share/rear/build/GNU/Linux/400_copy_modules.sh
@@ -116,8 +116,12 @@ for dummy in "once" ; do
# As a way out of this dilemma we add the below listed modules no longer via conf/GNU/Linux.conf
# but here after the user config files were sourced so that now the user can specify
# MODULES=( 'moduleX' 'moduleY' ) in etc/rear/local.conf to get additional kernel modules
- # included in the recovery system in addition to the ones via an empty MODULES=() setting:
- MODULES+=( vfat
+ # included in the recovery system in addition to the ones via an empty MODULES=() setting.
+ # nvram could be a module in particular on POWER architecture,
+ # cf. https://github.com/rear/rear/issues/2554#issuecomment-764720180
+ # and https://github.com/rear/rear/pull/2580#issuecomment-791344794
+ MODULES+=( nvram
+ vfat
nls_iso8859_1 nls_utf8 nls_cp437
af_packet
unix
diff --git a/usr/share/rear/finalize/Linux-ppc64le/660_install_grub2.sh b/usr/share/rear/finalize/Linux-ppc64le/660_install_grub2.sh
index 4c2698f3..0cb3ee41 100644
--- a/usr/share/rear/finalize/Linux-ppc64le/660_install_grub2.sh
+++ b/usr/share/rear/finalize/Linux-ppc64le/660_install_grub2.sh
@@ -104,9 +104,39 @@ fi
# Do not update nvram when system is running in PowerNV mode (BareMetal).
# grub2-install will fail if not run with the --no-nvram option on a PowerNV system,
# see https://github.com/rear/rear/pull/1742
-grub2_install_option=""
+grub2_no_nvram_option=""
if [[ $(awk '/platform/ {print $NF}' < /proc/cpuinfo) == PowerNV ]] ; then
- grub2_install_option="--no-nvram"
+ grub2_no_nvram_option="--no-nvram"
+fi
+# Also do not update nvram when no character device node /dev/nvram exists.
+# On POWER architecture the nvram kernel driver could be also built as a kernel module
+# that gets loaded via etc/scripts/system-setup.d/41-load-special-modules.sh
+# but whether or not the nvram kernel driver will then create /dev/nvram
+# depends on whether or not the hardware platform supports nvram.
+# I <jsmeix@suse.de> asked on a SUSE internal mailing list
+# and got the following reply (excerpts):
+# ----------------------------------------------------------------
+# > I would like to know when /dev/nvram exists and when not.
+# > I assume /dev/nvram gets created as other device nodes
+# > by the kernel (probably together with udev).
+# > I would like to know under what conditions /dev/nvram
+# > gets created and when it is not created.
+# > It seems on PPC /dev/nvram usually exist but sometimes not.
+# In case of powerpc, it gets created by nvram driver
+# (nvram_module_init) whenever the powerpc platform driver
+# has ppc_md.nvram_size greater than zero in it's machine
+# description structure.
+# How exactly ppc_md.nvram_size gets gets populated by platform
+# code depends on the platform, e.g. on most modern systems
+# it gets populated from 'nvram' device tree node
+# (and only if such node has #bytes > 0).
+# ----------------------------------------------------------------
+# So /dev/nvram may not exist regardless that the nvram kernel driver is there
+# and then grub2-install must be called with the '--no-nvram' option
+# because otherwise installing the bootloader fails
+# cf. https://github.com/rear/rear/issues/2554
+if ! test -c /dev/nvram ; then
+ grub2_no_nvram_option="--no-nvram"
fi
# When GRUB2_INSTALL_DEVICES is specified by the user
@@ -134,7 +164,7 @@ if test "$GRUB2_INSTALL_DEVICES" ; then
else
LogPrint "Installing GRUB2 on $grub2_install_device (specified in GRUB2_INSTALL_DEVICES)"
fi
- if ! chroot $TARGET_FS_ROOT /bin/bash --login -c "$grub_name-install $grub2_install_option $grub2_install_device" ; then
+ if ! chroot $TARGET_FS_ROOT /bin/bash --login -c "$grub_name-install $grub2_no_nvram_option $grub2_install_device" ; then
LogPrintError "Failed to install GRUB2 on $grub2_install_device"
grub2_install_failed="yes"
fi
@@ -170,7 +200,7 @@ for part in $part_list ; do
LogPrint "Found PPC PReP boot partition $part - installing GRUB2 there"
# Erase the first 512 bytes of the PPC PReP boot partition:
dd if=/dev/zero of=$part
- if chroot $TARGET_FS_ROOT /bin/bash --login -c "$grub_name-install $grub2_install_option $part" ; then
+ if chroot $TARGET_FS_ROOT /bin/bash --login -c "$grub_name-install $grub2_no_nvram_option $part" ; then
# In contrast to the above behaviour when GRUB2_INSTALL_DEVICES is specified
# consider it here as a successful bootloader installation when GRUB2
# got installed on at least one PPC PReP boot partition:
diff --git a/usr/share/rear/skel/default/etc/scripts/system-setup.d/41-load-special-modules.sh b/usr/share/rear/skel/default/etc/scripts/system-setup.d/41-load-special-modules.sh
index 9b0b3b8a..2e1d1912 100644
--- a/usr/share/rear/skel/default/etc/scripts/system-setup.d/41-load-special-modules.sh
+++ b/usr/share/rear/skel/default/etc/scripts/system-setup.d/41-load-special-modules.sh
@@ -1,6 +1,24 @@
-# some things are special
+# Special cases of kernel module loading.
-# XEN PV does not autoload some modules
-if [ -d /proc/xen ] ; then
- modprobe xenblk
+# XEN PV does not autoload some modules:
+test -d /proc/xen && modprobe xenblk
+
+# On POWER architecture the nvram kernel driver may be no longer built into the kernel
+# but nowadays it could be also built as a kernel module that needs to be loaded
+# cf. https://github.com/rear/rear/issues/2554#issuecomment-764720180
+# because normally grub2-install gets called without the '--no-nvram' option
+# e.g. see finalize/Linux-ppc64le/620_install_grub2.sh
+# which is how grub2-install should be called when the hardware supports nvram.
+# Nothing to do when the character device node /dev/nvram exists
+# because then the nvram kernel driver is already there:
+if ! test -c /dev/nvram ; then
+ # Nothing can be done when there is no nvram kernel module.
+ # Suppress the possible 'modprobe -n nvram' error message like
+ # "modprobe: FATAL: Module nvram not found in directory /lib/modules/..."
+ # to avoid a possible "FATAL" false alarm message that would appear
+ # on the user's terminal during recovery system startup
+ # cf. https://github.com/rear/rear/pull/2537#issuecomment-741825046
+ # but when there is a nvram kernel module show possible 'modprobe nvram'
+ # (error) messages on the user's terminal during recovery system startup:
+ modprobe -n nvram 2>/dev/null && modprobe nvram
fi

View File

@ -1,37 +0,0 @@
commit 2922b77e950537799fdadf5b3ebf6a05d97f6f2f
Author: pcahyna <pcahyna@users.noreply.github.com>
Date: Mon Jun 20 17:42:58 2022 +0200
Merge pull request #2822 from pcahyna/fix-vim-symlink
Fix vi in the rescue system on Fedora and RHEL 9
diff --git a/usr/share/rear/build/GNU/Linux/005_create_symlinks.sh b/usr/share/rear/build/GNU/Linux/005_create_symlinks.sh
index df75e07d..55f25bef 100644
--- a/usr/share/rear/build/GNU/Linux/005_create_symlinks.sh
+++ b/usr/share/rear/build/GNU/Linux/005_create_symlinks.sh
@@ -8,7 +8,6 @@
ln -sf $v bin/init $ROOTFS_DIR/init >&2
ln -sf $v bin $ROOTFS_DIR/sbin >&2
ln -sf $v bash $ROOTFS_DIR/bin/sh >&2
-ln -sf $v vi $ROOTFS_DIR/bin/vim >&2
ln -sf $v true $ROOTFS_DIR/bin/pam_console_apply >&2 # RH/Fedora with udev needs this
ln -sf $v ../bin $ROOTFS_DIR/usr/bin >&2
ln -sf $v ../bin $ROOTFS_DIR/usr/sbin >&2
diff --git a/usr/share/rear/conf/GNU/Linux.conf b/usr/share/rear/conf/GNU/Linux.conf
index 89aedd4c..0c97594a 100644
--- a/usr/share/rear/conf/GNU/Linux.conf
+++ b/usr/share/rear/conf/GNU/Linux.conf
@@ -206,6 +206,12 @@ LIBS+=(
)
COPY_AS_IS+=( /dev /etc/inputr[c] /etc/protocols /etc/services /etc/rpc /etc/termcap /etc/terminfo /lib*/terminfo /usr/share/terminfo /etc/netconfig /etc/mke2fs.conf /etc/*-release /etc/localtime /etc/magic /usr/share/misc/magic /etc/dracut.conf /etc/dracut.conf.d /usr/lib/dracut /sbin/modprobe.ksplice-orig /etc/sysctl.conf /etc/sysctl.d /etc/e2fsck.conf )
+
+# Needed by vi on Fedora and derived distributions
+# where vi is a shell script that executes /usr/libexec/vi
+# see https://github.com/rear/rear/pull/2822
+COPY_AS_IS+=( /usr/libexec/vi )
+
# Required by curl with https:
# There are stored the distribution provided certificates
# installed from packages, nothing confidential.

View File

@ -1,18 +0,0 @@
diff --git a/usr/share/rear/prep/GNU/Linux/220_include_lvm_tools.sh b/usr/share/rear/prep/GNU/Linux/220_include_lvm_tools.sh
index 4b73fb05..c7704032 100644
--- a/usr/share/rear/prep/GNU/Linux/220_include_lvm_tools.sh
+++ b/usr/share/rear/prep/GNU/Linux/220_include_lvm_tools.sh
@@ -8,6 +8,13 @@ PROGS+=( lvm dmsetup dmeventd fsadm )
COPY_AS_IS+=( /etc/lvm )
+# Workaround for a LVM segfault when creating a PV with an UUID already present
+# in the device file: omit the device file from the rescue system
+# https://bugzilla.redhat.com/show_bug.cgi?id=2117937
+# proper fix:
+# https://sourceware.org/git/?p=lvm2.git;a=commit;h=8c3cfc75c72696ae8b620555fcc4f815b0c1d6b6
+COPY_AS_IS_EXCLUDE+=( /etc/lvm/devices )
+
if lvs --noheadings -o thin_count | grep -q -v "^\s*$" ; then
# There are Thin Pools on the system, include required binaries
PROGS+=( thin_check )

View File

@ -1,440 +0,0 @@
diff --git a/usr/share/rear/rescue/NBU/default/460_prepare_netbackup_systemd.sh b/usr/share/rear/rescue/NBU/default/460_prepare_netbackup_systemd.sh
new file mode 100644
index 00000000..f7423e0a
--- /dev/null
+++ b/usr/share/rear/rescue/NBU/default/460_prepare_netbackup_systemd.sh
@@ -0,0 +1,41 @@
+# 460_prepare_netbackup_systemd.sh
+# prepare systemd units for NBU (only if NBU version >=7.x)
+
+# set in 450_prepare_netbackup.sh
+[[ $NBU_version -lt 7 ]] && return # NBU is using xinetd when version <7.x
+
+# Skip if systemd is not used.
+has_binary systemctl || return 0
+
+# Local functions that are 'unset' at the end of this script:
+
+function get_unit_path () {
+ systemctl show -P FragmentPath $1
+}
+
+function get_unit_dropin_paths () {
+ systemctl show -P DropInPaths $1
+}
+
+local unit_file_path
+local i
+local unit
+
+for unit in vxpbx_exchanged.service netbackup.service ; do
+ unit_file_path="$( get_unit_path $unit )"
+ if [ -n "$unit_file_path" ]; then
+ cp $v "$unit_file_path" $ROOTFS_DIR/etc/systemd/system
+ ln -s ../$unit $ROOTFS_DIR/etc/systemd/system/default.target.wants || Error "Failed to enable Netbackup service $unit in the rescue system"
+ Log "Enabled Netbackup service $unit in the rescue system"
+ for i in $( get_unit_dropin_paths $unit ) ; do
+ mkdir -p $ROOTFS_DIR/etc/systemd/system/$unit.d
+ cp $v $i $ROOTFS_DIR/etc/systemd/system/$unit.d
+ done
+ fi
+done
+
+# Local functions must be 'unset' because bash does not support 'local function ...'
+# cf. https://unix.stackexchange.com/questions/104755/how-can-i-create-a-local-function-in-my-bashrc
+unset -f get_unit_path
+unset -f get_unit_dropin_paths
+unset -f unit_is_enabled
diff --git a/usr/share/rear/skel/default/etc/scripts/run-automatic-rear b/usr/share/rear/skel/default/etc/scripts/run-automatic-rear
new file mode 100755
index 00000000..6edc657a
--- /dev/null
+++ b/usr/share/rear/skel/default/etc/scripts/run-automatic-rear
@@ -0,0 +1,82 @@
+#!/bin/bash
+
+source /etc/scripts/system-setup-functions.sh
+
+# In debug mode run the automated 'rear recover' also with debug options.
+# Because the kernel command line option 'debug' means 'set -x' for the system setup scripts
+# it also means '-D' (i.e. 'set -x') for the automated 'rear recover' run:
+if rear_debug ; then
+ rear_debug_options='-D'
+else
+ rear_debug_options=''
+fi
+
+# Launch rear recover automatically:
+if automatic_recovery ; then
+ choices=( "View Relax-and-Recover log file(s)"
+ "Go to Relax-and-Recover shell"
+ )
+ echo -e "\nLaunching 'rear recover' automatically\n"
+ if rear $rear_debug_options recover ; then
+ echo -e "\n'rear recover' finished successfully\n"
+ choices+=( "Reboot" )
+ else
+ echo -e "\n'rear recover' failed, check the Relax-and-Recover log file(s)\n"
+ fi
+ PS3="Select what to do "
+ select choice in "${choices[@]}" ; do
+ case "$REPLY" in
+ (1)
+ # Do not assume the ReaR log file is named rear-$HOSTNAME.log
+ # the user can have specified any name as LOGFILE:
+ less /var/log/rear/*
+ ;;
+ (2)
+ echo "" > /etc/issue
+ echo "" > /etc/motd
+ break
+ ;;
+ (3)
+ reboot
+ ;;
+ esac
+ for (( i=1 ; i <= ${#choices[@]} ; i++ )) ; do
+ echo "$i) ${choices[$i-1]}"
+ done
+ done 2>&1
+fi
+
+# Launch rear recover automatically in unattended mode
+# i.e. with automated reboot after successful 'rear recover':
+if unattended_recovery ; then
+ choices=( "View Relax-and-Recover log file(s)"
+ "Go to Relax-and-Recover shell"
+ )
+ echo -e "\nLaunching 'rear recover' automatically in unattended mode\n"
+ if rear $rear_debug_options recover ; then
+ echo -e "\n'rear recover' finished successfully\n"
+ echo -e "\nRebooting in 30 seconds (Ctrl-C to interrupt)\n"
+ sleep 30
+ reboot
+ else
+ echo -e "\n'rear recover' failed, check the Relax-and-Recover log file(s)\n"
+ PS3="Select what to do "
+ select choice in "${choices[@]}" ; do
+ case "$REPLY" in
+ (1)
+ # Do not assume the ReaR log file is named rear-$HOSTNAME.log
+ # the user can have specified any name as LOGFILE:
+ less /var/log/rear/*
+ ;;
+ (2)
+ echo "" > /etc/issue
+ echo "" > /etc/motd
+ break
+ ;;
+ esac
+ for (( i=1 ; i <= ${#choices[@]} ; i++ )) ; do
+ echo "$i) ${choices[$i-1]}"
+ done
+ done 2>&1
+ fi
+fi
diff --git a/usr/share/rear/skel/default/etc/scripts/system-setup b/usr/share/rear/skel/default/etc/scripts/system-setup
index 1dc7f1e8..17487ac7 100755
--- a/usr/share/rear/skel/default/etc/scripts/system-setup
+++ b/usr/share/rear/skel/default/etc/scripts/system-setup
@@ -9,36 +9,7 @@
# (e.g. "ls foo*bar" becomes plain "ls" without "foo*bar: No such file or directory" error).
shopt -s nullglob
-# Use an artificial array to get the kernel command line parameters as array elements
-kernel_command_line=( $( cat /proc/cmdline ) )
-
-function rear_debug() {
- for kernel_command_line_parameter in "${kernel_command_line[@]}" ; do
- test "debug" = "$kernel_command_line_parameter" && return 0
- done
- return 1
-}
-
-function unattended_recovery() {
- for kernel_command_line_parameter in "${kernel_command_line[@]}" ; do
- test "unattended" = "$kernel_command_line_parameter" && return 0
- done
- return 1
-}
-
-function automatic_recovery() {
- # The unattended recovery mode implies automatic recovery (see the implementations below)
- # so that in unattended mode the automatic recovery code below must not be run
- # otherwise first the automatic recovery code and then the unattended recovery code
- # get run automatically one after the other where the unattended recovery fails
- # because for two subsequent 'rear recover' the second one fails:
- unattended_recovery && return 1
- for kernel_command_line_parameter in "${kernel_command_line[@]}" ; do
- test "auto_recover" = "$kernel_command_line_parameter" && return 0
- test "automatic" = "$kernel_command_line_parameter" && return 0
- done
- return 1
-}
+source /etc/scripts/system-setup-functions.sh
# The 'sleep 1' is used as workaround to avoid whatever inexplicable actual reason
# that at least on SLES12 some initial output lines of this script would get lost
@@ -135,84 +106,3 @@ echo -e "\nRelax-and-Recover rescue system is ready\n"
# Wait two seconds so that the user can read the 'Relax-and-Recover rescue system is ready' message
# on his screen before the screen gets cleared and replaced by the login screen:
sleep 2
-
-# In debug mode run the automated 'rear recover' also with debug options.
-# Because the kernel command line option 'debug' means 'set -x' for the system setup scripts
-# it also means '-D' (i.e. 'set -x') for the automated 'rear recover' run:
-if rear_debug ; then
- rear_debug_options='-D'
-else
- rear_debug_options=''
-fi
-
-# Launch rear recover automatically:
-if automatic_recovery ; then
- choices=( "View Relax-and-Recover log file(s)"
- "Go to Relax-and-Recover shell"
- )
- echo -e "\nLaunching 'rear recover' automatically\n"
- # The recover workflow is always verbose (see usr/sbin/rear):
- if rear $rear_debug_options recover ; then
- echo -e "\n'rear recover' finished successfully\n"
- choices+=( "Reboot" )
- else
- echo -e "\n'rear recover' failed, check the Relax-and-Recover log file(s)\n"
- fi
- PS3="Select what to do "
- select choice in "${choices[@]}" ; do
- case "$REPLY" in
- (1)
- # Do not assume the ReaR log file is named rear-$HOSTNAME.log
- # the user can have specified any name as LOGFILE:
- less /var/log/rear/*
- ;;
- (2)
- echo "" > /etc/issue
- echo "" > /etc/motd
- break
- ;;
- (3)
- reboot
- ;;
- esac
- for (( i=1 ; i <= ${#choices[@]} ; i++ )) ; do
- echo "$i) ${choices[$i-1]}"
- done
- done 2>&1
-fi
-
-# Launch rear recover automatically in unattended mode
-# i.e. with automated reboot after successful 'rear recover':
-if unattended_recovery ; then
- choices=( "View Relax-and-Recover log file(s)"
- "Go to Relax-and-Recover shell"
- )
- echo -e "\nLaunching 'rear recover' automatically in unattended mode\n"
- # The recover workflow is always verbose (see usr/sbin/rear):
- if rear $rear_debug_options recover ; then
- echo -e "\n'rear recover' finished successfully\n"
- echo -e "\nRebooting in 30 seconds (Ctrl-C to interrupt)\n"
- sleep 30
- reboot
- else
- echo -e "\n'rear recover' failed, check the Relax-and-Recover log file(s)\n"
- PS3="Select what to do "
- select choice in "${choices[@]}" ; do
- case "$REPLY" in
- (1)
- # Do not assume the ReaR log file is named rear-$HOSTNAME.log
- # the user can have specified any name as LOGFILE:
- less /var/log/rear/*
- ;;
- (2)
- echo "" > /etc/issue
- echo "" > /etc/motd
- break
- ;;
- esac
- for (( i=1 ; i <= ${#choices[@]} ; i++ )) ; do
- echo "$i) ${choices[$i-1]}"
- done
- done 2>&1
- fi
-fi
diff --git a/usr/share/rear/skel/default/etc/scripts/system-setup-functions.sh b/usr/share/rear/skel/default/etc/scripts/system-setup-functions.sh
new file mode 100644
index 00000000..c320cf88
--- /dev/null
+++ b/usr/share/rear/skel/default/etc/scripts/system-setup-functions.sh
@@ -0,0 +1,30 @@
+# Use an artificial array to get the kernel command line parameters as array elements
+kernel_command_line=( $( cat /proc/cmdline ) )
+
+function rear_debug() {
+ for kernel_command_line_parameter in "${kernel_command_line[@]}" ; do
+ test "debug" = "$kernel_command_line_parameter" && return 0
+ done
+ return 1
+}
+
+function unattended_recovery() {
+ for kernel_command_line_parameter in "${kernel_command_line[@]}" ; do
+ test "unattended" = "$kernel_command_line_parameter" && return 0
+ done
+ return 1
+}
+
+function automatic_recovery() {
+ # The unattended recovery mode implies automatic recovery (see the implementations below)
+ # so that in unattended mode the automatic recovery code below must not be run
+ # otherwise first the automatic recovery code and then the unattended recovery code
+ # get run automatically one after the other where the unattended recovery fails
+ # because for two subsequent 'rear recover' the second one fails:
+ unattended_recovery && return 1
+ for kernel_command_line_parameter in "${kernel_command_line[@]}" ; do
+ test "auto_recover" = "$kernel_command_line_parameter" && return 0
+ test "automatic" = "$kernel_command_line_parameter" && return 0
+ done
+ return 1
+}
diff --git a/usr/share/rear/skel/default/etc/systemd/system/default.target.wants/.gitignore b/usr/share/rear/skel/default/etc/systemd/system/default.target.wants/.gitignore
new file mode 100644
index 00000000..d6b7ef32
--- /dev/null
+++ b/usr/share/rear/skel/default/etc/systemd/system/default.target.wants/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/automatic-rear.service b/usr/share/rear/skel/default/usr/lib/systemd/system/automatic-rear.service
new file mode 100644
index 00000000..ee3187a8
--- /dev/null
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/automatic-rear.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Run Relax-and-Recover recovery automatically if requested
+Wants=network-online.target
+After=network-online.target
+
+[Service]
+Type=oneshot
+ExecStart=/etc/scripts/run-automatic-rear
+StandardInput=tty
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/getty@.service b/usr/share/rear/skel/default/usr/lib/systemd/system/getty@.service
index bf858ca8..abafd8b5 100644
--- a/usr/share/rear/skel/default/usr/lib/systemd/system/getty@.service
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/getty@.service
@@ -6,6 +6,8 @@ Description=Getty on %I
Documentation=man:agetty(8)
After=systemd-user-sessions.service plymouth-quit-wait.service
After=sysinit.service
+# Automatic ReaR uses the system console
+After=automatic-rear.service
# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/multi-user.target b/usr/share/rear/skel/default/usr/lib/systemd/system/multi-user.target
index c5ea1cca..a88e219f 100644
--- a/usr/share/rear/skel/default/usr/lib/systemd/system/multi-user.target
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/multi-user.target
@@ -4,7 +4,7 @@
[Unit]
Description=Multi-User
-Requires=sysinit.target
+Requires=sysinit.target basic.target
AllowIsolate=yes
[Install]
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/multi-user.target.wants/automatic-rear.service b/usr/share/rear/skel/default/usr/lib/systemd/system/multi-user.target.wants/automatic-rear.service
new file mode 120000
index 00000000..3e8a4161
--- /dev/null
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/multi-user.target.wants/automatic-rear.service
@@ -0,0 +1 @@
+../automatic-rear.service
\ No newline at end of file
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/network-online.target b/usr/share/rear/skel/default/usr/lib/systemd/system/network-online.target
new file mode 100644
index 00000000..c3edfeb4
--- /dev/null
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/network-online.target
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+#
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Network is Online
+Documentation=man:systemd.special(7)
+Documentation=https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget
+After=network.target
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/network-online.target.wants/sysinit.service b/usr/share/rear/skel/default/usr/lib/systemd/system/network-online.target.wants/sysinit.service
new file mode 120000
index 00000000..ed660a10
--- /dev/null
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/network-online.target.wants/sysinit.service
@@ -0,0 +1 @@
+../sysinit.service
\ No newline at end of file
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/rsyslog.service b/usr/share/rear/skel/default/usr/lib/systemd/system/rsyslog.service
index ac171e0f..18fa17b5 100644
--- a/usr/share/rear/skel/default/usr/lib/systemd/system/rsyslog.service
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/rsyslog.service
@@ -1,6 +1,5 @@
[Unit]
Description=Relax-and-Recover run-syslog script
-DefaultDependencies=no
[Service]
Type=simple
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.service b/usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.service
index ee22fafc..b34b2fe8 100644
--- a/usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.service
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.service
@@ -1,9 +1,14 @@
[Unit]
Description=Initialize Rescue System
-After=systemd-udevd.service
+DefaultDependencies=no
+After=systemd-udevd.service rear-boot-helper.service
+Before=network-online.target
[Service]
Type=oneshot
ExecStart=/etc/scripts/system-setup
StandardInput=tty
RemainAfterExit=yes
+
+[Install]
+WantedBy=network-online.target
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.target b/usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.target
index 4187ef67..2a16369b 100644
--- a/usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.target
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.target
@@ -4,3 +4,5 @@
[Unit]
Description=System Initialization
+Wants=sysinit.service rear-boot-helper.service
+After=sysinit.service rear-boot-helper.service
diff --git a/usr/share/rear/skel/default/usr/lib/systemd/system/syslog.socket b/usr/share/rear/skel/default/usr/lib/systemd/system/syslog.socket
index 9a0064c0..3fb02344 100644
--- a/usr/share/rear/skel/default/usr/lib/systemd/system/syslog.socket
+++ b/usr/share/rear/skel/default/usr/lib/systemd/system/syslog.socket
@@ -4,7 +4,6 @@
[Unit]
Description=Syslog Socket
-DefaultDependencies=no
Before=sockets.target syslog.target
[Socket]

View File

@ -1,69 +0,0 @@
From 1ca518c2a0e675ace956ef71bc79d67e4990562b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= <lzaoral@redhat.com>
Date: Fri, 7 Mar 2025 13:03:14 +0100
Subject: [PATCH] 445_guess_bootloader: fix PReP Boot detection on GPT layouts
(#3420)
In layout/save/default/445_guess_bootloader.sh
fix PPC PReP Boot detection on GPT formatted disks
by checking for a "part ... prep ..." entry in disklayout.conf
as in finalize/Linux-ppc64/680_install_PPC_bootlist.sh
The before used 'file $disk_device' output is not stable.
In particular 'grep' for "ID=0x41" (PPC PReP Boot)
in the 'file' output does not work on GPT formatted disks.
Apparently 'file' detects the GPT protective MBR ("ID=0xee").
For example on PPC64le with PowerNV like
# file -s /dev/sdb
/dev/sdb: DOS/MBR boot sector; partition 1 : ID=0xee, ...
# parted -s /dev/sdb print
Partition Table: gpt
Disk Flags: pmbr_boot
Number ... Flags
1 ... prep
And also on x86_64 with a EFI system partition (ID=0xEF) like
# file -s /dev/nvme0n1
/dev/nvme0n1: DOS/MBR boot sector; partition 1 : ID=0xee, ...
# parted -s /dev/nvme0n1 print
Partition Table: gpt
Number ... Flags
1 ... boot, esp
(cherry picked from commit 1ca518c2a0e675ace956ef71bc79d67e4990562b)
---
.../layout/save/default/445_guess_bootloader.sh | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/usr/share/rear/layout/save/default/445_guess_bootloader.sh b/usr/share/rear/layout/save/default/445_guess_bootloader.sh
index 1beffc9a9..f10a3834c 100644
--- a/usr/share/rear/layout/save/default/445_guess_bootloader.sh
+++ b/usr/share/rear/layout/save/default/445_guess_bootloader.sh
@@ -47,6 +47,15 @@ if [ "$ARCH" = "Linux-arm" ] ; then
return
fi
+# Check if any disk contains a PPC PReP boot partition.
+# Detection taken from usr/share/rear/finalize/Linux-ppc64/680_install_PPC_bootlist.sh
+disk_device="$( awk -F ' ' '/^part / {if ($6 ~ /prep/) {print $2}}' $LAYOUT_FILE )"
+if test "$disk_device" ; then
+ LogPrint "Using guessed bootloader 'PPC' for 'rear recover' (found PPC PReP boot partition on $disk_device)"
+ echo "PPC" >$bootloader_file
+ return
+fi
+
# Finally guess the used bootloader by inspecting the first bytes on all disks
# and use the first one that matches a known bootloader string:
for block_device in /sys/block/* ; do
@@ -54,12 +63,6 @@ for block_device in /sys/block/* ; do
# Continue with the next block device when the current block device is not a disk that can be used for booting:
[[ $blockd = hd* || $blockd = sd* || $blockd = cciss* || $blockd = vd* || $blockd = xvd* || $blockd = nvme* || $blockd = mmcblk* || $blockd = dasd* ]] || continue
disk_device=$( get_device_name $block_device )
- # Check if the disk contains a PPC PreP boot partition (ID=0x41):
- if file -s $disk_device | grep -q "ID=0x41" ; then
- LogPrint "Using guessed bootloader 'PPC' (found PPC PreP boot partition 'ID=0x41' on $disk_device)"
- echo "PPC" >$bootloader_file
- return
- fi
# Get all strings in the first 512*4=2048 bytes on the disk:
bootloader_area_strings_file="$TMP_DIR/bootloader_area_strings"
block_size=$( get_block_size ${disk_device##*/} )

View File

@ -1,15 +0,0 @@
commit 1e9e7b3c07912b3960d077e05473dfb61d3a0796
Author: Pavel Cahyna <pcahyna@redhat.com>
Date: Wed Aug 13 16:30:46 2025 +0200
Error out if any unsupported OUTPUT used on s390
diff --git a/usr/share/rear/prep/Linux-s390/034_check_config.sh b/usr/share/rear/prep/Linux-s390/034_check_config.sh
new file mode 100644
index 000000000..6c3eab289
--- /dev/null
+++ b/usr/share/rear/prep/Linux-s390/034_check_config.sh
@@ -0,0 +1,3 @@
+if [ "$OUTPUT" != "RAMDISK" ] && [ "$OUTPUT" != "IPL" ] ; then
+ Error "Currently, only OUTPUT=RAMDISK and OUTPUT=IPL are supported on s390/s390x"
+fi

File diff suppressed because it is too large Load Diff

View File

@ -1,74 +0,0 @@
diff --git a/usr/share/rear/build/default/990_verify_rootfs.sh b/usr/share/rear/build/default/990_verify_rootfs.sh
index 76a4f1f4b..1b76d8019 100644
--- a/usr/share/rear/build/default/990_verify_rootfs.sh
+++ b/usr/share/rear/build/default/990_verify_rootfs.sh
@@ -69,6 +69,11 @@ fi
Log "Testing each binary (except links) with ldd and look for 'not found' libraries within the recovery system"
local binary=""
local broken_binaries=""
+local not_found_output=""
+local not_found_library=""
+local junk=""
+local actually_found_library=""
+local actually_missing_libraries="no"
# Third-party backup tools may use LD_LIBRARY_PATH to find their libraries
# so that for testing such third-party backup tools we must also use
# their special LD_LIBRARY_PATH here:
@@ -151,7 +156,6 @@ test $old_LD_LIBRARY_PATH && export LD_LIBRARY_PATH=$old_LD_LIBRARY_PATH || unse
# Report binaries with 'not found' shared object dependencies:
local fatal_missing_library=""
if contains_visible_char "$broken_binaries" ; then
- LogPrintError "There are binaries or libraries in the ReaR recovery system that need additional libraries"
local ldd_output=""
for binary in $broken_binaries ; do
# Only for programs (i.e. files in a .../bin/... or .../sbin/... directory) treat a missing library as fatal
@@ -161,26 +165,43 @@ if contains_visible_char "$broken_binaries" ; then
if test "$NON_FATAL_BINARIES_WITH_MISSING_LIBRARY" ; then
# A program with missing library is treated as fatal when it does not match the pattern:
if grep -E -q "$NON_FATAL_BINARIES_WITH_MISSING_LIBRARY" <<<"$binary" ; then
- LogPrintError "$binary requires additional libraries (specified as non-fatal)"
+ LogPrint "$binary requires libraries where 'ldd' shows 'not found' (specified as non-fatal)"
else
- LogPrintError "$binary requires additional libraries (fatal error)"
+ LogPrint "$binary requires libraries where 'ldd' shows 'not found' (fatal error)"
fatal_missing_library="yes"
fi
else
- LogPrintError "$binary requires additional libraries (fatal error)"
+ LogPrint "$binary requires libraries where 'ldd' shows 'not found' (fatal by default)"
fatal_missing_library="yes"
fi
else
- LogPrintError "$binary requires additional libraries"
+ LogPrint "$binary requires libraries where 'ldd' shows 'not found'"
fi
# Run the same ldd call as above but now keep its whole output:
ldd_output="$( chroot $ROOTFS_DIR /bin/ldd $binary )"
# Have the whole ldd output only in the log:
Log "$ldd_output"
+ # For each 'not found' shared object (i.e. a shared object that was 'not found' by 'ldd')
+ # check whether or not the shared object may exist nevertheless in the ReaR recovery system
+ # and if yes, we may sufficiently safely assume things are OK in the ReaR recovery system
+ # so we do not report it as missing to the user (for debugging we have all in the log)
+ # cf. https://github.com/rear/rear/issues/3021#issuecomment-2165453757
+ not_found_output="$( grep 'not found' <<<"$ldd_output" )"
+ # not_found_output is a string of multiple lines (separated by \n) that look e.g. like
+ # libsystemd-shared-255.4-1.fc40.so => not found
+ # /path/to/library => not found
+ while read not_found_library junk ; do
+ # We prefer a simple 'grep -q' pipe over dealing with find -name versus -path options:
+ if actually_found_library="$( find $ROOTFS_DIR -xdev | grep "$not_found_library" )" ; then
+ LogPrint "$binary requires $not_found_library which was not found by 'ldd' but exists as $actually_found_library"
+ else
+ actually_missing_libraries="yes"
# Show only the missing libraries to the user to not flood his screen with tons of other ldd output lines:
- PrintError "$( grep 'not found' <<<"$ldd_output" )"
+ LogPrintError "$binary requires $not_found_library which could not be found in the ReaR recovery system"
+ fi
+ done <<<"$not_found_output"
done
- LogPrintError "ReaR recovery system in '$ROOTFS_DIR' needs additional libraries, check $RUNTIME_LOGFILE for details"
+ is_true $actually_missing_libraries && LogPrintError "ReaR recovery system in '$ROOTFS_DIR' needs additional libraries, check $RUNTIME_LOGFILE for details"
is_true "$fatal_missing_library" && keep_build_dir
fi

View File

@ -1,301 +0,0 @@
diff --git a/doc/user-guide/06-layout-configuration.adoc b/doc/user-guide/06-layout-configuration.adoc
index 88ba0420f..680d69640 100644
--- a/doc/user-guide/06-layout-configuration.adoc
+++ b/doc/user-guide/06-layout-configuration.adoc
@@ -35,22 +35,22 @@ Layout information is stored in +/var/lib/rear/layout/disklayout.conf+. The term
Consider the information from the following system as an example:
----------------------------------
disk /dev/sda 160041885696 msdos
-# disk /dev/sdb 320072933376 msdos
-# disk /dev/sdc 1999696297984 msdos
+#disk /dev/sdb 320072933376 msdos
+#disk /dev/sdc 1999696297984 msdos
part /dev/sda 209682432 32768 primary boot /dev/sda1
part /dev/sda 128639303680 209719296 primary lvm /dev/sda2
part /dev/sda 31192862720 128849022976 primary none /dev/sda3
-# part /dev/sdb 162144912384 32256 primary none /dev/sdb1
-# part /dev/sdb 152556666880 162144944640 primary none /dev/sdb2
-# part /dev/sdb 5371321856 314701611520 primary boot /dev/sdb3
-# part /dev/sdc 1073741824000 1048576 primary boot /dev/sdc1
-# part /dev/sdc 925953425408 1073742872576 primary lvm /dev/sdc2
-# lvmdev /dev/backup /dev/sdc2 cJp4Mt-Vkgv-hVlr-wTMb-0qeA-FX7j-3C60p5 1808502784
+#part /dev/sdb 162144912384 32256 primary none /dev/sdb1
+#part /dev/sdb 152556666880 162144944640 primary none /dev/sdb2
+#part /dev/sdb 5371321856 314701611520 primary boot /dev/sdb3
+#part /dev/sdc 1073741824000 1048576 primary boot /dev/sdc1
+#part /dev/sdc 925953425408 1073742872576 primary lvm /dev/sdc2
+#lvmdev /dev/backup /dev/sdc2 cJp4Mt-Vkgv-hVlr-wTMb-0qeA-FX7j-3C60p5 1808502784
lvmdev /dev/system /dev/mapper/disk N4Hpdc-DkBP-Hdm6-Z6FH-VixZ-7tTb-LiRt0w 251244544
-# lvmgrp /dev/backup 4096 220764 904249344
+#lvmgrp /dev/backup 4096 220764 904249344
lvmgrp /dev/system 4096 30669 125620224
-# lvmvol /dev/backup backup 12800 104857600
-# lvmvol /dev/backup externaltemp 38400 314572800
+#lvmvol /dev/backup backup 12800 104857600
+#lvmvol /dev/backup externaltemp 38400 314572800
lvmvol /dev/system root 2560 20971520
lvmvol /dev/system home 5120 41943040
lvmvol /dev/system var 2560 20971520
@@ -81,45 +81,7 @@ It's easy to see that there are 3 disks attached to the system. +/dev/sda+ is th
Relax-and-Recover has reasonable defaults when creating the recovery
information. It has commented out the two external disks and any
component that's part of it. The reason is that no mounted filesystem
-uses these two disks. After all, you don't want to recreate your
-backup disk when you're recovering your system.
-
-If we mount the filesystem on +/dev/mapper/backup-backup+ on +/media/backup+,
-Relax-and-Recover will think that it's necessary to recreate the filesystem:
-----------------------------------
-disk /dev/sda 160041885696 msdos
-# disk /dev/sdb 320072933376 msdos
-disk /dev/sdc 1999696297984 msdos
-part /dev/sda 209682432 32768 primary boot /dev/sda1
-part /dev/sda 128639303680 209719296 primary lvm /dev/sda2
-part /dev/sda 31192862720 128849022976 primary none /dev/sda3
-# part /dev/sdb 162144912384 32256 primary none /dev/sdb1
-# part /dev/sdb 152556666880 162144944640 primary none /dev/sdb2
-# part /dev/sdb 5371321856 314701611520 primary boot /dev/sdb3
-part /dev/sdc 1073741824000 1048576 primary boot /dev/sdc1
-part /dev/sdc 925953425408 1073742872576 primary lvm /dev/sdc2
-lvmdev /dev/backup /dev/sdc2 cJp4Mt-Vkgv-hVlr-wTMb-0qeA-FX7j-3C60p5 1808502784
-lvmdev /dev/system /dev/mapper/disk N4Hpdc-DkBP-Hdm6-Z6FH-VixZ-7tTb-LiRt0w 251244544
-lvmgrp /dev/backup 4096 220764 904249344
-lvmgrp /dev/system 4096 30669 125620224
-lvmvol /dev/backup backup 12800 104857600
-lvmvol /dev/backup externaltemp 38400 314572800
-lvmvol /dev/system root 2560 20971520
-lvmvol /dev/system home 5120 41943040
-lvmvol /dev/system var 2560 20971520
-lvmvol /dev/system swap 512 4194304
-lvmvol /dev/system vmxfs 7680 62914560
-lvmvol /dev/system kvm 5000 40960000
-fs /dev/mapper/system-root / ext4 uuid=dbb0c0d4-7b9a-40e2-be83-daafa14eff6b label= blocksize=4096 reserved_blocks=131072 max_mounts=21 check_interval=180d options=rw,commit=0
-fs /dev/mapper/system-home /home ext4 uuid=e9310015-6043-48cd-a37d-78dbfdba1e3b label= blocksize=4096 reserved_blocks=262144 max_mounts=38 check_interval=180d options=rw,commit=0
-fs /dev/mapper/system-var /var ext4 uuid=a12bb95f-99f2-42c6-854f-1cb3f144d662 label= blocksize=4096 reserved_blocks=131072 max_mounts=23 check_interval=180d options=rw,commit=0
-fs /dev/mapper/system-vmxfs /vmware xfs uuid=7457d2ab-8252-4f41-bab6-607316259975 label= options=rw,noatime
-fs /dev/mapper/system-kvm /kvm ext4 uuid=173ab1f7-8450-4176-8cf7-c09b47f5e3cc label= blocksize=4096 reserved_blocks=256000 max_mounts=21 check_interval=180d options=rw,noatime,commit=0
-fs /dev/sda1 /boot ext3 uuid=f6b08566-ea5e-46f9-8f73-5e8ffdaa7be6 label= blocksize=1024 reserved_blocks=10238 max_mounts=35 check_interval=180d options=rw,commit=0
-fs /dev/mapper/backup-backup /media/backup ext4 uuid=da20354a-dc4c-4bef-817c-1c92894bb002 label= blocksize=4096 reserved_blocks=655360 max_mounts=24 check_interval=180d options=rw
-swap /dev/mapper/system-swap uuid=9f347fc7-1605-4788-98fd-fca828beedf1 label=
-crypt /dev/mapper/disk /dev/sda2 cipher=aes-xts-plain hash=sha1 uuid=beafe67c-d9a4-4992-80f1-e87791a543bb
-----------------------------------
+uses these two disks.
This behavior is controlled by the +AUTOEXCLUDE_DISKS=y+ parameter in
+default.conf+. If we unset it in the local configuration, Relax-and-Recover
@@ -131,61 +93,81 @@ multipath disks. Typically, they are part of the SAN disaster recovery
strategy. However, there can be cases where you want to recover them. The
information is retained in +disklayout.conf+.
-=== Manual excludes
-It seems prudent to prevent the external drives from ever being backed-up or overwritten. The default configuration contains these lines:
+Some filesystems are excluded from the layout file by default if their
+mountpoints are located under certain directories. This behavior is
+controlled by the +AUTOEXCLUDE_PATH+ variable. It is an array of
+paths. If a mountpoint of a filesystem is under one of the paths, the
+filesystem is excluded. The default value includes +/media+, +/mnt+
+and +/tmp+. See +default.conf+ for the full list. Note that if one of
+the paths is itself a mountpoint, the filesystem is not excluded. So,
+if +/media+ is a mounted filesystem, it will not be excluded, but if
+we mount the +/dev/mapper/backup-backup+ filesystem on
++/media/backup+, it will get excluded, as the mountpoint is under
++/media+.
+
+If we mount the filesystem on +/dev/mapper/backup-backup+ on +/backup+,
+Relax-and-Recover will think that it's necessary to recreate the filesystem:
----------------------------------
-# Exclude components from being backed up, recreation information is active
-EXCLUDE_BACKUP=()
-
-# Exclude components during component recreation
-# will be added to EXCLUDE_BACKUP (it is not backed up)
-# recreation information gathered, but commented out
-EXCLUDE_RECREATE=()
-
-# Exclude components during the backup restore phase
-# only used to exclude files from the restore.
-EXCLUDE_RESTORE=()
+disk /dev/sdc 1999696297984 msdos
+...
+part /dev/sdc 1073741824000 1048576 primary boot /dev/sdc1
+part /dev/sdc 925953425408 1073742872576 primary lvm /dev/sdc2
+lvmdev /dev/backup /dev/sdc2 cJp4Mt-Vkgv-hVlr-wTMb-0qeA-FX7j-3C60p5 1808502784
+...
+lvmgrp /dev/backup 4096 220764 904249344
+...
+lvmvol /dev/backup backup 12800 104857600
+lvmvol /dev/backup externaltemp 38400 314572800
+...
+fs /dev/mapper/backup-backup /backup ext4 uuid=da20354a-dc4c-4bef-817c-1c92894bb002 label= blocksize=4096 reserved_blocks=655360 max_mounts=24 check_interval=180d options=rw
----------------------------------
-To prevent an inadvertently mounted backup filesystem being added to the restore list, the easiest way is to add the filesystem to the +EXCLUDE_RECREATE+ array.
-----------------------------------
-EXCLUDE_RECREATE+=( "fs:/media/backup" )
+=== Manual excludes
+In this example, the external drive +/dev/sdc+ contains a volume group
+used for backups outside Relax-and-Recover. It is assumed that one
+does not want to overwrite and recreate the content of the backup disk
+when recovering the system, but one expects the backup disk to survive
+the recovery unchanged, and that one also does not want
+Relax-and-Recover to make a backup of its content. (Note that
+excluding a filesystem from the layout file also excludes the files in
+the filesystem from the backup when using a supported backup method,
+which is what we want in this case.) One thus needs to
+exclude the components on the disk from the layout file.
+A generic mechanism for doing this is the +EXCLUDE_RECREATE+
+variable. It can contain a list of storage components that will be
+excluded from the layout (will be present in the layout file, but
+commented out) recursively together with their descendants (components
+that depend on the excluded component, like a filesystem on the
+underlying logical volume). Each component in the list corresponds to
+a component in the layout file, but the syntax is different. To
+specify a mounted filesystem, use the +fs:+ prefix:
++fs:+<mountpoint>. To specify swap, use the +swap:+ prefix. The syntax
+to specify a volume group to exclude (together with all its logical
+volumes and filesystems on them) is +/dev/+<volume group name>. Consult
+the +/var/lib/rear/layout/disktodo.conf+ file created together with
+the layout file for the full list of components in a compatible
+syntax.
+
+To prevent the mounted backup filesystem from being added to
+the layout file and recreated, one may add the filesystem to the +EXCLUDE_RECREATE+ array.
+----------------------------------
+EXCLUDE_RECREATE+=( "fs:/backup" )
----------------------------------
The layout file is as expected:
----------------------------------
-disk /dev/sda 160041885696 msdos
-# disk /dev/sdb 320072933376 msdos
-# disk /dev/sdc 1999696297984 msdos
-part /dev/sda 209682432 32768 primary boot /dev/sda1
-part /dev/sda 128639303680 209719296 primary lvm /dev/sda2
-part /dev/sda 31192862720 128849022976 primary none /dev/sda3
-# part /dev/sdb 162144912384 32256 primary none /dev/sdb1
-# part /dev/sdb 152556666880 162144944640 primary none /dev/sdb2
-# part /dev/sdb 5371321856 314701611520 primary boot /dev/sdb3
-# part /dev/sdc 1073741824000 1048576 primary boot /dev/sdc1
-# part /dev/sdc 925953425408 1073742872576 primary lvm /dev/sdc2
-# lvmdev /dev/backup /dev/sdc2 cJp4Mt-Vkgv-hVlr-wTMb-0qeA-FX7j-3C60p5 1808502784
-lvmdev /dev/system /dev/mapper/disk N4Hpdc-DkBP-Hdm6-Z6FH-VixZ-7tTb-LiRt0w 251244544
-# lvmgrp /dev/backup 4096 220764 904249344
-lvmgrp /dev/system 4096 30669 125620224
-# lvmvol /dev/backup backup 12800 104857600
-# lvmvol /dev/backup externaltemp 38400 314572800
-lvmvol /dev/system root 2560 20971520
-lvmvol /dev/system home 5120 41943040
-lvmvol /dev/system var 2560 20971520
-lvmvol /dev/system swap 512 4194304
-lvmvol /dev/system vmxfs 7680 62914560
-lvmvol /dev/system kvm 5000 40960000
-fs /dev/mapper/system-root / ext4 uuid=dbb0c0d4-7b9a-40e2-be83-daafa14eff6b label= blocksize=4096 reserved_blocks=131072 max_mounts=21 check_interval=180d options=rw,commit=0
-fs /dev/mapper/system-home /home ext4 uuid=e9310015-6043-48cd-a37d-78dbfdba1e3b label= blocksize=4096 reserved_blocks=262144 max_mounts=38 check_interval=180d options=rw,commit=0
-fs /dev/mapper/system-var /var ext4 uuid=a12bb95f-99f2-42c6-854f-1cb3f144d662 label= blocksize=4096 reserved_blocks=131072 max_mounts=23 check_interval=180d options=rw,commit=0
-fs /dev/mapper/system-vmxfs /vmware xfs uuid=7457d2ab-8252-4f41-bab6-607316259975 label= options=rw,noatime
-fs /dev/mapper/system-kvm /kvm ext4 uuid=173ab1f7-8450-4176-8cf7-c09b47f5e3cc label= blocksize=4096 reserved_blocks=256000 max_mounts=21 check_interval=180d options=rw,noatime,commit=0
-fs /dev/sda1 /boot ext3 uuid=f6b08566-ea5e-46f9-8f73-5e8ffdaa7be6 label= blocksize=1024 reserved_blocks=10238 max_mounts=35 check_interval=180d options=rw,commit=0
-# fs /dev/mapper/backup-backup /media/backup ext4 uuid=da20354a-dc4c-4bef-817c-1c92894bb002 label= blocksize=4096 reserved_blocks=655360 max_mounts=24 check_interval=180d options=rw
-swap /dev/mapper/system-swap uuid=9f347fc7-1605-4788-98fd-fca828beedf1 label=
-crypt /dev/mapper/disk /dev/sda2 cipher=aes-xts-plain hash=sha1 uuid=beafe67c-d9a4-4992-80f1-e87791a543bb
+#disk /dev/sdc 1999696297984 msdos
+...
+#part /dev/sdc 1073741824000 1048576 primary boot /dev/sdc1
+#part /dev/sdc 925953425408 1073742872576 primary lvm /dev/sdc2
+#lvmdev /dev/backup /dev/sdc2 cJp4Mt-Vkgv-hVlr-wTMb-0qeA-FX7j-3C60p5 1808502784
+...
+#lvmgrp /dev/backup 4096 220764 904249344
+...
+#lvmvol /dev/backup backup 12800 104857600
+#lvmvol /dev/backup externaltemp 38400 314572800
+...
+#fs /dev/mapper/backup-backup /backup ext4 uuid=da20354a-dc4c-4bef-817c-1c92894bb002 label= blocksize=4096 reserved_blocks=655360 max_mounts=24 check_interval=180d options=rw
----------------------------------
Another approach would be to exclude the backup volume group. This is achieved by adding this line to the local configuration:
@@ -295,22 +277,22 @@ checking the disklayout file, we'd better do that.
----------------------------------
#? 1
disk /dev/sdb 160041885696 msdos
-# disk _REAR1_ 320072933376 msdos
-# disk /dev/sdc 1999696297984 msdos
+#disk _REAR1_ 320072933376 msdos
+#disk /dev/sdc 1999696297984 msdos
part /dev/sdb 209682432 32768 primary boot /dev/sdb1
part /dev/sdb -20916822016 209719296 primary lvm /dev/sdb2
part /dev/sdb 31192862720 128849022976 primary none /dev/sdb3
-# part _REAR1_ 162144912384 32256 primary none _REAR1_1
-# part _REAR1_ 152556666880 162144944640 primary none _REAR1_2
-# part _REAR1_ 5371321856 314701611520 primary boot _REAR1_3
-# part /dev/sdc 1073741824000 1048576 primary boot /dev/sdc1
-# part /dev/sdc 925953425408 1073742872576 primary lvm /dev/sdc2
-# lvmdev /dev/backup /dev/sdc2 cJp4Mt-Vkgv-hVlr-wTMb-0qeA-FX7j-3C60p5 1808502784
+#part _REAR1_ 162144912384 32256 primary none _REAR1_1
+#part _REAR1_ 152556666880 162144944640 primary none _REAR1_2
+#part _REAR1_ 5371321856 314701611520 primary boot _REAR1_3
+#part /dev/sdc 1073741824000 1048576 primary boot /dev/sdc1
+#part /dev/sdc 925953425408 1073742872576 primary lvm /dev/sdc2
+#lvmdev /dev/backup /dev/sdc2 cJp4Mt-Vkgv-hVlr-wTMb-0qeA-FX7j-3C60p5 1808502784
lvmdev /dev/system /dev/mapper/disk N4Hpdc-DkBP-Hdm6-Z6FH-VixZ-7tTb-LiRt0w 251244544
-# lvmgrp /dev/backup 4096 220764 904249344
+#lvmgrp /dev/backup 4096 220764 904249344
lvmgrp /dev/system 4096 30669 125620224
-# lvmvol /dev/backup backup 12800 104857600
-# lvmvol /dev/backup externaltemp 38400 314572800
+#lvmvol /dev/backup backup 12800 104857600
+#lvmvol /dev/backup externaltemp 38400 314572800
lvmvol /dev/system root 2560 20971520
lvmvol /dev/system home 5120 41943040
lvmvol /dev/system var 2560 20971520
@@ -323,7 +305,7 @@ fs /dev/mapper/system-var /var ext4 uuid=a12bb95f-99f2-42c6-854f-1cb3f144d662 la
fs /dev/mapper/system-vmxfs /vmware xfs uuid=7457d2ab-8252-4f41-bab6-607316259975 label= options=rw,noatime
fs /dev/mapper/system-kvm /kvm ext4 uuid=173ab1f7-8450-4176-8cf7-c09b47f5e3cc label= blocksize=4096 reserved_blocks=256000 max_mounts=21 check_interval=180d options=rw,noatime,commit=0
fs /dev/sdb1 /boot ext3 uuid=f6b08566-ea5e-46f9-8f73-5e8ffdaa7be6 label= blocksize=1024 reserved_blocks=10238 max_mounts=35 check_interval=180d options=rw,commit=0
-# fs /dev/mapper/backup-backup /media/backup ext4 uuid=da20354a-dc4c-4bef-817c-1c92894bb002 label= blocksize=4096 reserved_blocks=655360 max_mounts=24 check_interval=180d options=rw
+#fs /dev/mapper/backup-backup /backup ext4 uuid=da20354a-dc4c-4bef-817c-1c92894bb002 label= blocksize=4096 reserved_blocks=655360 max_mounts=24 check_interval=180d options=rw
swap /dev/mapper/system-swap uuid=9f347fc7-1605-4788-98fd-fca828beedf1 label=
crypt /dev/mapper/disk /dev/sdb2 cipher=aes-xts-plain hash=sha1 uuid=beafe67c-d9a4-4992-80f1-e87791a543bb
@@ -344,22 +326,22 @@ The /kvm and /vmware filesystems are quite big. We don't care about them, so jus
The resulting layout file looks like this:
----------------------------------
disk /dev/sdb 160041885696 msdos
-# disk _REAR1_ 320072933376 msdos
-# disk /dev/sdc 1999696297984 msdos
+#disk _REAR1_ 320072933376 msdos
+#disk /dev/sdc 1999696297984 msdos
part /dev/sdb 209682432 32768 primary boot /dev/sdb1
part /dev/sdb -20916822016 209719296 primary lvm /dev/sdb2
part /dev/sdb 31192862720 128849022976 primary none /dev/sdb3
-# part _REAR1_ 162144912384 32256 primary none _REAR1_1
-# part _REAR1_ 152556666880 162144944640 primary none _REAR1_2
-# part _REAR1_ 5371321856 314701611520 primary boot _REAR1_3
-# part /dev/sdc 1073741824000 1048576 primary boot /dev/sdc1
-# part /dev/sdc 925953425408 1073742872576 primary lvm /dev/sdc2
-# lvmdev /dev/backup /dev/sdc2 cJp4Mt-Vkgv-hVlr-wTMb-0qeA-FX7j-3C60p5 1808502784
+#part _REAR1_ 162144912384 32256 primary none _REAR1_1
+#part _REAR1_ 152556666880 162144944640 primary none _REAR1_2
+#part _REAR1_ 5371321856 314701611520 primary boot _REAR1_3
+#part /dev/sdc 1073741824000 1048576 primary boot /dev/sdc1
+#part /dev/sdc 925953425408 1073742872576 primary lvm /dev/sdc2
+#lvmdev /dev/backup /dev/sdc2 cJp4Mt-Vkgv-hVlr-wTMb-0qeA-FX7j-3C60p5 1808502784
lvmdev /dev/system /dev/mapper/disk N4Hpdc-DkBP-Hdm6-Z6FH-VixZ-7tTb-LiRt0w 251244544
-# lvmgrp /dev/backup 4096 220764 904249344
+#lvmgrp /dev/backup 4096 220764 904249344
lvmgrp /dev/system 4096 30669 125620224
-# lvmvol /dev/backup backup 12800 104857600
-# lvmvol /dev/backup externaltemp 38400 314572800
+#lvmvol /dev/backup backup 12800 104857600
+#lvmvol /dev/backup externaltemp 38400 314572800
lvmvol /dev/system root 2560 20971520
lvmvol /dev/system home 5120 41943040
lvmvol /dev/system var 2560 20971520
@@ -372,7 +354,7 @@ fs /dev/mapper/system-var /var ext4 uuid=a12bb95f-99f2-42c6-854f-1cb3f144d662 la
#fs /dev/mapper/system-vmxfs /vmware xfs uuid=7457d2ab-8252-4f41-bab6-607316259975 label= options=rw,noatime
#fs /dev/mapper/system-kvm /kvm ext4 uuid=173ab1f7-8450-4176-8cf7-c09b47f5e3cc label= blocksize=4096 reserved_blocks=256000 max_mounts=21 check_interval=180d options=rw,noatime,commit=0
fs /dev/sdb1 /boot ext3 uuid=f6b08566-ea5e-46f9-8f73-5e8ffdaa7be6 label= blocksize=1024 reserved_blocks=10238 max_mounts=35 check_interval=180d options=rw,commit=0
-# fs /dev/mapper/backup-backup /media/backup ext4 uuid=da20354a-dc4c-4bef-817c-1c92894bb002 label= blocksize=4096 reserved_blocks=655360 max_mounts=24 check_interval=180d options=rw
+#fs /dev/mapper/backup-backup /backup ext4 uuid=da20354a-dc4c-4bef-817c-1c92894bb002 label= blocksize=4096 reserved_blocks=655360 max_mounts=24 check_interval=180d options=rw
swap /dev/mapper/system-swap uuid=9f347fc7-1605-4788-98fd-fca828beedf1 label=
crypt /dev/mapper/disk /dev/sdb2 cipher=aes-xts-plain hash=sha1 uuid=beafe67c-d9a4-4992-80f1-e87791a543bb
----------------------------------

View File

@ -1,25 +0,0 @@
commit 6289aae51d60d0ce326913f3fc30f5325abb483d
Author: Renaud Métrich <1163635+rmetrich@users.noreply.github.com>
Date: Fri Oct 25 09:14:50 2024 +0200
Make get_disklabel_type() also work for 'multipath' devices (#3334)
Without this fix, get_disklabel_type() used to find a disk to install GRUB on
was returning nothing when the disk was a multipath device.
The reason is that then the line in disklayout.conf starts with 'multipath'
but ReaR had searched for 'disk' only. Now it also searches for 'multipath'.
See https://github.com/rear/rear/pull/3334
diff --git a/usr/share/rear/lib/layout-functions.sh b/usr/share/rear/lib/layout-functions.sh
index 90b16cb20..0763963de 100644
--- a/usr/share/rear/lib/layout-functions.sh
+++ b/usr/share/rear/lib/layout-functions.sh
@@ -529,7 +529,7 @@ function get_disklabel_type () {
disk=''
- read component disk size label junk < <(grep "^disk $1 " "$LAYOUT_FILE")
+ read component disk size label junk < <(grep -E "^(disk|multipath) $1 " "$LAYOUT_FILE")
test $disk || return 1
echo $label

View File

@ -1,117 +0,0 @@
diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf
index 17a764cba..a944114b3 100644
--- a/usr/share/rear/conf/default.conf
+++ b/usr/share/rear/conf/default.conf
@@ -1866,7 +1866,7 @@ OBDR_BLOCKSIZE=2048
# BACKUP=NBU stuff (Symantec/Veritas NetBackup)
##
#
-COPY_AS_IS_NBU=( /usr/openv/bin/vnetd /usr/openv/bin/vopied /usr/openv/lib /usr/openv/netbackup /usr/openv/var/auth/[mn]*.txt /usr/openv/var/vxss /usr/openv/var/webtruststore /usr/openv/resources/nbpxyhelper /opt/VRTSpbx /etc/vx/VxICS /etc/vx/vrtslog.conf /var/log/VRTSpbx )
+COPY_AS_IS_NBU=( /usr/openv/bin/vnetd /usr/openv/bin/vopied /usr/openv/lib /usr/openv/netbackup /usr/openv/var /usr/openv/resources/nbpxyhelper /opt/VRTSpbx /etc/vx/VxICS /etc/vx/vrtslog.conf /var/log/VRTSpbx )
COPY_AS_IS_EXCLUDE_NBU=( "/usr/openv/netbackup/logs/*" "/usr/openv/netbackup/bin/bpjava*" /usr/openv/netbackup/bin/xbp /usr/openv/netbackup/bin/private /usr/openv/lib/java "/usr/openv/lib/*-plugins" /usr/openv/lib/shared/vddk /usr/openv/netbackup/baremetal "/var/log/VRTSpbx/*" )
# See https://github.com/rear/rear/issues/2105 why /usr/openv/netbackup/sec/at/lib/ is needed:
NBU_LD_LIBRARY_PATH="/usr/openv/lib:/usr/openv/netbackup/sec/at/lib/:/usr/openv/lib/boost"
diff --git a/usr/share/rear/finalize/NBU/default/990_copy_bplogrestorelog.sh b/usr/share/rear/finalize/NBU/default/990_copy_bplogrestorelog.sh
index 60d9a222c..e326db612 100644
--- a/usr/share/rear/finalize/NBU/default/990_copy_bplogrestorelog.sh
+++ b/usr/share/rear/finalize/NBU/default/990_copy_bplogrestorelog.sh
@@ -1,5 +1,51 @@
# 990_copy_bprestorelog.sh
-# copy the logfile to the recovered system, at least the part that has been written till now.
+# copy the logfiles to the recovered system, at least the part that has been written till now.
-mkdir -p $TARGET_FS_ROOT/$ROOT_HOME_DIR
-cp -f $TMP_DIR/bplog.restore* $TARGET_FS_ROOT/$ROOT_HOME_DIR/
+# $VAR_DIR/restore will be copied to $recovery_system_recover_log_dir in wrapup/default/990_copy_logfile.sh
+mkdir -p "$VAR_DIR/restore/netbackup"
+cp -pr /usr/openv/netbackup/logs/* "$VAR_DIR/restore/netbackup"
+
+# take care of $VAR_DIR/restore/bplog.restore* files (that used to be in /root before)
+function symlink_bprestore_logs ()
+{
+ # adapted from wrapup/default/990_copy_logfile.sh
+ local final_logfile_name_full
+ local final_logfile_name
+ local log_file_symlink_target
+ local log_file_symlink
+ local recover_log_dir=$LOG_DIR/recover
+ local recovery_system_recover_log_dir=$TARGET_FS_ROOT/$recover_log_dir
+ # Create the directories with mode 0700 (rwx------) so that only root can access files and subdirectories therein
+ # because in particular logfiles could contain security relevant information.
+
+ # To be backward compatible with where to the logfile was copied before
+ # have it as a symbolic link that points to where the logfile actually is:
+ # ( "roots" in recovery_system_roots_home_dir means root's but ' in a variable name is not so good ;-)
+ local recovery_system_roots_home_dir=$TARGET_FS_ROOT/$ROOT_HOME_DIR
+ test -d $recovery_system_roots_home_dir || mkdir $verbose -m 0700 $recovery_system_roots_home_dir
+
+ # Remove existing and now outdated symlinks that would falsely point to the same target
+ # The symlink name bplog.restore-$( date -Iseconds ).log is for example bplog.restore-2019-12-17T09:40:36+01:00.log or rear-2006-08-14T02:34:56-06:00.log
+ # so a matching globbing pattern is bplog.restore-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]*.log ('*' for the UTC offset):
+ for log_file_symlink in $recovery_system_roots_home_dir/bplog.restore*-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]*.log ; do
+ # Skip if a file that matches the globbing pattern is not a symlink (it could be even a directory full of user's sacrocanct files):
+ test -L $log_file_symlink || continue
+ # Remove also outdated dangling symlinks where their target does not exist by using 'readlink -m':
+ test "$log_file_symlink_target" = "$( readlink -m $log_file_symlink )" || continue
+ rm $verbose $log_file_symlink
+ done
+
+ # At the moment this function runs, $VAR_DIR/restore will have been already copied
+ # to $recovery_system_recover_log_dir in wrapup/default/990_copy_logfile.sh
+ # (exit tasks run in reverse order, so this task will run after the tasks defined in
+ # wrapup/default/990_copy_logfile.sh )
+ for final_logfile_name_full in $recovery_system_recover_log_dir/restore/bplog.restore* ; do
+ final_logfile_name="$( basename "$final_logfile_name_full" )"
+ log_file_symlink_target="$recover_log_dir/restore/$final_logfile_name"
+ # Create symlink with current timestamp that points to where the logfile actually is:
+ log_file_symlink=$recovery_system_roots_home_dir/$( basename "$final_logfile_name" .log )-$( date -Iseconds ).log
+ ln $verbose -s $log_file_symlink_target $log_file_symlink || true
+ done
+}
+
+AddExitTask "symlink_bprestore_logs"
diff --git a/usr/share/rear/restore/NBU/default/400_restore_with_nbu.sh b/usr/share/rear/restore/NBU/default/400_restore_with_nbu.sh
index 71f7359a1..4280cb021 100644
--- a/usr/share/rear/restore/NBU/default/400_restore_with_nbu.sh
+++ b/usr/share/rear/restore/NBU/default/400_restore_with_nbu.sh
@@ -2,6 +2,23 @@
# 400_restore_with_nbu.sh
# restore files with NBU
+# Unique log file name: adapted from restore/NETFS/default/400_restore_backup.sh
+# and restore/TSM/default/400_restore_with_tsm.sh
+local backup_restore_log_dir="$VAR_DIR/restore"
+mkdir -p $backup_restore_log_dir
+local backup_restore_log_file=""
+local backup_restore_log_prefix="bplog.restore"
+local backup_restore_log_suffix="log"
+# E.g. when "rear -C 'general.conf /path/to/special.conf' recover" was called CONFIG_APPEND_FILES is "general.conf /path/to/special.conf"
+# so that in particular '/' characters must be replaced in the backup restore log file (by a colon) and then
+# the backup restore log file name will be like .../restore/bplog.restore.generalconf_:path:to:specialconf.1234.log
+# It does not work with $( tr -d -c '[:alnum:]/[:space:]' <<<"$CONFIG_APPEND_FILES" | tr -s '/[:space:]' ':_' )
+# because the <<<"$CONFIG_APPEND_FILES" results a trailing newline that becomes a trailing '_' character so that
+# echo -n $CONFIG_APPEND_FILES (without double quotes) is used to avoid leading and trailing spaces and newlines:
+test "$CONFIG_APPEND_FILES" && backup_restore_log_prefix=$backup_restore_log_prefix.$( echo -n $CONFIG_APPEND_FILES | tr -d -c '[:alnum:]/[:space:]' | tr -s '/[:space:]' ':_' )
+
+backup_restore_log_file=$backup_restore_log_dir/$backup_restore_log_prefix.$MASTER_PID.$backup_restore_log_suffix
+
LogPrint "NetBackup: restoring / into $TARGET_FS_ROOT"
echo "change / to $TARGET_FS_ROOT" > $TMP_DIR/nbu_change_file
@@ -10,13 +27,13 @@ echo "change / to $TARGET_FS_ROOT" > $TMP_DIR/nbu_change_file
# $TMP_DIR/restore_fs_list was made by 300_create_nbu_restore_fs_list.sh
if [ ${#NBU_ENDTIME[@]} -gt 0 ] ; then
edate="${NBU_ENDTIME[@]}"
- bprestore_args="-B -H -L $TMP_DIR/bplog.restore -8 -R $TMP_DIR/nbu_change_file -t 0 -w 0 -e ${edate} -C ${NBU_CLIENT_SOURCE} -D ${NBU_CLIENT_NAME} -f $TMP_DIR/restore_fs_list"
+ bprestore_args="-B -H -L $backup_restore_log_file -8 -R $TMP_DIR/nbu_change_file -t 0 -w 0 -e ${edate} -C ${NBU_CLIENT_SOURCE} -D ${NBU_CLIENT_NAME} -f $TMP_DIR/restore_fs_list"
else
- bprestore_args="-B -H -L $TMP_DIR/bplog.restore -8 -R $TMP_DIR/nbu_change_file -t 0 -w 0 -C ${NBU_CLIENT_SOURCE} -D ${NBU_CLIENT_NAME} -f $TMP_DIR/restore_fs_list"
+ bprestore_args="-B -H -L $backup_restore_log_file -8 -R $TMP_DIR/nbu_change_file -t 0 -w 0 -C ${NBU_CLIENT_SOURCE} -D ${NBU_CLIENT_NAME} -f $TMP_DIR/restore_fs_list"
fi
LogPrint "RUN: /usr/openv/netbackup/bin/bprestore $bprestore_args"
-LogPrint "Restore progress: see $TMP_DIR/bplog.restore"
+LogPrint "Restore progress: see $backup_restore_log_file"
LANG=C /usr/openv/netbackup/bin/bprestore $bprestore_args
rc=$?
if (( $rc > 1 )) ; then

View File

@ -1,84 +0,0 @@
diff --git a/usr/share/rear/format/USB/default/300_format_usb_disk.sh b/usr/share/rear/format/USB/default/300_format_usb_disk.sh
index 0e0a2e080..fa6496b23 100644
--- a/usr/share/rear/format/USB/default/300_format_usb_disk.sh
+++ b/usr/share/rear/format/USB/default/300_format_usb_disk.sh
@@ -94,7 +94,13 @@ sleep 5
if is_true "$EFI" ; then
LogPrint "Creating vfat filesystem on EFI system partition on '${RAW_USB_DEVICE}1'"
- if ! mkfs.vfat $v -F 16 -n REAR-EFI ${RAW_USB_DEVICE}1 >&2 ; then
+ # Make a FAT filesystem on the EFI system partition
+ # cf. https://github.com/rear/rear/issues/2575
+ # and output/ISO/Linux-i386/700_create_efibootimg.sh
+ # and output/RAWDISK/Linux-i386/280_create_bootable_disk_image.sh
+ # Let mkfs.vfat automatically select the FAT type based on the size.
+ # I.e. do not use a '-F 16' or '-F 32' option and hope for the best:
+ if ! mkfs.vfat $v -n REAR-EFI ${RAW_USB_DEVICE}1 >&2 ; then
Error "Failed to create vfat filesystem on '${RAW_USB_DEVICE}1'"
fi
# create link for EFI partition in /dev/disk/by-label
diff --git a/usr/share/rear/output/ISO/Linux-i386/700_create_efibootimg.sh b/usr/share/rear/output/ISO/Linux-i386/700_create_efibootimg.sh
index 0eb5350f8..39bbebad8 100644
--- a/usr/share/rear/output/ISO/Linux-i386/700_create_efibootimg.sh
+++ b/usr/share/rear/output/ISO/Linux-i386/700_create_efibootimg.sh
@@ -13,13 +13,33 @@ StopIfError "Failed to determine disk usage of EFI virtual image content directo
# prepare EFI virtual image aligned to 32MiB blocks:
dd if=/dev/zero of=$TMP_DIR/efiboot.img count=$efi_img_sz bs=32M
-mkfs.vfat $v -F 16 $TMP_DIR/efiboot.img >&2
-mkdir -p $v $TMP_DIR/efi_virt >&2
-mount $v -o loop -t vfat -o fat=16 $TMP_DIR/efiboot.img $TMP_DIR/efi_virt >&2
-# copy files from staging directory
+# Make a FAT filesystem on the efiboot.img file and loop mount it
+# cf. https://github.com/rear/rear/issues/2575
+# See output/RAWDISK/Linux-i386/280_create_bootable_disk_image.sh
+# Having a small EFI System Partition (ESP) might introduce problems:
+# - The UEFI spec seems to require a FAT32 EFI System Partition (ESP).
+# - syslinux/Legacy BIOS fails to install on small FAT32 partitions with "syslinux: zero FAT sectors (FAT12/16)".
+# - Some firmwares fail to boot from small FAT32 partitions.
+# - Some firmwares fail to boot from FAT16 partitions.
+# See:
+# - http://www.rodsbooks.com/efi-bootloaders/principles.html
+# - http://lists.openembedded.org/pipermail/openembedded-core/2012-January/055999.html
+# Let mkfs.vfat automatically select the FAT type based on the size.
+# See what "man mkfs.vfat" reads for the '-F' option:
+# "If nothing is specified, mkfs.fat will automatically select
+# between 12, 16 and 32 bit, whatever fits better for the filesystem size"
+# I.e. do not use a '-F 16' or '-F 32' option and hope for the best:
+mkfs.vfat $v $TMP_DIR/efiboot.img
+mkdir -p $v $TMP_DIR/efi_virt
+# Do not specify '-o fat=16' or '-o fat=32' when loop mounting the efiboot.img FAT file
+# but rely on the automatic FAT type detection (see what "man 8 mount" reads for 'fat=...'):
+mount $v -o loop -t vfat $TMP_DIR/efiboot.img $TMP_DIR/efi_virt || Error "Failed to loop mount efiboot.img"
+
+# Copy files from staging directory into efiboot.img
cp $v -r $TMP_DIR/mnt/. $TMP_DIR/efi_virt
-umount $v $TMP_DIR/efiboot.img >&2
-mv $v -f $TMP_DIR/efiboot.img $TMP_DIR/isofs/boot/efiboot.img >&2
-StopIfError "Could not move efiboot.img file"
+umount $v $TMP_DIR/efiboot.img
+
+# Move efiboot.img into ISO directory:
+mv $v -f $TMP_DIR/efiboot.img $TMP_DIR/isofs/boot/efiboot.img || Error "Failed to move efiboot.img to isofs/boot/efiboot.img"
diff --git a/usr/share/rear/output/ISO/Linux-ia64/200_mount_bootimg.sh b/usr/share/rear/output/ISO/Linux-ia64/200_mount_bootimg.sh
index b5f603ec5..716d7d383 100644
--- a/usr/share/rear/output/ISO/Linux-ia64/200_mount_bootimg.sh
+++ b/usr/share/rear/output/ISO/Linux-ia64/200_mount_bootimg.sh
@@ -1,6 +1,11 @@
# 200_mount_bootimg.sh
dd if=/dev/zero of=$TMP_DIR/boot.img count=64000 bs=1024
-# make sure we select FAT16 instead of FAT12 as size >30MB
-mkfs.vfat $v -F 16 $TMP_DIR/boot.img >&2
-mkdir -p $v $TMP_DIR/mnt >&2
-mount $v -o loop -t vfat -o fat=16 $TMP_DIR/boot.img $TMP_DIR/mnt >&2
+# Make a FAT filesystem on the boot.img file and loop mount it
+# cf. https://github.com/rear/rear/issues/2575
+# and output/ISO/Linux-i386/700_create_efibootimg.sh
+# and output/RAWDISK/Linux-i386/280_create_bootable_disk_image.sh
+# Let mkfs.vfat automatically select the FAT type based on the size.
+# I.e. do not use a '-F 16' or '-F 32' option and hope for the best:
+mkfs.vfat $v $TMP_DIR/boot.img
+mkdir -p $v $TMP_DIR/mnt
+mount $v -o loop -t vfat $TMP_DIR/boot.img $TMP_DIR/mnt || Error "Failed to loop mount boot.img"

View File

@ -1,51 +0,0 @@
diff --git a/usr/share/rear/layout/prepare/default/300_map_disks.sh b/usr/share/rear/layout/prepare/default/300_map_disks.sh
index 468aa35cf..40ba876c7 100644
--- a/usr/share/rear/layout/prepare/default/300_map_disks.sh
+++ b/usr/share/rear/layout/prepare/default/300_map_disks.sh
@@ -110,7 +110,10 @@ done
# to current block devices in the currently running recovery system:
while read keyword orig_device orig_size junk ; do
# Continue with next original device when it is already used as source in the mapping file:
- is_mapping_source "$orig_device" && continue
+ if is_mapping_source "$orig_device" ; then
+ DebugPrint "Skip automapping $orig_device with size $orig_size (already exists as source in $MAPPING_FILE)"
+ continue
+ fi
# First, try to find if there is a current disk with same name and same size as the original:
# (possibly influenced by mapping hints if known)
if has_mapping_hint "$orig_device" ; then
@@ -162,7 +165,7 @@ while read keyword orig_device orig_size junk ; do
# Ensure the determined target device is really a block device:
if test -b "$preferred_target_device_name" ; then
add_mapping "$orig_device" "$preferred_target_device_name"
- LogPrint "Using $preferred_target_device_name (same size) for recreating $orig_device"
+ LogPrint "Using $preferred_target_device_name (same size $current_size) for recreating $orig_device"
# Break looping over all current block devices to find one
# and continue with next original device in the LAYOUT_FILE:
break
@@ -213,6 +216,7 @@ while read keyword orig_device orig_size junk ; do
Log "$preferred_target_device_name excluded from device mapping choices (is already used as mapping target)"
continue
fi
+ LogPrint "The size of $preferred_target_device_name is $(blockdev --getsize64 $current_device_path)"
# Add the current device as possible choice for the user:
possible_targets+=( "$preferred_target_device_name" )
done
@@ -225,7 +229,7 @@ while read keyword orig_device orig_size junk ; do
# At the end the mapping file is shown and the user can edit it if he does not like an automated mapping:
if test "1" -eq "${#possible_targets[@]}" ; then
add_mapping "$orig_device" "$possible_targets"
- LogPrint "Using $possible_targets (the only appropriate) for recreating $orig_device"
+ LogPrint "Using $possible_targets (the only available of the disks) for recreating $orig_device with size $orig_size"
# Continue with next original device in the LAYOUT_FILE:
continue
fi
@@ -233,7 +237,7 @@ while read keyword orig_device orig_size junk ; do
skip_choice="Do not map $preferred_orig_device_name"
regular_choices=( "${possible_targets[@]}" "$skip_choice" )
rear_shell_choice="Use Relax-and-Recover shell and return back to here"
- prompt="Choose an appropriate replacement for $preferred_orig_device_name"
+ prompt="Choose an appropriate replacement for $preferred_orig_device_name with size $orig_size"
choice=""
wilful_input=""
# Generate a runtime-specific user_input_ID so that for each unmapped original device

View File

@ -1,46 +0,0 @@
commit ad720ad788be1d653da31be36fca5e886e314ddb
Author: Pavel Cahyna <pcahyna@redhat.com>
Date: Thu Aug 24 11:41:25 2023 +0200
Remove the lvmdevices file at the end of recovery
The file /etc/lvm/devices/system.devices restricts LVM to disks with
given (hardware) IDs (serial numbers, WWNs). See lvmdevices(8).
Unfortunately, when restoring to different disks than in the original
system, it will mean that LVM is broken in the recovered system (it
won't find any disks). Therefore it is safer to remove the file to
force the old behavior where LVM scans all disks. This used to be the
LVM default (use_devicesfile=0).
diff --git a/usr/share/rear/finalize/GNU/Linux/230_remove_lvmdevices.sh b/usr/share/rear/finalize/GNU/Linux/230_remove_lvmdevices.sh
new file mode 100644
index 00000000..a51e6bca
--- /dev/null
+++ b/usr/share/rear/finalize/GNU/Linux/230_remove_lvmdevices.sh
@@ -0,0 +1,25 @@
+# Adapted from 260_rename_diskbyid.sh
+
+# Remove /etc/lvm/devices/system.devices
+# The file restricts LVM to disks with given (hardware) IDs (serial
+# numbers, WWNs). See lvmdevices(8).
+# Unfortunately, when restoring to different disks than in the original
+# system, it will mean that LVM is broken in the recovered system (it
+# won't find any disks). Therefore it is safer to remove the file to
+# force the old behavior where LVM scans all disks. This used to be the
+# LVM default (use_devicesfile=0).
+
+# There may be other files under /etc/lvm/devices, but they are not used
+# by default
+
+local file=/etc/lvm/devices/system.devices
+local realfile
+
+realfile="$TARGET_FS_ROOT/$file"
+# OK if file not found
+test -f "$realfile" || return 0
+mv $v "$realfile" "${realfile}.rearbak"
+LogPrint "Renamed LVM devices file $realfile to ${realfile}.rearbak
+to prevent LVM problems in the recovered system, verify that the file
+is correct after booting the recovered system and move it back, or
+regenerate it using vgimportdevices."

View File

@ -1,27 +0,0 @@
From ed10cb3c612c49a6442e679052b755c52248ab3d Mon Sep 17 00:00:00 2001
From: "D'Haese, Gratien [GTSBE - Non JJ]" <GDHAESE1@ITS.JNJ.COM>
Date: Fri, 28 Feb 2025 17:05:21 +0100
Subject: [PATCH] On EL9 sshd will not start anymore #3413
---
usr/share/rear/skel/default/etc/scripts/run-sshd | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/usr/share/rear/skel/default/etc/scripts/run-sshd b/usr/share/rear/skel/default/etc/scripts/run-sshd
index 23b8233eed..3a422fe7cd 100755
--- a/usr/share/rear/skel/default/etc/scripts/run-sshd
+++ b/usr/share/rear/skel/default/etc/scripts/run-sshd
@@ -13,6 +13,12 @@ if grep -q '^ssh:' /etc/inittab ; then
ssh-keygen -q -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key
echo -e "\nSSH fingerprint: $( ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub )\n" >> /etc/issue
fi
+ if ! test -s /etc/ssh/ssh_host_ed25519_key ; then
+ # Generate the ed25519 SSH host key required on EL9
+ ssh-keygen -q -t ed25519 -N '' -f /etc/ssh/ssh_host_ed25519_key
+ echo -e "\nSSH fingerprint: $( ssh-keygen -l -f /etc/ssh/ssh_host_ed25519_key.pub )\n" >> /etc/issue
+ fi
+ mkdir -p /usr/share/empty.sshd # required on EL9
mkdir -p /run/sshd
# Avoid "Could not load host key: /etc/ssh/ssh_host_..._key" messages
# that look confusing on the recovery system login screen

View File

@ -1,21 +0,0 @@
diff --git a/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh b/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh
index 0e402b017..9e1810c9a 100644
--- a/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh
+++ b/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh
@@ -117,10 +117,13 @@ local copy_as_is_file=""
# cf. https://github.com/rear/rear/pull/2378
# It is crucial to append to /dev/$DISPENSABLE_OUTPUT_DEV (cf. 'Print' in lib/_input-output-functions.sh):
while read -r copy_as_is_file ; do
- # Skip non-regular files like directories, device files, and 'tar' error messages (e.g. in case of non-existent files, see above):
+ # Skip non-regular files like directories, device files, and 'tar' error messages (e.g. in case of non-existent files, see above)
+ # but do not skip symbolic links. Their targets will be copied later by build/default/490_fix_broken_links.sh.
+ # We thus need library dependencies for symlinked executables just like for normal executables
+ # and build/default/490_fix_broken_links.sh does not perform library dependency scan.
+ # See GitHub PR https://github.com/rear/rear/pull/3073
+ # and issue https://github.com/rear/rear/issues/3064 for details.
test -f "$copy_as_is_file" || continue
- # Skip symbolic links (only care about symbolic link targets):
- test -L "$copy_as_is_file" && continue
# Remember actual regular files that are executable:
test -x "$copy_as_is_file" && copy_as_is_executables+=( "$copy_as_is_file" )
done < <( sort -u $copy_as_is_filelist_file ) 2>>/dev/$DISPENSABLE_OUTPUT_DEV

View File

@ -1,107 +0,0 @@
From 71e854e28db3b02497cd48637cc22bda843ccab0 Mon Sep 17 00:00:00 2001
From: gdha <gratien.dhaese@gmail.com>
Date: Thu, 13 Feb 2025 15:59:31 +0100
Subject: [PATCH 1/2] #3401 discard longhorn devices
Signed-off-by: gdha <gratien.dhaese@gmail.com>
---
.../save/GNU/Linux/230_filesystem_layout.sh | 59 ++++++++++---------
1 file changed, 30 insertions(+), 29 deletions(-)
diff --git a/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh b/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
index 15e104403..6ac35c8db 100644
--- a/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
+++ b/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
@@ -117,37 +117,38 @@ fi
Log "Filesystem $fstype on $device mounted at $mountpoint is below Docker Root Dir $docker_root_dir, skipping."
continue
fi
- # In case Longhorn is rebuilding a replica device it will show up as a pseudo-device and when that is the
- # case then you would find traces of it in the /var/lib/rear/layout/disklayout.conf file, which would
- # break the recovery as Longhorn Engine replica's are under control of Rancher Longhorn software and these are
- # rebuild automatically via kubernetes longhorn-engine pods.
- # Issue where we discovered this behavior was #2365
- # In normal situations you will find traces of longhorn in the log saying skipping non-block devices.
- # For example an output of the 'df' command:
- # /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792 82045336 4500292 77528660 6% /var/lib/kubelet/pods/7f47aa55-30e2-4e7b-8fec-ec9a1e761352/volumes/kubernetes.io~csi/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792/mount
- # lsscsi shows it as:
- # [34:0:0:0] storage IET Controller 0001 -
- # [34:0:0:1] disk IET VIRTUAL-DISK 0001 /dev/sdf
- # ls -l /dev/sdf /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792
- # brw-rw---- 1 root disk 8, 80 Apr 17 12:02 /dev/sdf
- # brw-rw---- 1 root root 8, 64 Apr 17 10:36 /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792
- # and parted says:
- # parted /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792 print
- # Model: IET VIRTUAL-DISK (scsi)
- # Disk /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792: 85.9GB
- # Sector size (logical/physical): 512B/512B
- # Partition Table: loop
- # Disk Flags:
- # Number Start End Size File system Flags
- # 1 0.00B 85.9GB 85.9GB ext4
- # => as result (without the next if clausule) we would end up with an entry in the disklayout.conf file:
- # fs /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792 /var/lib/kubelet/pods/61ed399a-d51b-40b8-8fe8-a78e84a1dd0b/volumes/kubernetes.io~csi/pvc-c65df331-f1c5-466a-9731-b2aa5e6da714/mount ext4 uuid=4fafdd40-a9ae-4b62-8bfb-f29036dbe3b9 label= blocksize=4096 reserved_blocks=0% max_mounts=-1 check_interval=0d bytes_per_inode=16384 default_mount_options=user_xattr,acl options=rw,relatime,data=ordered
- if echo "$device" | grep -q "^/dev/longhorn/pvc-" ; then
- Log "Longhorn Engine replica $device, skipping."
- continue
- fi
fi
fi
+ # In case Longhorn is rebuilding a replica device it will show up as a pseudo-device and when that is the
+ # case then you would find traces of it in the /var/lib/rear/layout/disklayout.conf file, which would
+ # break the recovery as Longhorn Engine replica's are under control of Rancher Longhorn software and these are
+ # rebuild automatically via kubernetes longhorn-engine pods.
+ # Issue where we discovered this behavior was #2365
+ # In normal situations you will find traces of longhorn in the log saying skipping non-block devices.
+ # For example an output of the 'df' command:
+ # /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792 82045336 4500292 77528660 6% /var/lib/kubelet/pods/7f47aa55-30e2-4e7b-8fec-ec9a1e761352/volumes/kubernetes.io~csi/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792/mount
+ # lsscsi shows it as:
+ # [34:0:0:0] storage IET Controller 0001 -
+ # [34:0:0:1] disk IET VIRTUAL-DISK 0001 /dev/sdf
+ # ls -l /dev/sdf /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792
+ # brw-rw---- 1 root disk 8, 80 Apr 17 12:02 /dev/sdf
+ # brw-rw---- 1 root root 8, 64 Apr 17 10:36 /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792
+ # and parted says:
+ # parted /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792 print
+ # Model: IET VIRTUAL-DISK (scsi)
+ # Disk /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792: 85.9GB
+ # Sector size (logical/physical): 512B/512B
+ # Partition Table: loop
+ # Disk Flags:
+ # Number Start End Size File system Flags
+ # 1 0.00B 85.9GB 85.9GB ext4
+ # => as result (without the next if clausule) we would end up with an entry in the disklayout.conf file:
+ # fs /dev/longhorn/pvc-ed09c0f2-c086-41c8-a38a-76ee8c289792 /var/lib/kubelet/pods/61ed399a-d51b-40b8-8fe8-a78e84a1dd0b/volumes/kubernetes.io~csi/pvc-c65df331-f1c5-466a-9731-b2aa5e6da714/mount ext4 uuid=4fafdd40-a9ae-4b62-8bfb-f29036dbe3b9 label= blocksize=4096 reserved_blocks=0% max_mounts=-1 check_interval=0d bytes_per_inode=16384 default_mount_options=user_xattr,acl options=rw,relatime,data=ordered
+ if echo "$device" | grep -q "^/dev/longhorn/pvc-" ; then
+ Log "Longhorn Engine replica $device, skipping."
+ continue
+ fi
+
# Replace a symbolic link /dev/disk/by-uuid/a1b2c3 -> ../../sdXn
# by the fully canonicalized target of the link e.g. /dev/sdXn
if [[ $device == /dev/disk/by-uuid* ]]; then
From 7805e8e440c9a2a2e7a890e8e70e5c7c285aee08 Mon Sep 17 00:00:00 2001
From: gdha <gratien.dhaese@gmail.com>
Date: Fri, 14 Feb 2025 08:22:26 +0100
Subject: [PATCH 2/2] replacing tab with spaces in comment
Signed-off-by: gdha <gratien.dhaese@gmail.com>
---
usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh b/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
index 6ac35c8db..b3dd4bbc0 100644
--- a/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
+++ b/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
@@ -119,7 +119,7 @@ fi
fi
fi
fi
- # In case Longhorn is rebuilding a replica device it will show up as a pseudo-device and when that is the
+ # In case Longhorn is rebuilding a replica device it will show up as a pseudo-device and when that is the
# case then you would find traces of it in the /var/lib/rear/layout/disklayout.conf file, which would
# break the recovery as Longhorn Engine replica's are under control of Rancher Longhorn software and these are
# rebuild automatically via kubernetes longhorn-engine pods.

View File

@ -1,682 +0,0 @@
diff --git a/packaging/rpm/rear.spec b/packaging/rpm/rear.spec
index afb31e1e4..910c9f89a 100644
--- a/packaging/rpm/rear.spec
+++ b/packaging/rpm/rear.spec
@@ -29,8 +29,8 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
# Of course the rear bash scripts can be installed on any architecture just as any binaries can be installed on any architecture.
# But the meaning of architecture dependent packages should be on what architectures they will work.
# Therefore only those architectures that are actually supported are explicitly listed.
-# This avoids that rear can be "just installed" on architectures that are actually not supported (e.g. ARM or IBM z Systems):
-ExclusiveArch: %ix86 x86_64 ppc ppc64 ppc64le ia64
+# This avoids that rear can be "just installed" on architectures that are actually not supported:
+ExclusiveArch: %ix86 x86_64 ppc ppc64 ppc64le ia64 s390x %arm aarch64
# Furthermore for some architectures it requires architecture dependent packages (like syslinux for x86 and x86_64)
# so that rear must be architecture dependent because ifarch conditions never match in case of "BuildArch: noarch"
# see the GitHub issue https://github.com/rear/rear/issues/629
diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf
index 826f1ee59..17bf1a110 100644
--- a/usr/share/rear/conf/default.conf
+++ b/usr/share/rear/conf/default.conf
@@ -784,9 +784,9 @@ ISO_RECOVER_MODE=""
##
#
# OUTPUT=USB is only supported on PC-compatible (Linux-i386/x86/x86_64) architecture
-# see https://github.com/rear/rear/issues/2348
+# see https://github.com/rear/rear/issues/2348 and arm/aarch64 using EFI.
# Accordingly in case of false usage of OUTPUT=USB on non-PC-compatible architectures
-# (i.e. the POWER architectures ppc64/ppc64le, IBM Z s390/s390x, and ARM)
+# (i.e. the POWER architectures ppc64/ppc64le, IBM Z s390/s390x)
# "rear mkrescue/mkbackup" errors out because on those architectures the USB medium cannot be booted
# because for non-PC-compatible architectures there are no scripts that install a USB bootloader.
# On non-PC-compatible architectures a possible alternative could be OUTPUT=RAMDISK (see above)
diff --git a/usr/share/rear/finalize/Linux-arm/610_EFISTUB_run_efibootmgr.sh b/usr/share/rear/finalize/Linux-arm/610_EFISTUB_run_efibootmgr.sh
new file mode 120000
index 000000000..92f571a6b
--- /dev/null
+++ b/usr/share/rear/finalize/Linux-arm/610_EFISTUB_run_efibootmgr.sh
@@ -0,0 +1 @@
+../Linux-i386/610_EFISTUB_run_efibootmgr.sh
\ No newline at end of file
diff --git a/usr/share/rear/finalize/Linux-arm/670_run_efibootmgr.sh b/usr/share/rear/finalize/Linux-arm/670_run_efibootmgr.sh
new file mode 120000
index 000000000..5b967460e
--- /dev/null
+++ b/usr/share/rear/finalize/Linux-arm/670_run_efibootmgr.sh
@@ -0,0 +1 @@
+../Linux-i386/670_run_efibootmgr.sh
\ No newline at end of file
diff --git a/usr/share/rear/layout/save/default/445_guess_bootloader.sh b/usr/share/rear/layout/save/default/445_guess_bootloader.sh
index 3576c387c..0211a4d6c 100644
--- a/usr/share/rear/layout/save/default/445_guess_bootloader.sh
+++ b/usr/share/rear/layout/save/default/445_guess_bootloader.sh
@@ -30,15 +30,6 @@ if test -f /etc/sysconfig/bootloader ; then
fi
fi
-# On ARM, guess the dummy bootloader:
-if [ "$ARCH" = "Linux-arm" ] ; then
- BOOTLOADER=ARM
- # Inform the user that we do nothing:
- LogPrint "Using guessed bootloader 'ARM'. Skipping bootloader backup, see default.conf"
- echo "$BOOTLOADER" >$bootloader_file
- return
-fi
-
# Check if any disk contains a PPC PReP boot partition.
# Detection taken from usr/share/rear/finalize/Linux-ppc64/680_install_PPC_bootlist.sh
disk_device="$( awk -F ' ' '/^part / {if ($6 ~ /prep/) {print $2}}' $LAYOUT_FILE )"
@@ -127,6 +118,15 @@ if is_true $USING_UEFI_BOOTLOADER ; then
return 0
fi
+# On ARM, guess the dummy bootloader:
+if [ "$ARCH" = "Linux-arm" ] ; then
+ BOOTLOADER=ARM
+ # Inform the user that we do nothing:
+ LogPrint "Using guessed bootloader 'ARM'. Skipping bootloader backup, see default.conf about 'BOOTLOADER'"
+ echo "$BOOTLOADER" >$bootloader_file
+ return
+fi
+
# Error out when no bootloader was specified or could be autodetected:
Error "Cannot autodetect what is used as bootloader, see default.conf about 'BOOTLOADER'"
diff --git a/usr/share/rear/lib/uefi-functions.sh b/usr/share/rear/lib/uefi-functions.sh
index 47f3c4fc3..bb79035e5 100644
--- a/usr/share/rear/lib/uefi-functions.sh
+++ b/usr/share/rear/lib/uefi-functions.sh
@@ -36,7 +36,7 @@ function trim {
echo -n "$var"
}
-function build_bootx86_efi {
+function build_boot_efi {
local outfile="$1"
local embedded_config=""
local gmkstandalone=""
@@ -62,9 +62,10 @@ function build_bootx86_efi {
# At least SUSE systems use 'grub2' prefixed names for GRUB2 programs:
gmkstandalone=grub2-mkstandalone
else
- # This build_bootx86_efi function is only called in output/ISO/Linux-i386/250_populate_efibootimg.sh
- # which runs only if UEFI is used so that we simply error out here if we cannot make a bootable EFI image of GRUB2
- # (normally a function should not exit out but return to its caller with a non-zero return code):
+ # This build_boot_efi function is only called in 250_populate_efibootimg.sh
+ # and 100_create_efiboot.sh and 940_grub2_rescue.sh
+ # only if UEFI is used so that we simply error out here if we cannot make a bootable EFI image of GRUB2
+ # (normally a function should not exit but return to its caller with a non-zero return code):
Error "Cannot make bootable EFI image of GRUB2 (neither grub-mkstandalone nor grub2-mkstandalone found)"
fi
@@ -80,9 +81,9 @@ function build_bootx86_efi {
LogPrint "Neither grub-probe nor grub2-probe found"
# Since openSUSE Leap 15.1 things were moved from /usr/lib/grub2/ to /usr/share/grub2/
# cf. https://github.com/rear/rear/issues/2338#issuecomment-594432946
- if test /usr/*/grub*/x86_64-efi/partmap.lst ; then
+ if test /usr/*/grub*/"$GRUB2_IMAGE_FORMAT"/partmap.lst ; then
LogPrint "including all partition modules"
- modules=( $( cat /usr/*/grub*/x86_64-efi/partmap.lst ) )
+ modules=( $( cat /usr/*/grub*/"$GRUB2_IMAGE_FORMAT"/partmap.lst ) )
else
Error "Can not determine partition modules, ${dirs[*]} would be likely inaccessible in GRUB2"
fi
@@ -98,25 +99,25 @@ function build_bootx86_efi {
fi
fi
- # grub-mkstandalone needs a .../grub*/x86_64-efi/moddep.lst file (cf. https://github.com/rear/rear/issues/1193)
+ # grub-mkstandalone needs a .../grub*/$GRUB2_IMAGE_FORMAT/moddep.lst file (cf. https://github.com/rear/rear/issues/1193)
# At least on SUSE systems that is in different 'grub2' directories (cf. https://github.com/rear/rear/issues/2338)
# e.g. on openSUSE Leap 15.0 it is in /usr/lib/grub2/x86_64-efi/moddep.lst
# but on openSUSE Leap 15.1 that was moved to /usr/share/grub2/x86_64-efi/moddep.lst
# and the one in /boot/grub2/x86_64-efi/moddep.lst is a copy of the one in /usr/*/grub2/x86_64-efi/moddep.lst
# so we do not error out if we do not find a /x86_64-efi/moddep.lst file because it could be "anywhere else" in the future
# but we inform the user here in advance about possible problems when there is no /x86_64-efi/moddep.lst file.
- # Careful: usr/sbin/rear sets nullglob so that /usr/*/grub*/x86_64-efi/moddep.lst gets empty if nothing matches
- # and 'test -f' succeeds with empty argument so that we cannot use 'test -f /usr/*/grub*/x86_64-efi/moddep.lst'
+ # Careful: usr/sbin/rear sets nullglob so that /usr/*/grub*/$GRUB2_IMAGE_FORMAT/moddep.lst gets empty if nothing matches
+ # and 'test -f' succeeds with empty argument so that we cannot use 'test -f /usr/*/grub*/$GRUB2_IMAGE_FORMAT/moddep.lst'
# also 'test -n' succeeds with empty argument but (fortunately/intentionally?) plain 'test' fails with empty argument.
- # Another implicit condition that this 'test' works is that '/usr/*/grub*/x86_64-efi/moddep.lst' matches at most one file
- # because otherwise e.g. "test /usr/*/grub*/x86_64-efi/mod*" where two files moddep.lst and modinfo.sh match
+ # Another implicit condition that this 'test' works is that '/usr/*/grub*/$GRUB2_IMAGE_FORMAT/moddep.lst' matches at most one file
+ # because otherwise e.g. "test /usr/*/grub*/$GRUB2_IMAGE_FORMAT/mod*" where two files moddep.lst and modinfo.sh match
# would falsely fail with "bash: test: ... unary operator expected":
- test /usr/*/grub*/x86_64-efi/moddep.lst || LogPrintError "$gmkstandalone may fail to make a bootable EFI image of GRUB2 (no /usr/*/grub*/x86_64-efi/moddep.lst file)"
+ test /usr/*/grub*/"$GRUB2_IMAGE_FORMAT"/moddep.lst || LogPrintError "$gmkstandalone may fail to make a bootable EFI image of GRUB2 (no /usr/*/grub*/$GRUB2_IMAGE_FORMAT/moddep.lst file)"
(( ${#GRUB2_MODULES_UEFI[@]} )) && LogPrint "Installing only ${GRUB2_MODULES_UEFI[*]} modules into $outfile memdisk"
(( ${#modules[@]} )) && LogPrint "GRUB2 modules to load: ${modules[*]}"
- if ! $gmkstandalone $v ${GRUB2_MODULES_UEFI:+"--install-modules=${GRUB2_MODULES_UEFI[*]}"} ${modules:+"--modules=${modules[*]}"} -O x86_64-efi -o $outfile $embedded_config ; then
+ if ! $gmkstandalone $v ${GRUB2_MODULES_UEFI:+"--install-modules=${GRUB2_MODULES_UEFI[*]}"} ${modules:+"--modules=${modules[*]}"} -O "$GRUB2_IMAGE_FORMAT" -o $outfile $embedded_config ; then
Error "Failed to make bootable EFI image of GRUB2 (error during $gmkstandalone of $outfile)"
fi
}
diff --git a/usr/share/rear/output/ISO/Linux-arm/250_populate_efibootimg.sh b/usr/share/rear/output/ISO/Linux-arm/250_populate_efibootimg.sh
new file mode 120000
index 000000000..847e8f465
--- /dev/null
+++ b/usr/share/rear/output/ISO/Linux-arm/250_populate_efibootimg.sh
@@ -0,0 +1 @@
+../Linux-i386/250_populate_efibootimg.sh
\ No newline at end of file
diff --git a/usr/share/rear/output/ISO/Linux-arm/260_EFISTUB_populate.sh b/usr/share/rear/output/ISO/Linux-arm/260_EFISTUB_populate.sh
new file mode 120000
index 000000000..93113f663
--- /dev/null
+++ b/usr/share/rear/output/ISO/Linux-arm/260_EFISTUB_populate.sh
@@ -0,0 +1 @@
+../Linux-i386/260_EFISTUB_populate.sh
\ No newline at end of file
diff --git a/usr/share/rear/output/ISO/Linux-arm/700_create_efibootimg.sh b/usr/share/rear/output/ISO/Linux-arm/700_create_efibootimg.sh
new file mode 120000
index 000000000..8aa6a84a3
--- /dev/null
+++ b/usr/share/rear/output/ISO/Linux-arm/700_create_efibootimg.sh
@@ -0,0 +1 @@
+../Linux-i386/700_create_efibootimg.sh
\ No newline at end of file
diff --git a/usr/share/rear/output/ISO/Linux-arm/800_create_isofs.sh b/usr/share/rear/output/ISO/Linux-arm/800_create_isofs.sh
new file mode 100644
index 000000000..0108dac05
--- /dev/null
+++ b/usr/share/rear/output/ISO/Linux-arm/800_create_isofs.sh
@@ -0,0 +1,36 @@
+# 800_create_isofs.sh
+#
+# create initramfs for Relax-and-Recover
+#
+# This file is part of Relax-and-Recover, licensed under the GNU General
+# Public License. Refer to the included COPYING for full text of license.
+
+# Based on output/ISO/Linux-i386/800_create_isofs.sh with the creation of the
+# $TMP_DIR/isofs/isolinux directory added. This allows us to share scripts
+# used on x86_64 EFI machines.
+
+# check that we have mkisofs
+test -x "$ISO_MKISOFS_BIN" || Error "No executable ISO_MKISOFS_BIN '$ISO_MKISOFS_BIN'"
+
+# create some sub-dirs under $TMP_DIR for booting
+# The isolinux directory is used so that the x86_64 EFI scripts can be symlinked directly.
+[[ ! -d $TMP_DIR/isofs/isolinux ]] && mkdir $v -m 755 $TMP_DIR/isofs/isolinux >&2
+
+# kernel and initrd are already included in virtual image of ISO if ebiso is used
+if [[ $(basename $ISO_MKISOFS_BIN) = "ebiso" && $(basename ${UEFI_BOOTLOADER}) = "elilo.efi" ]]; then
+ Log "ebiso is used where kernel and initrd are already included in virtual image of ISO, skipping copying kernel and initrd"
+else
+ Log "Copying kernel and initrd"
+ cp -pL $v $KERNEL_FILE $TMP_DIR/isofs/isolinux/kernel || Error "Failed to copy KERNEL_FILE '$KERNEL_FILE'"
+ cp $v $TMP_DIR/$REAR_INITRD_FILENAME $TMP_DIR/isofs/isolinux/$REAR_INITRD_FILENAME || Error "Failed to copy initrd '$REAR_INITRD_FILENAME'"
+fi
+
+#ISO_FILES+=( $TMP_DIR/kernel $TMP_DIR/$REAR_INITRD_FILENAME )
+# in case the user populates this array manually we must not forget to copy
+# these files to our temporary isofs
+if test "${#ISO_FILES[@]}" -gt 0 ; then
+ cp -pL $v "${ISO_FILES[@]}" $TMP_DIR/isofs/isolinux/ || Error "Failed to copy ISO_FILES ${ISO_FILES[*]}"
+fi
+
+mkdir -p $v "$ISO_DIR" || Error "Failed to create ISO_DIR '$ISO_DIR'"
+
diff --git a/usr/share/rear/output/ISO/Linux-arm/810_prepare_multiple_iso.sh b/usr/share/rear/output/ISO/Linux-arm/810_prepare_multiple_iso.sh
new file mode 120000
index 000000000..04f8a4955
--- /dev/null
+++ b/usr/share/rear/output/ISO/Linux-arm/810_prepare_multiple_iso.sh
@@ -0,0 +1 @@
+../Linux-i386/810_prepare_multiple_iso.sh
\ No newline at end of file
diff --git a/usr/share/rear/output/ISO/Linux-arm/820_create_iso_image.sh b/usr/share/rear/output/ISO/Linux-arm/820_create_iso_image.sh
new file mode 100644
index 000000000..37842e018
--- /dev/null
+++ b/usr/share/rear/output/ISO/Linux-arm/820_create_iso_image.sh
@@ -0,0 +1,40 @@
+# Based on output/ISO/Linux-i386/820_create_iso_image.sh with the support
+# for non-EFI machines removed.
+
+is_true $EFI_STUB && return 0
+
+Log "Starting '$ISO_MKISOFS_BIN'"
+LogPrint "Making ISO image"
+
+is_true $USING_UEFI_BOOTLOADER || Error "OUTPUT=ISO on Linux-arm works only with UEFI"
+if [ -f /etc/slackware-version ] ; then
+ # slackware mkisofs uses different command line options
+ EFIBOOT="-eltorito-alt-boot -no-emul-boot -eltorito-platform efi -eltorito-boot boot/efiboot.img"
+else
+ EFIBOOT="-eltorito-alt-boot -e boot/efiboot.img -no-emul-boot"
+fi
+
+pushd $TMP_DIR/isofs >/dev/null
+
+# Error out when files greater or equal ISO_FILE_SIZE_LIMIT should be included in the ISO (cf. default.conf).
+# Consider all regular files and follow symbolic links to also get regular files where symlinks point to:
+assert_ISO_FILE_SIZE_LIMIT $( find -L . -type f )
+
+# ebiso uses different command line options and parameters:
+if test "ebiso" = $( basename $ISO_MKISOFS_BIN ) ; then
+ $ISO_MKISOFS_BIN $ISO_MKISOFS_OPTS -R -o $ISO_DIR/$ISO_PREFIX.iso -e boot/efiboot.img .
+else
+ $ISO_MKISOFS_BIN $v $ISO_MKISOFS_OPTS -o "$ISO_DIR/$ISO_PREFIX.iso" -no-emul-boot \
+ -R -J -volid "$ISO_VOLID" $EFIBOOT -v -iso-level 3 . >/dev/null
+ ##-R -J -volid "$ISO_VOLID" $EFIBOOT "${ISO_FILES[@]}" >/dev/null
+fi
+StopIfError "Could not create ISO image (with $ISO_MKISOFS_BIN)"
+popd >/dev/null
+
+iso_image_size=( $(du -h "$ISO_DIR/$ISO_PREFIX.iso") )
+LogPrint "Wrote ISO image: $ISO_DIR/$ISO_PREFIX.iso ($iso_image_size)"
+
+# Add ISO image to result files
+RESULT_FILES+=( "$ISO_DIR/$ISO_PREFIX.iso" )
+
+# vim: set et ts=4 sw=4:
diff --git a/usr/share/rear/output/ISO/Linux-arm/830_create_iso_image_EFISTUB.sh b/usr/share/rear/output/ISO/Linux-arm/830_create_iso_image_EFISTUB.sh
new file mode 100644
index 000000000..83c2d1eeb
--- /dev/null
+++ b/usr/share/rear/output/ISO/Linux-arm/830_create_iso_image_EFISTUB.sh
@@ -0,0 +1,25 @@
+# Based on output/ISO/Linux-i386/830_create_iso_image_EFISTUB.sh with the
+# support for non-EFI machines removed.
+
+is_true $EFI_STUB || return 0
+
+Log "EFI_STUB: Starting '$ISO_MKISOFS_BIN'"
+LogPrint "EFI_STUB: Making ISO image"
+
+pushd $TMP_DIR/isofs >/dev/null
+
+# Error out when files greater or equal ISO_FILE_SIZE_LIMIT should be included in the ISO (cf. default.conf).
+# Consider all regular files and follow symbolic links to also get regular files where symlinks point to:
+assert_ISO_FILE_SIZE_LIMIT $( find -L . -type f )
+
+$ISO_MKISOFS_BIN $v $ISO_MKISOFS_OPTS -o "$ISO_DIR/$ISO_PREFIX.iso" -no-emul-boot \
+ -R -J -volid "$ISO_VOLID" -v -iso-level 3 . >/dev/null
+
+StopIfError "EFI_STUB: Could not create ISO image (with $ISO_MKISOFS_BIN)"
+popd >/dev/null
+
+iso_image_size=( $(du -h "$ISO_DIR/$ISO_PREFIX.iso") )
+LogPrint "EFI_STUB: Wrote ISO image: $ISO_DIR/$ISO_PREFIX.iso ($iso_image_size)"
+
+# Add ISO image to result files
+RESULT_FILES+=( "$ISO_DIR/$ISO_PREFIX.iso" )
diff --git a/usr/share/rear/output/ISO/Linux-i386/250_populate_efibootimg.sh b/usr/share/rear/output/ISO/Linux-i386/250_populate_efibootimg.sh
index 74ed1df3a..141cfbeae 100644
--- a/usr/share/rear/output/ISO/Linux-i386/250_populate_efibootimg.sh
+++ b/usr/share/rear/output/ISO/Linux-i386/250_populate_efibootimg.sh
@@ -15,7 +15,7 @@ mkdir $v -p $efi_boot_tmp_dir/locale || Error "Could not create $efi_boot_tmp_di
# Copy the grub*.efi executable to EFI/BOOT/BOOTX64.efi
# Intentionally an empty UEFI_BOOTLOADER results an invalid "cp -v /tmp/.../mnt/EFI/BOOT/BOOTX64.efi" command that fails:
-cp $v "$UEFI_BOOTLOADER" $efi_boot_tmp_dir/BOOTX64.efi || Error "Could not find UEFI_BOOTLOADER '$UEFI_BOOTLOADER'"
+cp $v "$UEFI_BOOTLOADER" $efi_boot_tmp_dir/BOOT$EFI_ARCH_UPPER.efi || Error "Could not find UEFI_BOOTLOADER '$UEFI_BOOTLOADER'"
local uefi_bootloader_dirname="$( dirname $UEFI_BOOTLOADER )"
if test -f "$SECURE_BOOT_BOOTLOADER" ; then
# FIXME: Explain why it tests that a SECURE_BOOT_BOOTLOADER file exists
@@ -52,7 +52,7 @@ if test "ebiso" = "$( basename $ISO_MKISOFS_BIN )" ; then
fi
if [[ -n "$(type -p grub)" ]]; then
- cat > $efi_boot_tmp_dir/BOOTX64.conf << EOF
+ cat > $efi_boot_tmp_dir/BOOT$EFI_ARCH_UPPER.conf << EOF
default=0
timeout 5
splashimage=/EFI/BOOT/splash.xpm.gz
@@ -70,9 +70,9 @@ fi
# We are not able to create signed boot loader
# so we need to reuse existing one.
# See issue #1374
-# build_bootx86_efi () can be safely used for other scenarios.
+# build_boot_efi () can be safely used for other scenarios.
if ! test -f "$SECURE_BOOT_BOOTLOADER" ; then
- build_bootx86_efi $TMP_DIR/mnt/EFI/BOOT/BOOTX64.efi $efi_boot_tmp_dir/grub.cfg "$boot_dir" "$UEFI_BOOTLOADER"
+ build_boot_efi $TMP_DIR/mnt/EFI/BOOT/BOOT$EFI_ARCH_UPPER.efi $efi_boot_tmp_dir/grub.cfg "$boot_dir" "$UEFI_BOOTLOADER"
fi
# We will be using grub-efi or grub2 (with efi capabilities) to boot from ISO.
@@ -111,7 +111,7 @@ cp $v -r $TMP_DIR/mnt/EFI $TMP_DIR/isofs/ || Error "Could not create the isofs/E
# Make /boot/grub/grub.cfg available on isofs/
mkdir $v -p -m 755 $TMP_DIR/isofs/boot/grub
if test "$( type -p grub )" ; then
- cp $v $TMP_DIR/isofs/EFI/BOOT/BOOTX64.conf $TMP_DIR/isofs/boot/grub/ || Error "Could not copy EFI/BOOT/BOOTX64.conf to isofs/boot/grub"
+ cp $v $TMP_DIR/isofs/EFI/BOOT/BOOT$EFI_ARCH_UPPER.conf $TMP_DIR/isofs/boot/grub/ || Error "Could not copy EFI/BOOT/BOOT${EFI_ARCH_UPPER}.conf to isofs/boot/grub"
else
cp $v $TMP_DIR/isofs/EFI/BOOT/grub.cfg $TMP_DIR/isofs/boot/grub/ || Error "Could not copy EFI/BOOT/grub.cfg to isofs/boot/grub"
fi
diff --git a/usr/share/rear/output/ISO/Linux-i386/260_EFISTUB_populate.sh b/usr/share/rear/output/ISO/Linux-i386/260_EFISTUB_populate.sh
index a91264494..3c2380d8b 100644
--- a/usr/share/rear/output/ISO/Linux-i386/260_EFISTUB_populate.sh
+++ b/usr/share/rear/output/ISO/Linux-i386/260_EFISTUB_populate.sh
@@ -33,7 +33,7 @@ else
Error "EFI_STUB: EFI executable $OUTPUT_EFISTUB_SYSTEMD_BOOTLOADER not found"
fi
-cp $v "$OUTPUT_EFISTUB_SYSTEMD_BOOTLOADER" $efi_boot_tmp_dir/BOOTX64.efi
+cp $v "$OUTPUT_EFISTUB_SYSTEMD_BOOTLOADER" $efi_boot_tmp_dir/BOOT${EFI_ARCH_UPPER}.efi
# Create boot menu entries for systemd-bootx64.efi.
diff --git a/usr/share/rear/output/RAWDISK/Linux-i386/260_create_syslinux_efi_bootloader.sh b/usr/share/rear/output/RAWDISK/Linux-i386/260_create_syslinux_efi_bootloader.sh
index cca8caf6b..155f433c9 100644
--- a/usr/share/rear/output/RAWDISK/Linux-i386/260_create_syslinux_efi_bootloader.sh
+++ b/usr/share/rear/output/RAWDISK/Linux-i386/260_create_syslinux_efi_bootloader.sh
@@ -33,7 +33,7 @@ local efi_boot_directory="$RAWDISK_BOOT_EFI_STAGING_ROOT/BOOT"
mkdir $v -p "$efi_boot_directory" || Error "Could not create $efi_boot_directory"
-cp $v "$syslinux_efi" "$efi_boot_directory/BOOTX64.EFI" >&2
+cp $v "$syslinux_efi" "$efi_boot_directory/BOOT${EFI_ARCH_UPPER}.EFI" >&2
cp $v "$ldlinux_e64" "$efi_boot_directory" >&2
diff --git a/usr/share/rear/output/RAWDISK/Linux-i386/270_create_grub2_efi_bootloader.sh b/usr/share/rear/output/RAWDISK/Linux-i386/270_create_grub2_efi_bootloader.sh
index 8b543d8c8..0dbf17547 100644
--- a/usr/share/rear/output/RAWDISK/Linux-i386/270_create_grub2_efi_bootloader.sh
+++ b/usr/share/rear/output/RAWDISK/Linux-i386/270_create_grub2_efi_bootloader.sh
@@ -21,7 +21,7 @@ fi
# cf. https://github.com/rear/rear/issues/2338#issuecomment-594432946
local efi_modules_directory
local dir
-for dir in /usr/lib/grub/x86_64-efi /usr/lib/grub2/x86_64-efi /usr/share/grub2/x86_64-efi; do
+for dir in "/usr/lib/grub/$GRUB2_IMAGE_FORMAT" "/usr/lib/grub2/$GRUB2_IMAGE_FORMAT" "/usr/share/grub2/$GRUB2_IMAGE_FORMAT"; do
if [[ -d "$dir" ]]; then
efi_modules_directory="$dir"
break
@@ -71,10 +71,10 @@ if [[ -n "$SECURE_BOOT_BOOTLOADER" ]]; then
# If /boot/$grub2_name exists, it contains additional Grub modules, which are not compiled into the grub core image.
# Pick required ones from there, too.
local additional_grub_directory="/boot/$grub2_name"
- local grub_modules_directory="x86_64-efi"
+ local grub_modules_directory="$GRUB2_IMAGE_FORMAT"
local additional_grub_modules=( all_video.mod )
if [[ -d "$additional_grub_directory/$grub_modules_directory" ]]; then
- local grub_target_directory="$(dirname "$(find "$RAWDISK_BOOT_EFI_STAGING_ROOT" -iname grubx64.efi -print)")"
+ local grub_target_directory="$(dirname "$(find "$RAWDISK_BOOT_EFI_STAGING_ROOT" -iname grub${EFI_ARCH}.efi -print)")"
[[ "$grub_target_directory" == "." ]] && Error "Could not find Grub executable" # dirname "" returns "."
mkdir "$grub_target_directory/$grub_modules_directory" || Error "Could not create Grub modules directory"
@@ -102,9 +102,9 @@ else
# Create a Grub 2 EFI core image and install it as boot loader. (NOTE: This version will not be signed.)
# Use the UEFI default boot loader name, so that firmware will find it without an existing boot entry.
- local boot_loader="$efi_boot_directory/BOOTX64.EFI"
+ local boot_loader="$efi_boot_directory/BOOT${EFI_ARCH_UPPER}.EFI"
local grub_modules=( part_gpt fat normal configfile linux video all_video )
[[ -f "$efi_modules_directory/linuxefi.mod" ]] && grub_modules+=("$efi_modules_directory/linuxefi.mod")
- $grub2_name-mkimage -O x86_64-efi -o "$boot_loader" -p "/EFI/BOOT" "${grub_modules[@]}"
+ $grub2_name-mkimage -O "$GRUB2_IMAGE_FORMAT" -o "$boot_loader" -p "/EFI/BOOT" "${grub_modules[@]}"
StopIfError "Error occurred during $grub2_name-mkimage of $boot_loader"
fi
diff --git a/usr/share/rear/output/USB/Linux-arm/100_create_efiboot.sh b/usr/share/rear/output/USB/Linux-arm/100_create_efiboot.sh
new file mode 120000
index 000000000..3846131fb
--- /dev/null
+++ b/usr/share/rear/output/USB/Linux-arm/100_create_efiboot.sh
@@ -0,0 +1 @@
+../Linux-i386/100_create_efiboot.sh
\ No newline at end of file
diff --git a/usr/share/rear/output/USB/Linux-i386/100_create_efiboot.sh b/usr/share/rear/output/USB/Linux-i386/100_create_efiboot.sh
index fd631c444..cfcd001d7 100644
--- a/usr/share/rear/output/USB/Linux-i386/100_create_efiboot.sh
+++ b/usr/share/rear/output/USB/Linux-i386/100_create_efiboot.sh
@@ -51,8 +51,8 @@ if test -f "$SECURE_BOOT_BOOTLOADER" ; then
# (cf. rescue/default/850_save_sysfs_uefi_vars.sh)
# then Shim (usually shim.efi) must be copied as EFI/BOOT/BOOTX64.efi
# and Shim's second stage bootloader must be also copied where Shim already is.
- DebugPrint "Using '$SECURE_BOOT_BOOTLOADER' as first stage Secure Boot bootloader BOOTX64.efi"
- cp -L $v "$SECURE_BOOT_BOOTLOADER" "$EFI_DST/BOOTX64.efi" || Error "Failed to copy SECURE_BOOT_BOOTLOADER '$SECURE_BOOT_BOOTLOADER' to $EFI_DST/BOOTX64.efi"
+ DebugPrint "Using '$SECURE_BOOT_BOOTLOADER' as first stage Secure Boot bootloader BOOT${EFI_ARCH_UPPER}.efi"
+ cp -L $v "$SECURE_BOOT_BOOTLOADER" "$EFI_DST/BOOT${EFI_ARCH_UPPER}.efi" || Error "Failed to copy SECURE_BOOT_BOOTLOADER '$SECURE_BOOT_BOOTLOADER' to $EFI_DST/BOOT${EFI_ARCH_UPPER}.efi"
# When Shim is used, its second stage bootloader can be actually anything
# named grub*.efi (second stage bootloader is Shim compile time option), see
# http://www.rodsbooks.com/efi-bootloaders/secureboot.html#initial_shim
@@ -65,9 +65,8 @@ if test -f "$SECURE_BOOT_BOOTLOADER" ; then
DebugPrint "Using second stage Secure Boot bootloader files: $second_stage_UEFI_bootloader_files"
cp -L $v $second_stage_UEFI_bootloader_files $EFI_DST/ || Error "Failed to copy second stage Secure Boot bootloader files"
else
- cp -L $v "$UEFI_BOOTLOADER" "$EFI_DST/BOOTX64.efi" || Error "Failed to copy UEFI_BOOTLOADER '$UEFI_BOOTLOADER' to $EFI_DST/BOOTX64.efi"
+ cp -L $v "$UEFI_BOOTLOADER" "$EFI_DST/BOOT${EFI_ARCH_UPPER}.efi" || Error "Failed to copy UEFI_BOOTLOADER '$UEFI_BOOTLOADER' to $EFI_DST/BOOT${EFI_ARCH_UPPER}.efi"
fi
-cp $v $UEFI_BOOTLOADER "$EFI_DST/BOOTX64.efi" || Error "Failed to copy UEFI_BOOTLOADER '$UEFI_BOOTLOADER' to $EFI_DST/BOOTX64.efi"
# Copy kernel
cp -pL $v "$KERNEL_FILE" "$EFI_DST/kernel" || Error "Failed to copy KERNEL_FILE '$KERNEL_FILE' to $EFI_DST/kernel"
@@ -109,7 +108,7 @@ else
Log "Configuring grub 0.97 for EFI boot"
# Create config for grub 0.97
- cat > ${EFI_DST}/BOOTX64.conf << EOF
+ cat > ${EFI_DST}/BOOT${EFI_ARCH_UPPER}.conf << EOF
default=0
timeout=5
@@ -117,7 +116,7 @@ title Relax-and-Recover (no Secure Boot)
kernel ${EFI_DIR}/kernel $KERNEL_CMDLINE
initrd ${EFI_DIR}/$REAR_INITRD_FILENAME
EOF
- ;;
+ ;;
2)
Log "Configuring grub 2.0 for EFI boot"
# We need to explicitly set $root variable to $EFI_LABEL
@@ -128,22 +127,22 @@ EOF
grub2_set_usb_root="search --no-floppy --set=root --label ${EFI_LABEL}"
# Create config for grub 2.0
- create_grub2_cfg ${EFI_DIR}/kernel ${EFI_DIR}/$REAR_INITRD_FILENAME > ${EFI_DST}/grub.cfg
+ create_grub2_cfg ${EFI_DIR}/kernel ${EFI_DIR}/$REAR_INITRD_FILENAME > ${EFI_DST}/grub.cfg
# Create bootloader, this overwrite BOOTX64.efi copied in previous step ...
- # Create BOOTX86.efi but only if we are NOT secure booting.
- # We are not able to create signed boot loader
- # so we need to reuse existing one.
- # See issue #1374
- # build_bootx86_efi () can be safely used for other scenarios.
- if ! test -f "$SECURE_BOOT_BOOTLOADER" ; then
- build_bootx86_efi ${EFI_DST}/BOOTX64.efi ${EFI_DST}/grub.cfg "/boot" "$UEFI_BOOTLOADER"
- fi
- ;;
+ # Create BOOTX86.efi but only if we are NOT secure booting.
+ # We are not able to create signed boot loader
+ # so we need to reuse existing one.
+ # See issue #1374
+ # build_boot_efi () can be safely used for other scenarios.
+ if ! test -f "$SECURE_BOOT_BOOTLOADER" ; then
+ build_boot_efi $EFI_DST/BOOT$EFI_ARCH_UPPER.efi $EFI_DST/grub.cfg "/boot" "$UEFI_BOOTLOADER"
+ fi
+ ;;
*)
BugError "Neither grub 0.97 nor 2.0"
- ;;
- esac
+ ;;
+ esac
else
BugIfError "Unknown EFI bootloader"
fi
diff --git a/usr/share/rear/output/USB/Linux-i386/300_create_extlinux.sh b/usr/share/rear/output/USB/Linux-i386/300_create_extlinux.sh
index 47c7dc80c..3bbb66e2b 100644
--- a/usr/share/rear/output/USB/Linux-i386/300_create_extlinux.sh
+++ b/usr/share/rear/output/USB/Linux-i386/300_create_extlinux.sh
@@ -95,12 +95,6 @@ case "$WORKFLOW" in
(*) BugError "Workflow $WORKFLOW should not run this script."
esac
-USB_REAR_DIR="$BUILD_DIR/outputfs/$USB_PREFIX"
-if [ ! -d "$USB_REAR_DIR" ]; then
- mkdir -p $v "$USB_REAR_DIR" >/dev/null
- StopIfError "Could not create USB ReaR dir [$USB_REAR_DIR] !"
-fi
-
# We generate a single syslinux.cfg for the current system
Log "Creating $USB_PREFIX/syslinux.cfg"
# FIXME: # type -a time
diff --git a/usr/share/rear/output/USB/default/200_make_usb_prefix_dir.sh b/usr/share/rear/output/USB/default/200_make_usb_prefix_dir.sh
new file mode 100644
index 000000000..3c8ff6e6c
--- /dev/null
+++ b/usr/share/rear/output/USB/default/200_make_usb_prefix_dir.sh
@@ -0,0 +1,8 @@
+# The $BUILD_DIR/outputfs/$USB_PREFIX directory is needed by subsequent scripts
+# like output/USB/default/830_copy_kernel_initrd.sh to store kernel and initrd
+# and for parts of the syslinux config in 'syslinux.cfg' if syslinux/extlinux is used
+
+USB_REAR_DIR="$BUILD_DIR/outputfs/$USB_PREFIX"
+if [ ! -d "$USB_REAR_DIR" ] ; then
+ mkdir -p $v "$USB_REAR_DIR" || Error "Failed to create USB ReaR dir '$usb_rear_dir'"
+fi
diff --git a/usr/share/rear/output/USB/Linux-i386/830_copy_kernel_initrd.sh b/usr/share/rear/output/USB/default/830_copy_kernel_initrd.sh
similarity index 100%
rename from usr/share/rear/output/USB/Linux-i386/830_copy_kernel_initrd.sh
rename to usr/share/rear/output/USB/default/830_copy_kernel_initrd.sh
diff --git a/usr/share/rear/output/default/940_grub2_rescue.sh b/usr/share/rear/output/default/940_grub2_rescue.sh
index 38e816389..af09ca381 100644
--- a/usr/share/rear/output/default/940_grub2_rescue.sh
+++ b/usr/share/rear/output/default/940_grub2_rescue.sh
@@ -173,7 +173,8 @@ if is_true $USING_UEFI_BOOTLOADER ; then
) > $grub_config_dir/rear.cfg
# Create rear.efi at UEFI default boot directory location.
- build_bootx86_efi $boot_dir/efi/EFI/BOOT/rear.efi $grub_config_dir/rear.cfg "$boot_dir" "$UEFI_BOOTLOADER"
+ # The build_boot_efi errors out if it cannot make a bootable EFI image of GRUB2:
+ build_boot_efi $boot_dir/efi/EFI/BOOT/rear.efi $grub_config_dir/rear.cfg "$boot_dir" "$UEFI_BOOTLOADER"
# If UEFI boot entry for "Relax-and-Recover" does not exist, create it.
# This will also add "Relax-and-Recover" to boot order because if UEFI entry is not listed in BootOrder,
diff --git a/usr/share/rear/prep/Linux-arm/060_check_config.sh b/usr/share/rear/prep/Linux-arm/060_check_config.sh
deleted file mode 100644
index ca0978a12..000000000
--- a/usr/share/rear/prep/Linux-arm/060_check_config.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-if [ "$OUTPUT" != "PXE" ] ; then
- Error "Currently only OUTPUT=PXE is supported on ARM"
-fi
diff --git a/usr/share/rear/prep/Linux-arm/330_set_efi_arch.sh b/usr/share/rear/prep/Linux-arm/330_set_efi_arch.sh
new file mode 100644
index 000000000..2dfd82d24
--- /dev/null
+++ b/usr/share/rear/prep/Linux-arm/330_set_efi_arch.sh
@@ -0,0 +1,21 @@
+
+# Set EFI architecture, used as suffix for various files in the ESP
+# See https://github.com/rhboot/shim/blob/main/Make.defaults
+
+# Set the variables even if USING_UEFI_BOOTLOADER empty or no explicit 'true' value
+# cf. prep/Linux-i386/330_set_efi_arch.sh
+
+case "$REAL_MACHINE" in
+ (arm64|aarch64)
+ EFI_ARCH=aa64
+ GRUB2_IMAGE_FORMAT=arm64-efi
+ ;;
+ (arm*)
+ EFI_ARCH=arm
+ GRUB2_IMAGE_FORMAT=arm-efi
+ ;;
+ (*)
+ BugError "Unknown architecture $REAL_MACHINE"
+esac
+
+EFI_ARCH_UPPER="${EFI_ARCH^^}"
diff --git a/usr/share/rear/prep/Linux-i386/330_set_efi_arch.sh b/usr/share/rear/prep/Linux-i386/330_set_efi_arch.sh
new file mode 100644
index 000000000..51a320767
--- /dev/null
+++ b/usr/share/rear/prep/Linux-i386/330_set_efi_arch.sh
@@ -0,0 +1,32 @@
+
+# Set EFI architecture, used as suffix for various files in the ESP
+# See https://github.com/rhboot/shim/blob/main/Make.defaults
+
+# Set the variables even if USING_UEFI_BOOTLOADER empty or no explicit 'true' value
+# which sets GRUB2_IMAGE_FORMAT (used as argument for 'grub-mkstandalone -O ...')
+# to a value for EFI systems ('x86_64-efi' or 'i386-efi') also on BIOS systems
+# but that does not matter for now because currently GRUB2_IMAGE_FORMAT
+# is only used in case of EFI in the scripts lib/uefi-functions.sh
+# and output/RAWDISK/Linux-i386/270_create_grub2_efi_bootloader.sh
+# see https://github.com/rear/rear/pull/3157
+# and https://github.com/rear/rear/issues/3191
+# and https://github.com/rear/rear/issues/3195
+
+case "$REAL_MACHINE" in
+ # cf. the seting of REAL_MACHINE ('uname -m') and MACHINE in default.conf
+ (i686|i586|i386)
+ # all these behave exactly like i386.
+ # ia32 is another name for i386, used by EFI
+ # (but ia64 is not x86_64 aka amd64, it is the architecture of Itanium)
+ EFI_ARCH=ia32
+ GRUB2_IMAGE_FORMAT=i386-efi
+ ;;
+ (x86_64)
+ EFI_ARCH=x64
+ GRUB2_IMAGE_FORMAT=x86_64-efi
+ ;;
+ (*)
+ BugError "Unknown architecture $REAL_MACHINE"
+esac
+
+EFI_ARCH_UPPER="${EFI_ARCH^^}"
diff --git a/usr/share/rear/prep/Linux-ia64/330_set_efi_arch.sh b/usr/share/rear/prep/Linux-ia64/330_set_efi_arch.sh
new file mode 100644
index 000000000..668a3262e
--- /dev/null
+++ b/usr/share/rear/prep/Linux-ia64/330_set_efi_arch.sh
@@ -0,0 +1,12 @@
+
+# Set EFI architecture, used as suffix for various files in the ESP
+# See https://github.com/rhboot/shim/blob/main/Make.defaults
+
+# Set the variables even if USING_UEFI_BOOTLOADER empty or no explicit 'true' value
+# cf. prep/Linux-i386/330_set_efi_arch.sh
+
+EFI_ARCH=ia64
+# argument for grub2-mkstandalone -O ...
+GRUB2_IMAGE_FORMAT=ia64-efi
+
+EFI_ARCH_UPPER="${EFI_ARCH^^}"
diff --git a/usr/share/rear/prep/USB/Linux-arm/350_safeguard_error_out.sh b/usr/share/rear/prep/USB/Linux-arm/350_safeguard_error_out.sh
deleted file mode 120000
index 49a162aeb..000000000
--- a/usr/share/rear/prep/USB/Linux-arm/350_safeguard_error_out.sh
+++ /dev/null
@@ -1 +0,0 @@
-../Linux-ppc64/350_safeguard_error_out.sh
\ No newline at end of file
diff --git a/usr/share/rear/prep/USB/Linux-ppc64/350_safeguard_error_out.sh b/usr/share/rear/prep/USB/Linux-ppc64/350_safeguard_error_out.sh
index 412014ea3..6b56a5dee 100644
--- a/usr/share/rear/prep/USB/Linux-ppc64/350_safeguard_error_out.sh
+++ b/usr/share/rear/prep/USB/Linux-ppc64/350_safeguard_error_out.sh
@@ -27,10 +27,6 @@
# OUTPUT=USB on IBM Z (s390/s390x) architecture:
# The symbolic link prep/USB/Linux-s390/350_safeguard_error_out.sh
# and its link target prep/USB/Linux-ppc64/350_safeguard_error_out.sh
-#
-# OUTPUT=USB on ARM architecture:
-# The symbolic link prep/USB/Linux-arm/350_safeguard_error_out.sh
-# and its link target prep/USB/Linux-ppc64/350_safeguard_error_out.sh
Error "OUTPUT=USB not supported on $ARCH (no support to install a bootloader)"
diff --git a/usr/share/rear/rescue/default/850_save_sysfs_uefi_vars.sh b/usr/share/rear/rescue/default/850_save_sysfs_uefi_vars.sh
index 678b9c598..8e4f902d3 100644
--- a/usr/share/rear/rescue/default/850_save_sysfs_uefi_vars.sh
+++ b/usr/share/rear/rescue/default/850_save_sysfs_uefi_vars.sh
@@ -55,11 +55,11 @@ for dummy in "once" ; do
UEFI_BOOTLOADER=$( find /boot/efi -name 'elilo.efi' | tail -1 )
test -f "$UEFI_BOOTLOADER" && continue
# In case we have a 64-bit systemd bootloader we might be lucky with next statement:
- UEFI_BOOTLOADER=$( find /boot/EFI -name 'BOOTX64.EFI' | tail -1 )
+ UEFI_BOOTLOADER=$( find /boot/EFI -name "BOOT${EFI_ARCH_UPPER}.EFI" | tail -1 )
test -f "$UEFI_BOOTLOADER" && continue
# Try more generic finds in whole /boot with case insensitive filename matching.
# On older systems where 'find' does not support '-iname' this does not make it really worse because there 'find' just fails.
- for find_name_pattern in 'grub*.efi' 'elilo.efi' 'BOOTX64.EFI' ; do
+ for find_name_pattern in 'grub*.efi' 'elilo.efi' "BOOT${EFI_ARCH_UPPER}.EFI" ; do
# No need to test if find_name_pattern is empty because 'find' does not find anything with empty '-iname':
UEFI_BOOTLOADER=$( find /boot -iname "$find_name_pattern" | tail -1 )
# Continue with the code after the outer 'for' loop:

View File

@ -1,63 +0,0 @@
diff --git a/usr/sbin/rear b/usr/sbin/rear
index d2cb6c070..ea66f0a98 100755
--- a/usr/sbin/rear
+++ b/usr/sbin/rear
@@ -376,6 +376,10 @@ fi
# and fd6 to get input from the user regardless where to STDIN is redirected:
source $SHARE_DIR/lib/_input-output-functions.sh
+# Used to determine whether TMPDIR has been changed in user config.
+# Save the current value to detect changes.
+saved_tmpdir="${TMPDIR-}"
+
# Keep old log file:
test -r "$RUNTIME_LOGFILE" && mv -f "$RUNTIME_LOGFILE" "$RUNTIME_LOGFILE".old 2>/dev/null
@@ -446,6 +450,14 @@ for config in site local rescue ; do
test "$( tr -d -c '\r' < $CONFIG_DIR/$config.conf )" && Error "Carriage return character in $CONFIG_DIR/$config.conf (perhaps DOS or Mac format)"
Source "$CONFIG_DIR/$config.conf" || true
fi
+ if [ "$config" == local ] ; then
+ # changing TMPDIR in rescue.conf is expected for now, see
+ # rescue/GNU/Linux/600_unset_TMPDIR_in_rescue_conf.sh,
+ # so perform the check after reading local.conf but before rescue.conf
+ if [ "$saved_tmpdir" != "${TMPDIR-}" ] ; then
+ LogPrintError "Warning: Setting TMPDIR in a configuration file is deprecated. To specify a working area directory prefix, export TMPDIR before executing '$PROGRAM'"
+ fi
+ fi
done
# Finally source additional configuration files if specified on the command line:
if test "$CONFIG_APPEND_FILES" ; then
diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf
index d5fe6dcc4..4e67e38c9 100644
--- a/usr/share/rear/conf/default.conf
+++ b/usr/share/rear/conf/default.conf
@@ -50,12 +50,9 @@
# which usually results /tmp/rear.XXXXXXXXXXXXXXX or $TMPDIR/rear.XXXXXXXXXXXXXXX
# the latter when the canonical Linux/Unix environment variable TMPDIR
# is set in the environment where /usr/sbin/rear is called.
-# To have a specific working area directory prefix for Relax-and-Recover
-# specify in /etc/rear/local.conf something like
-#
+# To have a specific working area directory prefix for Relax-and-Recover call
# export TMPDIR="/prefix/for/rear/working/directory"
-#
-# where /prefix/for/rear/working/directory must already exist.
+# before calling 'rear' (/prefix/for/rear/working/directory must already exist).
# This is useful for example when there is not sufficient free space
# in /var/tmp or $TMPDIR for the ISO image or even the backup archive.
# TMPDIR cannot be set to a default value here unconditionally but only
diff --git a/usr/share/rear/rescue/GNU/Linux/600_unset_TMPDIR_in_rescue_conf.sh b/usr/share/rear/rescue/GNU/Linux/600_unset_TMPDIR_in_rescue_conf.sh
new file mode 100644
index 000000000..84d0cabb2
--- /dev/null
+++ b/usr/share/rear/rescue/GNU/Linux/600_unset_TMPDIR_in_rescue_conf.sh
@@ -0,0 +1,8 @@
+cat - <<EOF >> "$ROOTFS_DIR/etc/rear/rescue.conf"
+# TMPDIR variable may be defined in local.conf file as prefix dir for mktemp command
+# e.g. by defining TMPDIR=/var we would get our BUILD_DIR=/var/tmp/rear.XXXXXXXXXXXX
+# However, in rescue we want our BUILD_DIR=/tmp/rear.XXXXXXX as we are not sure that
+# the user defined TMPDIR would exist in our rescue image
+# by 'unset TMPDIR' we achieve above goal (as rescue.conf is read after local.conf)!
+unset TMPDIR
+EOF

View File

@ -1,167 +0,0 @@
From b448f6c71e96d01909ec8d877f78201e9f9efa45 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Renaud=20M=C3=A9trich?=
<1163635+rmetrich@users.noreply.github.com>
Date: Fri, 27 Jun 2025 14:39:01 +0200
Subject: [PATCH] LUKS2: try to handle multiple key slots (#3430)
LUKS2: try to handle multiple key slots:
The current code doesn't deal properly with multiple key slots nor
extracts the Hash that was used at LUKS creation properly.
With current code, when multiple key slots are found or PBKDF algorithm
is "pbkdf2" (instead of default "argon2id"), the disk layout file
contains 2 lines for 'crypt' parameters, causing havoc during recovery.
This new code tries to do better:
It searches for the Hash in Keyslots section only
(and falls back to Digests section if not found).
It warns the admin if multiple keyslots are in use
(e.g. because of multiple passphrases or Clevis binding).
It handles the PBKDF algorithm.
It makes sure that the 'crypt' parameters are always on one line.
---
doc/user-guide/06-layout-configuration.adoc | 2 +-
.../GNU/Linux/160_include_luks_code.sh | 3 +
.../layout/save/GNU/Linux/260_crypt_layout.sh | 69 ++++++++++++++++---
3 files changed, 62 insertions(+), 12 deletions(-)
diff --git a/doc/user-guide/06-layout-configuration.adoc b/doc/user-guide/06-layout-configuration.adoc
index 680d69640..8a56cb77a 100644
--- a/doc/user-guide/06-layout-configuration.adoc
+++ b/doc/user-guide/06-layout-configuration.adoc
@@ -612,7 +612,7 @@ lvmvol <volume_group> <name> <size(bytes)> <layout> [key:value ...]
=== LUKS Devices ===
----------------------------------
-crypt /dev/mapper/<name> <device> [type=<type>] [cipher=<cipher>] [key_size=<key size>] [hash=<hash function>] [uuid=<uuid>] [keyfile=<keyfile>] [password=<password>]
+crypt /dev/mapper/<name> <device> [type=<type>] [cipher=<cipher>] [key_size=<key size>] [hash=<hash function>] [uuid=<uuid>] [pbkdf=<pbkdf algo> ] [keyfile=<keyfile>] [password=<password>]
----------------------------------
=== DRBD ===
diff --git a/usr/share/rear/layout/prepare/GNU/Linux/160_include_luks_code.sh b/usr/share/rear/layout/prepare/GNU/Linux/160_include_luks_code.sh
index 0c662f677..3b0b34cd1 100644
--- a/usr/share/rear/layout/prepare/GNU/Linux/160_include_luks_code.sh
+++ b/usr/share/rear/layout/prepare/GNU/Linux/160_include_luks_code.sh
@@ -62,6 +62,9 @@ create_crypt() {
(uuid)
test $value && cryptsetup_options+=" --uuid $value"
;;
+ (pbkdf)
+ test $value && cryptsetup_options+=" --pbkdf $value"
+ ;;
(keyfile)
test $value && keyfile=$value
;;
diff --git a/usr/share/rear/layout/save/GNU/Linux/260_crypt_layout.sh b/usr/share/rear/layout/save/GNU/Linux/260_crypt_layout.sh
index afeabf6a7..c13cdb94a 100644
--- a/usr/share/rear/layout/save/GNU/Linux/260_crypt_layout.sh
+++ b/usr/share/rear/layout/save/GNU/Linux/260_crypt_layout.sh
@@ -53,31 +53,73 @@ while read target_name junk ; do
fi
luks_type=luks$version
+ luksDump_cmd="cryptsetup luksDump $source_device"
+
# Gather crypt information:
- if ! cryptsetup luksDump $source_device >$TMP_DIR/cryptsetup.luksDump ; then
- LogPrintError "Error: Cannot get LUKS$version values for $target_name ('cryptsetup luksDump $source_device' failed)"
+ if ! $luksDump_cmd >$TMP_DIR/cryptsetup.luksDump ; then
+ LogPrintError "Error: Cannot get LUKS$version values for $target_name ('$luksDump_cmd' failed)"
continue
fi
+
uuid=$( grep "UUID" $TMP_DIR/cryptsetup.luksDump | sed -r 's/^.+:\s*(.+)$/\1/' )
keyfile_option=$( [ -f /etc/crypttab ] && awk '$1 == "'"$target_name"'" && $3 != "none" && $3 != "-" && $3 != "" { print "keyfile=" $3; }' /etc/crypttab )
+ pbkdf_option=""
+
if test $luks_type = "luks1" ; then
+
cipher_name=$( grep "Cipher name" $TMP_DIR/cryptsetup.luksDump | sed -r 's/^.+:\s*(.+)$/\1/' )
cipher_mode=$( grep "Cipher mode" $TMP_DIR/cryptsetup.luksDump | cut -d: -f2- | awk '{printf("%s",$1)};' )
cipher=$cipher_name-$cipher_mode
key_size=$( grep "MK bits" $TMP_DIR/cryptsetup.luksDump | sed -r 's/^.+:\s*(.+)$/\1/' )
hash=$( grep "Hash spec" $TMP_DIR/cryptsetup.luksDump | sed -r 's/^.+:\s*(.+)$/\1/' )
+
elif test $luks_type = "luks2" ; then
- cipher=$( grep "cipher:" $TMP_DIR/cryptsetup.luksDump | sed -r 's/^.+:\s*(.+)$/\1/' )
- # More than one keyslot may be defined - use key_size from the first slot.
+
+ keyslots_section=$( awk '/^Keyslots:/ {include=1;next} /^[[:upper:]]/ && include {exit} include' $TMP_DIR/cryptsetup.luksDump )
+ if [ -z "$keyslots_section" ]; then
+ LogPrintError "Error: No Keyslots section found in '$luksDump_cmd' output"
+ continue
+ fi
+ if [ $( grep -c -P '^\s+\d+: luks2' <<< "$keyslots_section" ) -gt 1 ]; then
+ LogPrintError "Warning: More than one luks2 keyslot found in '$luksDump_cmd' output, will only consider the first keyslot during recovery"
+ fi
+ luks2_section=$( awk '/^[[:blank:]]+[[:digit:]]+:/ && include {exit} /^[[:blank:]]+[[:digit:]]+: luks2/{include=1} include' <<< "$keyslots_section")
+
+ cipher=$( grep "Cipher:" <<< "$luks2_section" | sed -r 's/^.+:\s*(.+)$/\1/' )
+ pbkdf=$( grep "PBKDF:" <<< "$luks2_section" | sed -r 's/^.+:\s*(.+)$/\1/' )
+ if [ -z "$pbkdf" ]; then
+ LogPrintError "Warning: no PBKDF found in luks2 keyslot of '$luksDump_cmd' output, will use defaults during recovery"
+ else
+ pbkdf_option="pbkdf=$pbkdf"
+ fi
+
# Depending on the version the "cryptsetup luksDump" command outputs the key_size value
# as a line like
# Key: 512 bits
# and/or as a line like
# Cipher key: 512 bits
# cf. https://github.com/rear/rear/pull/2504#issuecomment-718729198 and subsequent comments
- # so we grep for both lines but use only the first match from the first slot:
- key_size=$( egrep -m 1 "Key:|Cipher key:" $TMP_DIR/cryptsetup.luksDump | sed -r 's/^.+:\s*(.+) bits$/\1/' )
- hash=$( grep "Hash" $TMP_DIR/cryptsetup.luksDump | sed -r 's/^.+:\s*(.+)$/\1/' )
+ key_size=$( grep -E "Key:|Cipher key:" <<< "$luks2_section" | sed -r 's/^.+:\s*(.+) bits$/\1/' | sort -u )
+ if [ -z "$key_size" ]; then
+ LogPrintError "Error: No key size found in luks2 keyslot of '$luksDump_cmd' output"
+ elif [ $( wc -w <<< "$key_size" ) -gt 1 ]; then
+ LogPrintError "Error: Too many key sizes found in luks2 keyslot of '$luksDump_cmd' output"
+ key_size=""
+ fi
+
+ hash=$( grep "AF hash:" <<< "$luks2_section" | sed -r 's/^.+:\s*(.+)$/\1/' )
+ if [ -z "$hash" ]; then
+ # Fallback to using Hash field found in Digests section
+ digests_section=$( awk '/^Digests:/ {include=1;next} /^[[:upper:]]/ && include {exit} include' $TMP_DIR/cryptsetup.luksDump )
+ hash=$( grep "Hash:" <<< "$digests_section" | sed -r 's/^.+:\s*(.+)$/\1/' | sort -u )
+ if [ -z "$hash" ]; then
+ LogPrintError "Warning: No Hash found in Digests section of '$luksDump_cmd' output, will use default type during recovery"
+ elif [ $( wc -w <<< "$hash" ) -gt 1 ]; then
+ hash=$( head -1 <<< "$hash" )
+ LogPrintError "Warning: Too many Hash found in Digests section of '$luksDump_cmd' output, will use '$hash' during recovery"
+ fi
+ fi
+
fi
# Basic checks that the cipher key_size hash uuid values exist
@@ -87,9 +129,9 @@ while read target_name junk ; do
# and it seems cryptsetup fails when options with empty values are specified
# cf. https://github.com/rear/rear/pull/2504#issuecomment-719479724
# For example a LUKS1 crypt entry in disklayout.conf looks like
- # crypt /dev/mapper/luks1test /dev/sda7 type=luks1 cipher=aes-xts-plain64 key_size=256 hash=sha256 uuid=1b4198c9-d9b0-4c57-b9a3-3433e391e706
- # and a LUKS1 crypt entry in disklayout.conf looks like
- # crypt /dev/mapper/luks2test /dev/sda8 type=luks2 cipher=aes-xts-plain64 key_size=256 hash=sha256 uuid=3e874a28-7415-4f8c-9757-b3f28a96c4d2
+ # crypt /dev/mapper/luks1test /dev/sda7 type=luks1 cipher=aes-xts-plain64 key_size=256 hash=sha256 uuid=1b4198c9-d9b0-4c57-b9a3-3433e391e706
+ # and a LUKS2 crypt entry in disklayout.conf looks like
+ # crypt /dev/mapper/luks2test /dev/sda8 type=luks2 cipher=aes-xts-plain64 key_size=256 hash=sha256 uuid=3e874a28-7415-4f8c-9757-b3f28a96c4d2 pbkdf=argon2id
# Only the keyfile_option value is optional and the luks_type value is already tested above.
# Using plain test to ensure a value is a single non empty and non blank word
# without quoting because test " " would return zero exit code
@@ -119,7 +161,12 @@ while read target_name junk ; do
LogPrintError "Error: No 'uuid' value for LUKS$version volume $target_name in $source_device (mounting it or booting the recreated system may fail)"
fi
- echo "crypt /dev/mapper/$target_name $source_device type=$luks_type cipher=$cipher key_size=$key_size hash=$hash uuid=$uuid $keyfile_option" >> $DISKLAYOUT_FILE
+ {
+ echo -n "crypt /dev/mapper/$target_name $source_device type=$luks_type cipher=$cipher key_size=$key_size hash=$hash uuid=$uuid"
+ [ -n "$keyfile_option" ] && echo -n " $keyfile_option"
+ [ -n "$pbkdf_option" ] && echo -n " $pbkdf_option"
+ echo
+ } >> $DISKLAYOUT_FILE
done < <( dmsetup ls --target crypt )
--
2.39.5

View File

@ -1,37 +0,0 @@
diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf
index 9ada92c3..3bdb5497 100644
--- a/usr/share/rear/conf/default.conf
+++ b/usr/share/rear/conf/default.conf
@@ -57,10 +57,16 @@
#
# where /prefix/for/rear/working/directory must already exist.
# This is useful for example when there is not sufficient free space
-# in /tmp or $TMPDIR for the ISO image or even the backup archive.
-# TMPDIR cannot be set to a default value here, otherwise /usr/sbin/rear
+# in /var/tmp or $TMPDIR for the ISO image or even the backup archive.
+# TMPDIR cannot be set to a default value here unconditionally but only
+# if it is not set before calling the program, otherwise /usr/sbin/rear
# would not work in compliance with the Linux/Unix standards regarding TMPDIR
# see https://github.com/rear/rear/issues/968
+# The default is /var/tmp instead of the more usual /tmp (the system default),
+# because /tmp is not intended for such large amounts of data that ReaR usually
+# produces when creating the image (see file-hierarchy(7)). In particular,
+# /tmp can be a tmpfs, and thus restricted by the available RAM/swap.
+export TMPDIR="${TMPDIR-/var/tmp}"
##
# ROOT_HOME_DIR
diff --git a/usr/share/rear/rescue/GNU/Linux/600_unset_TMPDIR_in_rescue_conf.sh b/usr/share/rear/rescue/GNU/Linux/600_unset_TMPDIR_in_rescue_conf.sh
deleted file mode 100644
index 84d0cabb..00000000
--- a/usr/share/rear/rescue/GNU/Linux/600_unset_TMPDIR_in_rescue_conf.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-cat - <<EOF >> "$ROOTFS_DIR/etc/rear/rescue.conf"
-# TMPDIR variable may be defined in local.conf file as prefix dir for mktemp command
-# e.g. by defining TMPDIR=/var we would get our BUILD_DIR=/var/tmp/rear.XXXXXXXXXXXX
-# However, in rescue we want our BUILD_DIR=/tmp/rear.XXXXXXX as we are not sure that
-# the user defined TMPDIR would exist in our rescue image
-# by 'unset TMPDIR' we achieve above goal (as rescue.conf is read after local.conf)!
-unset TMPDIR
-EOF

View File

@ -1,4 +0,0 @@
# cronjob for ReaR
# periodically check if disk layout has changed and update
# the rescue image
30 1 * * * root test -f /var/lib/rear/layout/disklayout.conf && /usr/sbin/rear checklayout || /usr/sbin/rear mkrescue

View File

@ -1,6 +0,0 @@
[Unit]
Description=Update ReaR rescue image
[Service]
Type=oneshot
ExecStart=/usr/sbin/rear checklayout || /usr/sbin/rear mkrescue

View File

@ -1,10 +0,0 @@
[Unit]
Description=Update ReaR rescue image
[Timer]
OnCalendar=daily
RandomizedDelaySec=1h
Persistent=true
[Install]
WantedBy=timers.target

View File

@ -1,864 +0,0 @@
commit e6a9c973dbb7be6e46ed9a7fe34df0635635fed6
Author: Johannes Meixner <jsmeix@suse.com>
Date: Tue Jul 12 13:59:28 2022 +0200
Merge pull request #2831 from pcahyna/rsync-url-fix-refactor
Refactor rsync URL support, fixes rsync OUTPUT_URL:
The code to parse rsync:// URLs was BACKUP_URL specific.
If one specified BACKUP=RSYNC and an OUTPUT_URL different from BACKUP_URL,
the OUTPUT_URL was ignored and the output files went to BACKUP_URL.
Fix by introducing generic functions for rsync URL parsing and
use them for both BACKUP_URL and OUTPUT_URL, as appropriate.
Replace all uses of global RSYNC_* variables derived
from BACKUP_URL by those functions.
There also was inconsistent special handling for OUTPUT=PXE which is now removed:
An rsync OUTPUT_URL with OUTPUT=PXE now creates the RSYNC_PREFIX directory
at the destination and the URL is interpreted as in all other cases.
See https://github.com/rear/rear/pull/2831
and https://github.com/rear/rear/issues/2781
diff --git a/usr/share/rear/backup/NETFS/default/200_check_rsync_relative_option.sh b/usr/share/rear/backup/NETFS/default/200_check_rsync_relative_option.sh
deleted file mode 120000
index 336b83f5..00000000
--- a/usr/share/rear/backup/NETFS/default/200_check_rsync_relative_option.sh
+++ /dev/null
@@ -1 +0,0 @@
-../../RSYNC/default/200_check_rsync_relative_option.sh
\ No newline at end of file
diff --git a/usr/share/rear/backup/NETFS/default/210_check_rsync_relative_option.sh b/usr/share/rear/backup/NETFS/default/210_check_rsync_relative_option.sh
new file mode 120000
index 00000000..0570eb44
--- /dev/null
+++ b/usr/share/rear/backup/NETFS/default/210_check_rsync_relative_option.sh
@@ -0,0 +1 @@
+../../RSYNC/default/210_check_rsync_relative_option.sh
\ No newline at end of file
diff --git a/usr/share/rear/backup/RSYNC/GNU/Linux/610_start_selinux.sh b/usr/share/rear/backup/RSYNC/GNU/Linux/610_start_selinux.sh
index 1692ba4c..dd198ede 100644
--- a/usr/share/rear/backup/RSYNC/GNU/Linux/610_start_selinux.sh
+++ b/usr/share/rear/backup/RSYNC/GNU/Linux/610_start_selinux.sh
@@ -6,29 +6,29 @@ local backup_prog_rc
touch "${TMP_DIR}/selinux.autorelabel"
cat $TMP_DIR/selinux.mode > $SELINUX_ENFORCE
Log "Restored original SELinux mode"
- case $RSYNC_PROTO in
+ case $(rsync_proto "$BACKUP_URL") in
(ssh)
# for some reason rsync changes the mode of backup after each run to 666
# FIXME: Add an explanatory comment why "2>/dev/null" is useful here
# or remove it according to https://github.com/rear/rear/issues/1395
- ssh $RSYNC_USER@$RSYNC_HOST "chmod $v 755 ${RSYNC_PATH}/${RSYNC_PREFIX}/backup" 2>/dev/null
+ ssh $(rsync_remote_ssh "$BACKUP_URL") "chmod $v 755 $(rsync_path_full "$BACKUP_URL")/backup" 2>/dev/null
$BACKUP_PROG -a "${TMP_DIR}/selinux.autorelabel" \
- "$RSYNC_USER@$RSYNC_HOST:${RSYNC_PATH}/${RSYNC_PREFIX}/backup/.autorelabel" 2>/dev/null
+ "$(rsync_remote_full "$BACKUP_URL")/backup/.autorelabel" 2>/dev/null
backup_prog_rc=$?
if [ $backup_prog_rc -ne 0 ]; then
- LogPrint "Failed to create .autorelabel on ${RSYNC_PATH}/${RSYNC_PREFIX}/backup [${rsync_err_msg[$backup_prog_rc]}]"
- #StopIfError "Failed to create .autorelabel on ${RSYNC_PATH}/${RSYNC_PREFIX}/backup"
+ LogPrint "Failed to create .autorelabel on $(rsync_path_full "$BACKUP_URL")/backup [${rsync_err_msg[$backup_prog_rc]}]"
+ #StopIfError "Failed to create .autorelabel on $(rsync_path_full "$BACKUP_URL")/backup"
fi
;;
(rsync)
$BACKUP_PROG -a "${TMP_DIR}/selinux.autorelabel" "${BACKUP_RSYNC_OPTIONS[@]}" \
- "${RSYNC_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/${RSYNC_PATH}/${RSYNC_PREFIX}/backup/.autorelabel"
+ "$(rsync_remote_full "$BACKUP_URL")/backup/.autorelabel"
backup_prog_rc=$?
if [ $backup_prog_rc -ne 0 ]; then
- LogPrint "Failed to create .autorelabel on ${RSYNC_PATH}/${RSYNC_PREFIX}/backup [${rsync_err_msg[$backup_prog_rc]}]"
- #StopIfError "Failed to create .autorelabel on ${RSYNC_PATH}/${RSYNC_PREFIX}/backup"
+ LogPrint "Failed to create .autorelabel on $(rsync_path_full "$BACKUP_URL")/backup [${rsync_err_msg[$backup_prog_rc]}]"
+ #StopIfError "Failed to create .autorelabel on $(rsync_path_full "$BACKUP_URL")/backup"
fi
;;
diff --git a/usr/share/rear/backup/RSYNC/GNU/Linux/620_force_autorelabel.sh b/usr/share/rear/backup/RSYNC/GNU/Linux/620_force_autorelabel.sh
index 9a17d6bb..de57d571 100644
--- a/usr/share/rear/backup/RSYNC/GNU/Linux/620_force_autorelabel.sh
+++ b/usr/share/rear/backup/RSYNC/GNU/Linux/620_force_autorelabel.sh
@@ -4,29 +4,29 @@ local backup_prog_rc
> "${TMP_DIR}/selinux.autorelabel"
- case $RSYNC_PROTO in
+ case $(rsync_proto "$BACKUP_URL") in
(ssh)
# for some reason rsync changes the mode of backup after each run to 666
# FIXME: Add an explanatory comment why "2>/dev/null" is useful here
# or remove it according to https://github.com/rear/rear/issues/1395
- ssh $RSYNC_USER@$RSYNC_HOST "chmod $v 755 ${RSYNC_PATH}/${RSYNC_PREFIX}/backup" 2>/dev/null
+ ssh $(rsync_remote_ssh "$BACKUP_URL") "chmod $v 755 $(rsync_path_full "$BACKUP_URL")/backup" 2>/dev/null
$BACKUP_PROG -a "${TMP_DIR}/selinux.autorelabel" \
- "$RSYNC_USER@$RSYNC_HOST:${RSYNC_PATH}/${RSYNC_PREFIX}/backup/.autorelabel" 2>/dev/null
+ "$(rsync_remote_full "$BACKUP_URL")/backup/.autorelabel" 2>/dev/null
backup_prog_rc=$?
if [ $backup_prog_rc -ne 0 ]; then
- LogPrint "Failed to create .autorelabel on ${RSYNC_PATH}/${RSYNC_PREFIX}/backup [${rsync_err_msg[$backup_prog_rc]}]"
- #StopIfError "Failed to create .autorelabel on ${RSYNC_PATH}/${RSYNC_PREFIX}/backup"
+ LogPrint "Failed to create .autorelabel on $(rsync_path_full "$BACKUP_URL")/backup [${rsync_err_msg[$backup_prog_rc]}]"
+ #StopIfError "Failed to create .autorelabel on $(rsync_path_full "$BACKUP_URL")/backup"
fi
;;
(rsync)
$BACKUP_PROG -a "${TMP_DIR}/selinux.autorelabel" "${BACKUP_RSYNC_OPTIONS[@]}" \
- "${RSYNC_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/${RSYNC_PATH}/${RSYNC_PREFIX}/backup/.autorelabel"
+ "$(rsync_remote_full "$BACKUP_URL")/backup/.autorelabel"
backup_prog_rc=$?
if [ $backup_prog_rc -ne 0 ]; then
- LogPrint "Failed to create .autorelabel on ${RSYNC_PATH}/${RSYNC_PREFIX}/backup [${rsync_err_msg[$backup_prog_rc]}]"
- #StopIfError "Failed to create .autorelabel on ${RSYNC_PATH}/${RSYNC_PREFIX}/backup"
+ LogPrint "Failed to create .autorelabel on $(rsync_path_full "$BACKUP_URL")/backup [${rsync_err_msg[$backup_prog_rc]}]"
+ #StopIfError "Failed to create .autorelabel on $(rsync_path_full "$BACKUP_URL")/backup"
fi
;;
diff --git a/usr/share/rear/backup/RSYNC/default/200_make_prefix_dir.sh b/usr/share/rear/backup/RSYNC/default/200_make_prefix_dir.sh
new file mode 100644
index 00000000..81aa6879
--- /dev/null
+++ b/usr/share/rear/backup/RSYNC/default/200_make_prefix_dir.sh
@@ -0,0 +1,28 @@
+# Create RSYNC_PREFIX/backup on remote rsync server
+# RSYNC_PREFIX=$HOSTNAME as set in default.conf
+
+local proto host
+
+proto="$(rsync_proto "$BACKUP_URL")"
+host="$(rsync_host "$BACKUP_URL")"
+
+mkdir -p $v -m0750 "${TMP_DIR}/rsync/${RSYNC_PREFIX}" >&2 || Error "Could not mkdir '${TMP_DIR}/rsync/${RSYNC_PREFIX}'"
+mkdir -p $v -m0755 "${TMP_DIR}/rsync/${RSYNC_PREFIX}/backup" >&2 || Error "Could not mkdir '${TMP_DIR}/rsync/${RSYNC_PREFIX}/backup'"
+
+case $proto in
+
+ (ssh)
+ $BACKUP_PROG -a $v -r "${TMP_DIR}/rsync/${RSYNC_PREFIX}" "$(rsync_remote "$BACKUP_URL")" >/dev/null 2>&1 \
+ || Error "Could not create '$(rsync_path_full "$BACKUP_URL")' on remote ${host}"
+ ;;
+
+ (rsync)
+ $BACKUP_PROG -a $v -r "${TMP_DIR}/rsync/${RSYNC_PREFIX}" "${BACKUP_RSYNC_OPTIONS[@]}" "$(rsync_remote "$BACKUP_URL")/" >/dev/null \
+ || Error "Could not create '$(rsync_path_full "$BACKUP_URL")' on remote ${host}"
+ ;;
+
+esac
+
+# We don't need it anymore, from now we operate on the remote copy
+rmdir $v "${TMP_DIR}/rsync/${RSYNC_PREFIX}/backup"
+rmdir $v "${TMP_DIR}/rsync/${RSYNC_PREFIX}"
diff --git a/usr/share/rear/backup/RSYNC/default/200_check_rsync_relative_option.sh b/usr/share/rear/backup/RSYNC/default/210_check_rsync_relative_option.sh
similarity index 91%
rename from usr/share/rear/backup/RSYNC/default/200_check_rsync_relative_option.sh
rename to usr/share/rear/backup/RSYNC/default/210_check_rsync_relative_option.sh
index cedee9ce..692616b7 100644
--- a/usr/share/rear/backup/RSYNC/default/200_check_rsync_relative_option.sh
+++ b/usr/share/rear/backup/RSYNC/default/210_check_rsync_relative_option.sh
@@ -1,4 +1,4 @@
-# 200_check_rsync_relative_option.sh
+# 210_check_rsync_relative_option.sh
# See issue #871 for details
# check for the --relative option in BACKUP_RSYNC_OPTIONS array
diff --git a/usr/share/rear/backup/RSYNC/default/450_calculate_req_space.sh b/usr/share/rear/backup/RSYNC/default/450_calculate_req_space.sh
index eb99dbf6..037e49c0 100644
--- a/usr/share/rear/backup/RSYNC/default/450_calculate_req_space.sh
+++ b/usr/share/rear/backup/RSYNC/default/450_calculate_req_space.sh
@@ -1,6 +1,12 @@
# here we will calculate the space required to hold the backup archive on the remote rsync system
# This file is part of Relax-and-Recover, licensed under the GNU General
# Public License. Refer to the included COPYING for full text of license.
+local proto host path
+
+proto="$(rsync_proto "$BACKUP_URL")"
+host="$(rsync_host "$BACKUP_URL")"
+path="$(rsync_path "$BACKUP_URL")"
+
_local_size=0
_remote_size=0
while read -r ; do
@@ -13,17 +19,17 @@ while read -r ; do
done < $TMP_DIR/backup-include.txt
LogPrint "Estimated size of local file systems is $(( _local_size / 1024 )) MB"
-case $RSYNC_PROTO in
+case $proto in
(ssh)
- LogPrint "Calculating size of $RSYNC_HOST:$RSYNC_PATH"
- ssh -l $RSYNC_USER $RSYNC_HOST "df -P $RSYNC_PATH" >$TMP_DIR/rs_size
- StopIfError "Failed to determine size of $RSYNC_PATH"
+ LogPrint "Calculating size of ${host}:${path}"
+ ssh $(rsync_remote_ssh "$BACKUP_URL") "df -P ${path}" >$TMP_DIR/rs_size
+ StopIfError "Failed to determine size of ${path}"
_div=1 # 1024-blocks
grep -q "512-blocks" $TMP_DIR/rs_size && _div=2 # HPUX: divide with 2 to get kB size
_remote_size=$( tail -n 1 $TMP_DIR/rs_size | awk '{print $2}' )
_remote_size=$(( _remote_size / _div ))
[[ $_remote_size -gt $_local_size ]]
- StopIfError "Not enough disk space available on $RSYNC_HOST:$RSYNC_PATH ($_remote_size < $_local_size)"
+ StopIfError "Not enough disk space available on ${host}:${path} ($_remote_size < $_local_size)"
;;
(rsync)
# TODO: how can we calculate the free size on remote system via rsync protocol??
diff --git a/usr/share/rear/backup/RSYNC/default/500_make_rsync_backup.sh b/usr/share/rear/backup/RSYNC/default/500_make_rsync_backup.sh
index 750a04ca..aa8192c0 100644
--- a/usr/share/rear/backup/RSYNC/default/500_make_rsync_backup.sh
+++ b/usr/share/rear/backup/RSYNC/default/500_make_rsync_backup.sh
@@ -5,6 +5,11 @@
local backup_prog_rc
local backup_log_message
+local host path
+
+host="$(rsync_host "$BACKUP_URL")"
+path="$(rsync_path "$BACKUP_URL")"
+
Log "Include list:"
while read -r ; do
Log " $REPLY"
@@ -14,26 +19,27 @@ while read -r ; do
Log " $REPLY"
done < $TMP_DIR/backup-exclude.txt
-LogPrint "Creating $BACKUP_PROG backup on '${RSYNC_HOST}:${RSYNC_PATH}'"
+LogPrint "Creating $BACKUP_PROG backup on '${host}:${path}'"
ProgressStart "Running backup operation"
(
case "$(basename $BACKUP_PROG)" in
(rsync)
+ # We are in a subshell, so this change will not propagate to later scripts
BACKUP_RSYNC_OPTIONS+=( --one-file-system --delete --exclude-from=$TMP_DIR/backup-exclude.txt --delete-excluded )
- case $RSYNC_PROTO in
+ case $(rsync_proto "$BACKUP_URL") in
(ssh)
- Log $BACKUP_PROG "${BACKUP_RSYNC_OPTIONS[@]}" $(cat $TMP_DIR/backup-include.txt) "${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PATH}/${RSYNC_PREFIX}/backup"
+ Log $BACKUP_PROG "${BACKUP_RSYNC_OPTIONS[@]}" $(cat $TMP_DIR/backup-include.txt) "$(rsync_remote_full "$BACKUP_URL")/backup"
$BACKUP_PROG "${BACKUP_RSYNC_OPTIONS[@]}" $(cat $TMP_DIR/backup-include.txt) \
- "${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PATH}/${RSYNC_PREFIX}/backup"
+ "$(rsync_remote_full "$BACKUP_URL")/backup"
;;
(rsync)
$BACKUP_PROG "${BACKUP_RSYNC_OPTIONS[@]}" $(cat $TMP_DIR/backup-include.txt) \
- "${RSYNC_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/${RSYNC_PATH}/${RSYNC_PREFIX}/backup"
+ "$(rsync_remote_full "$BACKUP_URL")/backup"
;;
esac
@@ -57,11 +63,11 @@ get_size() {
}
check_remote_df() {
- echo $(ssh ${RSYNC_USER}@${RSYNC_HOST} df -P ${RSYNC_PATH} 2>/dev/null | tail -1 | awk '{print $5}' | sed -e 's/%//')
+ echo $(ssh $(rsync_remote_ssh "$BACKUP_URL") df -P ${path} 2>/dev/null | tail -1 | awk '{print $5}' | sed -e 's/%//')
}
check_remote_du() {
- x=$(ssh ${RSYNC_USER}@${RSYNC_HOST} du -sb ${RSYNC_PATH}/${RSYNC_PREFIX}/backup 2>/dev/null | awk '{print $1}')
+ x=$(ssh $(rsync_remote_ssh "$BACKUP_URL") du -sb $(rsync_path_full "$BACKUP_URL")/backup 2>/dev/null | awk '{print $1}')
[[ -z "${x}" ]] && x=0
echo $x
}
@@ -81,7 +87,7 @@ case "$(basename $BACKUP_PROG)" in
case $i in
300)
- [[ $(check_remote_df) -eq 100 ]] && Error "Disk is full on system ${RSYNC_HOST}"
+ [[ $(check_remote_df) -eq 100 ]] && Error "Disk is full on system ${host}"
;;
15|30|45|60|75|90|105|120|135|150|165|180|195|210|225|240|255|270|285)
diff --git a/usr/share/rear/backup/RSYNC/default/700_copy_backup_log.sh b/usr/share/rear/backup/RSYNC/default/700_copy_backup_log.sh
index b90d459b..76b9f971 100644
--- a/usr/share/rear/backup/RSYNC/default/700_copy_backup_log.sh
+++ b/usr/share/rear/backup/RSYNC/default/700_copy_backup_log.sh
@@ -1,26 +1,27 @@
# copy the backup.log & rear.log file to remote destination with timestamp added
-local timestamp
+local timestamp proto
timestamp=$( date +%Y%m%d.%H%M )
+proto="$(rsync_proto "$BACKUP_URL")"
# compress the log file first
gzip "$TMP_DIR/$BACKUP_PROG_ARCHIVE.log" || Error "Failed to 'gzip $TMP_DIR/$BACKUP_PROG_ARCHIVE.log'"
-case $RSYNC_PROTO in
+case $proto in
(ssh)
# FIXME: Add an explanatory comment why "2>/dev/null" is useful here
# or remove it according to https://github.com/rear/rear/issues/1395
$BACKUP_PROG -a "${TMP_DIR}/${BACKUP_PROG_ARCHIVE}.log.gz" \
- "${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PATH}/${RSYNC_PREFIX}/${BACKUP_PROG_ARCHIVE}-${timestamp}.log.gz" 2>/dev/null
+ "$(rsync_remote_full "$BACKUP_URL")/${BACKUP_PROG_ARCHIVE}-${timestamp}.log.gz" 2>/dev/null
- $BACKUP_PROG -a "$RUNTIME_LOGFILE" "${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PATH}/${RSYNC_PREFIX}/rear-${timestamp}.log" 2>/dev/null
+ $BACKUP_PROG -a "$RUNTIME_LOGFILE" "$(rsync_remote_full "$BACKUP_URL")/rear-${timestamp}.log" 2>/dev/null
;;
(rsync)
$BACKUP_PROG -a "${TMP_DIR}/${BACKUP_PROG_ARCHIVE}.log.gz" "${BACKUP_RSYNC_OPTIONS[@]}" \
- "${RSYNC_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/${RSYNC_PATH}/${RSYNC_PREFIX}/${BACKUP_PROG_ARCHIVE}-${timestamp}.log.gz"
+ "$(rsync_remote_full "$BACKUP_URL")/${BACKUP_PROG_ARCHIVE}-${timestamp}.log.gz"
- $BACKUP_PROG -a "$RUNTIME_LOGFILE" "${BACKUP_RSYNC_OPTIONS[@]}" "${RSYNC_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/${RSYNC_PATH}/${RSYNC_PREFIX}//rear-${timestamp}.log"
+ $BACKUP_PROG -a "$RUNTIME_LOGFILE" "${BACKUP_RSYNC_OPTIONS[@]}" "$(rsync_remote_full "$BACKUP_URL")//rear-${timestamp}.log"
;;
esac
diff --git a/usr/share/rear/lib/global-functions.sh b/usr/share/rear/lib/global-functions.sh
index 32aeb8ca..2edb64a6 100644
--- a/usr/share/rear/lib/global-functions.sh
+++ b/usr/share/rear/lib/global-functions.sh
@@ -259,7 +259,7 @@ function url_scheme() {
# the scheme is the leading part up to '://'
local scheme=${url%%://*}
# rsync scheme does not have to start with rsync:// it can also be scp style
- # see the comments in usr/share/rear/prep/RSYNC/default/100_check_rsync.sh
+ # see the comments in usr/share/rear/lib/rsync-functions.sh
echo $scheme | grep -q ":" && echo rsync || echo $scheme
}
diff --git a/usr/share/rear/lib/rsync-functions.sh b/usr/share/rear/lib/rsync-functions.sh
new file mode 100644
index 00000000..443a9625
--- /dev/null
+++ b/usr/share/rear/lib/rsync-functions.sh
@@ -0,0 +1,178 @@
+# Functions for manipulation of rsync URLs (both OUTPUT_URL and BACKUP_URL)
+
+#### OLD STYLE:
+# BACKUP_URL=[USER@]HOST:PATH # using ssh (no rsh)
+#
+# with rsync protocol PATH is a MODULE name defined in remote /etc/rsyncd.conf file
+# BACKUP_URL=[USER@]HOST::PATH # using rsync
+# BACKUP_URL=rsync://[USER@]HOST[:PORT]/PATH # using rsync (is not compatible with new style!!!)
+
+#### NEW STYLE:
+# BACKUP_URL=rsync://[USER@]HOST[:PORT]/PATH # using ssh
+# BACKUP_URL=rsync://[USER@]HOST[:PORT]::/PATH # using rsync
+
+function rsync_validate () {
+ local url="$1"
+
+ if [[ "$(url_scheme "$url")" != "rsync" ]]; then # url_scheme still recognizes old style
+ BugError "Non-rsync URL $url !"
+ fi
+}
+
+# Determine whether the URL specifies the use of the rsync protocol (rsyncd) or ssh
+# Do not call on non-rsync URLs (use url_scheme first)
+function rsync_proto () {
+ local url="$1"
+
+ rsync_validate "$url"
+ if egrep -q '(::)' <<< $url ; then # new style '::' means rsync protocol
+ echo rsync
+ else
+ echo ssh
+ fi
+}
+
+# Functions to parse the URL into its components:
+# USER, HOST, PORT, PATH
+
+function rsync_user () {
+ local url="$1"
+ local host
+
+ host=$(url_host "$url")
+
+ if grep -q '@' <<< $host ; then
+ echo "${host%%@*}" # grab user name
+ else
+ echo root
+ fi
+}
+
+function rsync_host () {
+ local url="$1"
+ local host
+ local path
+
+ host=$(url_host "$url")
+ path=$(url_path "$url")
+ # remove USER@ if present
+ local tmp2="${host#*@}"
+
+ case "$(rsync_proto "$url")" in
+ (rsync)
+ # tmp2=witsbebelnx02::backup or tmp2=witsbebelnx02::
+ echo "${tmp2%%::*}"
+ ;;
+ (ssh)
+ # tmp2=host or tmp2=host:
+ echo "${tmp2%%:*}"
+ ;;
+ esac
+}
+
+function rsync_path () {
+ local url="$1"
+ local host
+ local path
+ local url_without_scheme
+ local url_without_scheme_user
+
+ host=$(url_host "$url")
+ path=$(url_path "$url")
+ local tmp2="${host#*@}"
+
+ url_without_scheme="${url#*//}"
+ url_without_scheme_user="${url_without_scheme#$(rsync_user "$url")@}"
+
+ case "$(rsync_proto "$url")" in
+
+ (rsync)
+ if grep -q '::' <<< $url_without_scheme_user ; then
+ # we can not use url_path here, it uses / as separator, not ::
+ local url_after_separator="${url_without_scheme_user##*::}"
+ # remove leading / - this is a module name
+ echo "${url_after_separator#/}"
+ else
+ echo "${path#*/}"
+ fi
+ ;;
+ (ssh)
+ if [ "$url_without_scheme" == "$url" ]; then
+ # no scheme - old-style URL
+ if grep -q ':' <<< $url_without_scheme_user ; then
+ echo "${url_without_scheme_user##*:}"
+ else
+ BugError "Old-style rsync URL $url without : !"
+ fi
+ else
+ echo "$path"
+ fi
+ ;;
+
+ esac
+}
+
+function rsync_port () {
+ # XXX changing port not implemented yet
+ echo 873
+}
+
+# Full path to the destination directory on the remote server,
+# includes RSYNC_PREFIX. RSYNC_PREFIX is not given by the URL,
+# it is a global parameter (by default derived from hostname).
+function rsync_path_full () {
+ local url="$1"
+
+ echo "$(rsync_path "$url")/${RSYNC_PREFIX}"
+}
+
+# Argument for the ssh command to log in to the remote host ("user@host")
+function rsync_remote_ssh () {
+ local url="$1"
+
+ local user host
+
+ user="$(rsync_user "$url")"
+ host="$(rsync_host "$url")"
+
+ echo "${user}@${host}"
+}
+
+# Argument for the rsync command to reach the remote host, without path.
+function rsync_remote_base () {
+ local url="$1"
+
+ local user host port
+
+ user="$(rsync_user "$url")"
+ host="$(rsync_host "$url")"
+ port="$(rsync_port "$url")"
+
+ case "$(rsync_proto "$url")" in
+
+ (rsync)
+ echo "rsync://${user}@${host}:${port}/"
+ ;;
+ (ssh)
+ echo "$(rsync_remote_ssh "$url"):"
+ ;;
+
+ esac
+}
+
+# Complete argument to rsync to reach the remote location identified by URL,
+# but without the added RSYNC_PREFIX.
+# This essentially converts our rsync:// URLs into a form accepted by the rsync command.
+function rsync_remote () {
+ local url="$1"
+
+ echo "$(rsync_remote_base "$url")$(rsync_path "$url")"
+}
+
+# Complete argument to rsync including even RSYNC_PREFIX.
+# Determined from the URL and RSYNC_PREFIX.
+function rsync_remote_full () {
+ local url="$1"
+
+ echo "$(rsync_remote_base "$url")$(rsync_path_full "$url")"
+}
diff --git a/usr/share/rear/output/RSYNC/default/200_make_prefix_dir.sh b/usr/share/rear/output/RSYNC/default/200_make_prefix_dir.sh
index 519febf5..d00d15e4 100644
--- a/usr/share/rear/output/RSYNC/default/200_make_prefix_dir.sh
+++ b/usr/share/rear/output/RSYNC/default/200_make_prefix_dir.sh
@@ -1,20 +1,32 @@
# Create RSYNC_PREFIX under the local TMP_DIR and also on remote rsync server
# RSYNC_PREFIX=$HOSTNAME as set in default.conf
-# create temporary local work-spaces to collect files (we already make the remote backup dir with the correct mode!!)
+local proto host scheme
+
+scheme="$(url_scheme "$OUTPUT_URL")"
+
+# we handle only rsync:// output schemes.
+# ToDo: why does handling of the output URL scheme belong under RSYNC (which is a backup method)?
+# OUTPUT_URL is independent on the chosen backup method, so this code should be moved to be backup-independent.
+test "rsync" = "$scheme" || return 0
+
+proto="$(rsync_proto "$OUTPUT_URL")"
+host="$(rsync_host "$OUTPUT_URL")"
+
+# create temporary local work-spaces to collect files
mkdir -p $v -m0750 "${TMP_DIR}/rsync/${RSYNC_PREFIX}" >&2 || Error "Could not mkdir '${TMP_DIR}/rsync/${RSYNC_PREFIX}'"
-mkdir -p $v -m0755 "${TMP_DIR}/rsync/${RSYNC_PREFIX}/backup" >&2 || Error "Could not mkdir '${TMP_DIR}/rsync/${RSYNC_PREFIX}/backup'"
-case $RSYNC_PROTO in
+case $proto in
(ssh)
- $BACKUP_PROG -a $v -r "${TMP_DIR}/rsync/${RSYNC_PREFIX}" "${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PATH}" >/dev/null 2>&1 \
- || Error "Could not create '${RSYNC_PATH}/${RSYNC_PREFIX}' on remote ${RSYNC_HOST}"
+ $BACKUP_PROG -a $v -r "${TMP_DIR}/rsync/${RSYNC_PREFIX}" "$(rsync_remote "$OUTPUT_URL")" >/dev/null 2>&1 \
+ || Error "Could not create '$(rsync_path_full "$OUTPUT_URL")' on remote ${host}"
;;
(rsync)
- $BACKUP_PROG -a $v -r "${TMP_DIR}/rsync/${RSYNC_PREFIX}" "${BACKUP_RSYNC_OPTIONS[@]}" "${RSYNC_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/${RSYNC_PATH}/" >/dev/null \
- || Error "Could not create '${RSYNC_PATH}/${RSYNC_PREFIX}' on remote ${RSYNC_HOST}"
+ # This must run before the backup stage. Otherwise --relative gets added to BACKUP_RSYNC_OPTIONS
+ $BACKUP_PROG -a $v -r "${TMP_DIR}/rsync/${RSYNC_PREFIX}" "${BACKUP_RSYNC_OPTIONS[@]}" "$(rsync_remote "$OUTPUT_URL")/" >/dev/null \
+ || Error "Could not create '$(rsync_path_full "$OUTPUT_URL")' on remote ${host}"
;;
esac
diff --git a/usr/share/rear/output/RSYNC/default/900_copy_result_files.sh b/usr/share/rear/output/RSYNC/default/900_copy_result_files.sh
index 96b62da1..4ddf3cb4 100644
--- a/usr/share/rear/output/RSYNC/default/900_copy_result_files.sh
+++ b/usr/share/rear/output/RSYNC/default/900_copy_result_files.sh
@@ -1,6 +1,17 @@
#
# copy resulting files to remote network (backup) location
+local proto scheme
+
+scheme="$(url_scheme "$OUTPUT_URL")"
+
+# we handle only rsync:// output schemes.
+# ToDo: why does handling of the output URL scheme belong under RSYNC (which is a backup method)?
+# OUTPUT_URL is independent on the chosen backup method, so this code should be moved to be backup-independent.
+test "rsync" = "$scheme" || return 0
+
+proto="$(rsync_proto "$OUTPUT_URL")"
+
LogPrint "Copying resulting files to $OUTPUT_URL location"
# if called as mkbackuponly then we just don't have any result files.
@@ -19,21 +30,21 @@ cp $v $(get_template "RESULT_usage_$OUTPUT.txt") "${TMP_DIR}/rsync/${RSYNC_PREFI
cat "$RUNTIME_LOGFILE" >"${TMP_DIR}/rsync/${RSYNC_PREFIX}/rear.log" \
|| Error "Could not copy $RUNTIME_LOGFILE to local rsync location"
-case $RSYNC_PROTO in
+case $proto in
(ssh)
- Log "$BACKUP_PROG -a ${TMP_DIR}/rsync/${RSYNC_PREFIX}/ ${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PATH}/${RSYNC_PREFIX}/"
+ Log "$BACKUP_PROG -a ${TMP_DIR}/rsync/${RSYNC_PREFIX}/ $(rsync_remote_full "$OUTPUT_URL")/"
# FIXME: Add an explanatory comment why "2>/dev/null" is useful here
# or remove it according to https://github.com/rear/rear/issues/1395
- $BACKUP_PROG -a "${TMP_DIR}/rsync/${RSYNC_PREFIX}/" "${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PATH}/${RSYNC_PREFIX}/" 2>/dev/null \
+ $BACKUP_PROG -a "${TMP_DIR}/rsync/${RSYNC_PREFIX}/" "$(rsync_remote_full "$OUTPUT_URL")/" 2>/dev/null \
|| Error "Could not copy '${RESULT_FILES[*]}' to $OUTPUT_URL location"
;;
(rsync)
- Log "$BACKUP_PROG -a ${TMP_DIR}/rsync/${RSYNC_PREFIX}/ ${BACKUP_RSYNC_OPTIONS[*]} ${RSYNC_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/${RSYNC_PATH}/${RSYNC_PREFIX}/"
+ Log "$BACKUP_PROG -a ${TMP_DIR}/rsync/${RSYNC_PREFIX}/ ${BACKUP_RSYNC_OPTIONS[*]} $(rsync_remote_full "$OUTPUT_URL")/"
# FIXME: Add an explanatory comment why "2>/dev/null" is useful here
# or remove it according to https://github.com/rear/rear/issues/1395
- $BACKUP_PROG -a "${TMP_DIR}/rsync/${RSYNC_PREFIX}/" "${BACKUP_RSYNC_OPTIONS[@]}" "${RSYNC_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/${RSYNC_PATH}/${RSYNC_PREFIX}/" 2>/dev/null \
+ $BACKUP_PROG -a "${TMP_DIR}/rsync/${RSYNC_PREFIX}/" "${BACKUP_RSYNC_OPTIONS[@]}" "$(rsync_remote_full "$OUTPUT_URL")/" 2>/dev/null \
|| Error "Could not copy '${RESULT_FILES[*]}' to $OUTPUT_URL location"
;;
diff --git a/usr/share/rear/prep/RSYNC/GNU/Linux/200_selinux_in_use.sh b/usr/share/rear/prep/RSYNC/GNU/Linux/200_selinux_in_use.sh
index eb7df29e..84500039 100644
--- a/usr/share/rear/prep/RSYNC/GNU/Linux/200_selinux_in_use.sh
+++ b/usr/share/rear/prep/RSYNC/GNU/Linux/200_selinux_in_use.sh
@@ -25,8 +25,10 @@ case $(basename $BACKUP_PROG) in
(rsync)
if grep -q "no xattrs" "$TMP_DIR/rsync_protocol"; then
+ local host
+ host="$(rsync_host "$BACKUP_URL")"
# no xattrs compiled in remote rsync, so saving SELinux attributes are not possible
- Log "WARNING: --xattrs not possible on system ($RSYNC_HOST) (no xattrs compiled in rsync)"
+ Log "WARNING: --xattrs not possible on system ($host) (no xattrs compiled in rsync)"
# $TMP_DIR/selinux.mode is a trigger during backup to disable SELinux
cat $SELINUX_ENFORCE > $TMP_DIR/selinux.mode
RSYNC_SELINUX= # internal variable used in recover mode (empty means disable SELinux)
diff --git a/usr/share/rear/prep/RSYNC/default/100_check_rsync.sh b/usr/share/rear/prep/RSYNC/default/100_check_rsync.sh
index c964a148..448a1b1a 100644
--- a/usr/share/rear/prep/RSYNC/default/100_check_rsync.sh
+++ b/usr/share/rear/prep/RSYNC/default/100_check_rsync.sh
@@ -3,97 +3,40 @@
# This file is part of Relax-and-Recover, licensed under the GNU General
# Public License. Refer to the included COPYING for full text of license.
-#### OLD STYLE:
-# BACKUP_URL=[USER@]HOST:PATH # using ssh (no rsh)
-#
-# with rsync protocol PATH is a MODULE name defined in remote /etc/rsyncd.conf file
-# BACKUP_URL=[USER@]HOST::PATH # using rsync
-# BACKUP_URL=rsync://[USER@]HOST[:PORT]/PATH # using rsync (is not compatible with new style!!!)
-
-#### NEW STYLE:
-# BACKUP_URL=rsync://[USER@]HOST[:PORT]/PATH # using ssh
-# BACKUP_URL=rsync://[USER@]HOST[:PORT]::/PATH # using rsync
-
if test -z "$BACKUP_URL" ; then
Error "Missing BACKUP_URL=rsync://[USER@]HOST[:PORT][::]/PATH !"
fi
-local host=$(url_host $BACKUP_URL)
local scheme=$(url_scheme $BACKUP_URL) # url_scheme still recognizes old style
-local path=$(url_path $BACKUP_URL)
if [[ "$scheme" != "rsync" ]]; then
Error "Missing BACKUP_URL=rsync://[USER@]HOST[:PORT][::]/PATH !"
fi
-RSYNC_PROTO= # ssh or rsync
-RSYNC_USER=
-RSYNC_HOST=
-RSYNC_PORT=873 # default port (of rsync server)
-RSYNC_PATH=
-
-
-if egrep -q '(::)' <<< $BACKUP_URL ; then # new style '::' means rsync protocol
- RSYNC_PROTO=rsync
-else
- RSYNC_PROTO=ssh
-fi
-
-if grep -q '@' <<< $host ; then
- RSYNC_USER="${host%%@*}" # grab user name
-else
- RSYNC_USER=root
-fi
-
-# remove USER@ if present (we don't need it anymore)
-local tmp2="${host#*@}"
-
-case "$RSYNC_PROTO" in
-
- (rsync)
- # tmp2=witsbebelnx02::backup or tmp2=witsbebelnx02::
- RSYNC_HOST="${tmp2%%::*}"
- # path=/gdhaese1@witsbebelnx02::backup or path=/backup
- if grep -q '::' <<< $path ; then
- RSYNC_PATH="${path##*::}"
- else
- RSYNC_PATH="${path##*/}"
- fi
- ;;
- (ssh)
- # tmp2=host or tmp2=host:
- RSYNC_HOST="${tmp2%%:*}"
- RSYNC_PATH=$path
- ;;
-
-esac
-
-#echo RSYNC_PROTO=$RSYNC_PROTO
-#echo RSYNC_USER=$RSYNC_USER
-#echo RSYNC_HOST=$RSYNC_HOST
-#echo RSYNC_PORT=$RSYNC_PORT
-#echo RSYNC_PATH=$RSYNC_PATH
+local host proto
+host="$(rsync_host "$BACKUP_URL")"
+proto="$(rsync_proto "$BACKUP_URL")"
# check if host is reachable
if test "$PING" ; then
- ping -c 2 "$RSYNC_HOST" >/dev/null || Error "Backup host [$RSYNC_HOST] not reachable."
+ ping -c 2 "$host" >/dev/null || Error "Backup host [$host] not reachable."
else
Log "Skipping ping test"
fi
# check protocol connectivity
-case "$RSYNC_PROTO" in
+case "$proto" in
(rsync)
- Log "Test: $BACKUP_PROG ${BACKUP_RSYNC_OPTIONS[*]} ${RSYNC_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/"
- $BACKUP_PROG "${BACKUP_RSYNC_OPTIONS[@]}" ${RSYNC_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/ >/dev/null \
- || Error "Rsync daemon not running on $RSYNC_HOST"
+ Log "Test: $BACKUP_PROG ${BACKUP_RSYNC_OPTIONS[*]} $(rsync_remote_base "$BACKUP_URL")"
+ $BACKUP_PROG "${BACKUP_RSYNC_OPTIONS[@]}" $(rsync_remote_base "$BACKUP_URL") >/dev/null \
+ || Error "Rsync daemon not running on $host"
;;
(ssh)
- Log "Test: ssh ${RSYNC_USER}@${RSYNC_HOST} /bin/true"
- ssh ${RSYNC_USER}@${RSYNC_HOST} /bin/true >/dev/null 2>&1 \
- || Error "Secure shell connection not setup properly [$RSYNC_USER@$RSYNC_HOST]"
+ Log "Test: ssh $(rsync_remote_ssh "$BACKUP_URL") /bin/true"
+ ssh $(rsync_remote_ssh "$BACKUP_URL") /bin/true >/dev/null 2>&1 \
+ || Error "Secure shell connection not setup properly [$(rsync_remote_ssh "$BACKUP_URL")]"
;;
esac
diff --git a/usr/share/rear/prep/RSYNC/default/150_check_rsync_protocol_version.sh b/usr/share/rear/prep/RSYNC/default/150_check_rsync_protocol_version.sh
index e9103531..becf35a0 100644
--- a/usr/share/rear/prep/RSYNC/default/150_check_rsync_protocol_version.sh
+++ b/usr/share/rear/prep/RSYNC/default/150_check_rsync_protocol_version.sh
@@ -3,15 +3,18 @@
# Public License. Refer to the included COPYING for full text of license.
# try to grab the rsync protocol version of rsync on the remote server
-local remote_mountpoint
+local remote_mountpoint host path proto
+host="$(rsync_host "$BACKUP_URL")"
+path="$(rsync_path "$BACKUP_URL")"
+proto="$(rsync_proto "$BACKUP_URL")"
if [ -z "$RSYNC_PROTOCOL_VERSION" ]; then
- case $RSYNC_PROTO in
+ case $proto in
(ssh)
- ssh ${RSYNC_USER}@${RSYNC_HOST} rsync --version >"$TMP_DIR/rsync_protocol" 2>&1 \
- || Error "Secure shell connection not setup properly [$RSYNC_USER@$RSYNC_HOST]"
+ ssh $(rsync_remote_ssh "$BACKUP_URL") rsync --version >"$TMP_DIR/rsync_protocol" 2>&1 \
+ || Error "Secure shell connection not setup properly [$(rsync_remote_ssh "$BACKUP_URL")]"
if grep -q "protocol version" "$TMP_DIR/rsync_protocol" ; then
RSYNC_PROTOCOL_VERSION=$(grep 'protocol version' "$TMP_DIR/rsync_protocol" | awk '{print $6}')
else
@@ -24,29 +27,29 @@ if [ -z "$RSYNC_PROTOCOL_VERSION" ]; then
RSYNC_PROTOCOL_VERSION=29 # being conservative (old rsync)
;;
esac
- Log "Remote rsync system ($RSYNC_HOST) uses rsync protocol version $RSYNC_PROTOCOL_VERSION"
+ Log "Remote rsync system ($host) uses rsync protocol version $RSYNC_PROTOCOL_VERSION"
else
- Log "Remote rsync system ($RSYNC_HOST) uses rsync protocol version $RSYNC_PROTOCOL_VERSION (overruled by user)"
+ Log "Remote rsync system ($host) uses rsync protocol version $RSYNC_PROTOCOL_VERSION (overruled by user)"
fi
-if [ "${RSYNC_USER}" != "root" -a $RSYNC_PROTO = "ssh" ]; then
+if [ "$(rsync_user "$BACKUP_URL")" != "root" -a $proto = "ssh" ]; then
if [ $RSYNC_PROTOCOL_VERSION -gt 29 ]; then
if grep -q "no xattrs" "$TMP_DIR/rsync_protocol"; then
# no xattrs available in remote rsync, so --fake-super is not possible
- Error "rsync --fake-super not possible on system ($RSYNC_HOST) (no xattrs compiled in rsync)"
+ Error "rsync --fake-super not possible on system ($host) (no xattrs compiled in rsync)"
else
# when using --fake-super we must have user_xattr mount options on the remote mntpt
- remote_mountpoint=$(ssh ${RSYNC_USER}@${RSYNC_HOST} 'cd ${RSYNC_PATH}; df -P .' 2>/dev/null | tail -1 | awk '{print $6}')
- ssh ${RSYNC_USER}@${RSYNC_HOST} "cd ${RSYNC_PATH} && touch .is_xattr_supported && setfattr -n user.comment -v 'File created by ReaR to test if this filesystems supports extended attributes.' .is_xattr_supported && getfattr -n user.comment .is_xattr_supported 1>/dev/null; find .is_xattr_supported -empty -delete" \
+ remote_mountpoint=$(ssh $(rsync_remote_ssh "$BACKUP_URL") 'cd ${path}; df -P .' 2>/dev/null | tail -1 | awk '{print $6}')
+ ssh $(rsync_remote_ssh "$BACKUP_URL") "cd ${path} && touch .is_xattr_supported && setfattr -n user.comment -v 'File created by ReaR to test if this filesystems supports extended attributes.' .is_xattr_supported && getfattr -n user.comment .is_xattr_supported 1>/dev/null; find .is_xattr_supported -empty -delete" \
|| Error "Remote file system $remote_mountpoint does not have user_xattr mount option set!"
#BACKUP_RSYNC_OPTIONS+=( --xattrs --rsync-path="rsync --fake-super" )
# see issue #366 for explanation of removing --xattrs
BACKUP_RSYNC_OPTIONS+=( --rsync-path="rsync --fake-super" )
fi
else
- Error "rsync --fake-super not possible on system ($RSYNC_HOST) (please upgrade rsync to 3.x)"
+ Error "rsync --fake-super not possible on system ($host) (please upgrade rsync to 3.x)"
fi
fi
diff --git a/usr/share/rear/restore/RSYNC/default/400_restore_rsync_backup.sh b/usr/share/rear/restore/RSYNC/default/400_restore_rsync_backup.sh
index 993088be..0fa08587 100644
--- a/usr/share/rear/restore/RSYNC/default/400_restore_rsync_backup.sh
+++ b/usr/share/rear/restore/RSYNC/default/400_restore_rsync_backup.sh
@@ -7,7 +7,11 @@ get_size() {
local backup_prog_rc
local restore_log_message
-LogPrint "Restoring $BACKUP_PROG backup from '${RSYNC_HOST}:${RSYNC_PATH}'"
+local host path
+host="$(rsync_host "$BACKUP_URL")"
+path="$(rsync_path "$BACKUP_URL")"
+
+LogPrint "Restoring $BACKUP_PROG backup from '${host}:${path}'"
ProgressStart "Restore operation"
(
@@ -15,18 +19,18 @@ ProgressStart "Restore operation"
(rsync)
- case $RSYNC_PROTO in
+ case $(rsync_proto "$BACKUP_URL") in
(ssh)
- Log $BACKUP_PROG "${BACKUP_RSYNC_OPTIONS[@]}" "${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PATH}/${RSYNC_PREFIX}/backup"/ $TARGET_FS_ROOT/
+ Log $BACKUP_PROG "${BACKUP_RSYNC_OPTIONS[@]}" "$(rsync_remote_full "$BACKUP_URL")/backup"/ $TARGET_FS_ROOT/
$BACKUP_PROG "${BACKUP_RSYNC_OPTIONS[@]}" \
- "${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PATH}/${RSYNC_PREFIX}/backup"/ \
+ "$(rsync_remote_full "$BACKUP_URL")/backup"/ \
$TARGET_FS_ROOT/
;;
(rsync)
$BACKUP_PROG "${BACKUP_RSYNC_OPTIONS[@]}" \
- "${RSYNC_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/${RSYNC_PATH}/${RSYNC_PREFIX}/backup"/ $TARGET_FS_ROOT/
+ "$(rsync_remote_full "$BACKUP_URL")/backup"/ $TARGET_FS_ROOT/
;;
esac
diff --git a/usr/share/rear/verify/RSYNC/default/550_check_remote_backup_archive.sh b/usr/share/rear/verify/RSYNC/default/550_check_remote_backup_archive.sh
index b2fb72f5..76132794 100644
--- a/usr/share/rear/verify/RSYNC/default/550_check_remote_backup_archive.sh
+++ b/usr/share/rear/verify/RSYNC/default/550_check_remote_backup_archive.sh
@@ -1,14 +1,14 @@
# check the backup archive on remote rsync server
-case $RSYNC_PROTO in
+case $(rsync_proto "$BACKUP_URL") in
(ssh)
- ssh ${RSYNC_USER}@${RSYNC_HOST} "ls -ld ${RSYNC_PATH}/${RSYNC_PREFIX}/backup" >/dev/null 2>&1 \
- || Error "Archive not found on [$RSYNC_USER@$RSYNC_HOST:${RSYNC_PATH}/${RSYNC_PREFIX}]"
+ ssh $(rsync_remote_ssh "$BACKUP_URL") "ls -ld $(rsync_path_full "$BACKUP_URL")/backup" >/dev/null 2>&1 \
+ || Error "Archive not found on [$(rsync_remote_full "$BACKUP_URL")]"
;;
(rsync)
- $BACKUP_PROG "${RSYNC_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/${RSYNC_PATH}/${RSYNC_PREFIX}/backup" >/dev/null 2>&1 \
- || Error "Archive not found on [$RSYNC_USER@$RSYNC_HOST:${RSYNC_PATH}/${RSYNC_PREFIX}]"
+ $BACKUP_PROG "$(rsync_remote_full "$BACKUP_URL")/backup" >/dev/null 2>&1 \
+ || Error "Archive not found on [$(rsync_remote_full "$BACKUP_URL")]"
;;
esac

View File

@ -1,27 +1,21 @@
# this is purely a shell script, so no debug packages %define debug_package %{nil}
%global debug_package %{nil}
Summary: Relax-and-Recover is a Linux disaster recovery and system migration tool
Name: rear Name: rear
Version: 2.6 Version: 2.6
Release: 27%{?dist} Release: 12%{?dist}
Summary: Relax-and-Recover is a Linux disaster recovery and system migration tool
URL: http://relax-and-recover.org/
License: GPLv3 License: GPLv3
Group: Applications/File
URL: http://relax-and-recover.org/
Source0: https://github.com/rear/rear/archive/%{version}.tar.gz#/rear-%{version}.tar.gz Source0: https://github.com/rear/rear/archive/%{version}.tar.gz#/rear-%{version}.tar.gz
# Add cronjob and systemd timer as documentation
Source1: rear.cron
Source2: rear.service
Source3: rear.timer
# Skip buildin modules, RHBZ#1831311
Patch0: 0001-skip-kernel-buildin-modules.patch
Patch4: rear-bz1492177-warning.patch Patch4: rear-bz1492177-warning.patch
Patch29: rear-bz1832394.patch Patch29: rear-bz1832394.patch
Patch30: rear-sfdc02772301.patch Patch30: rear-sfdc02772301.patch
Patch31: rear-bz1945869.patch Patch31: rear-bz1945869.patch
Patch32: rear-bz1958247.patch Patch32: rear-bz1958247.patch
Patch33: rear-bz1930662.patch Patch33: rear-bz1930662.patch
Patch34: rear-tmpdir.patch Patch34: rear-asciidoc.patch
Patch35: rear-bz1983013.patch Patch35: rear-bz1983013.patch
Patch36: rear-bz1993296.patch Patch36: rear-bz1993296.patch
Patch37: rear-bz1747468.patch Patch37: rear-bz1747468.patch
@ -32,25 +26,19 @@ Patch41: rear-bz2035939.patch
Patch42: rear-bz2083272.patch Patch42: rear-bz2083272.patch
Patch43: rear-bz2111049.patch Patch43: rear-bz2111049.patch
Patch44: rear-bz2104005.patch Patch44: rear-bz2104005.patch
Patch45: rear-bz2097437.patch
Patch46: rear-bz2096916.patch
Patch47: rear-bz2096900.patch
Patch48: rear-bz2111059.patch Patch48: rear-bz2111059.patch
Patch49: rsync-output.patch Patch49: pxe-rsync-output.patch
Patch50: rear-bz2119501.patch Patch50: rear-bz2119501.patch
Patch51: rear-bz2120736.patch Patch51: rear-bz2120736.patch
Patch52: rear-bz2117937.patch Patch52: rear-bz2091163.patch
Patch53: rear-bz2091163.patch Patch53: rear-bz2130945.patch
Patch54: rear-bz2130945.patch Patch54: rear-bz2131946.patch
Patch55: rear-bz2131946.patch
Patch56: s390-no-clobber-disks.patch Patch56: s390-no-clobber-disks.patch
Patch57: rear-bz2188593-nbu-systemd.patch
Patch58: rear-device-shrinking-bz2223895.patch Patch58: rear-device-shrinking-bz2223895.patch
Patch59: rear-usb-uefi-part-size-bz2228402.patch Patch59: rear-usb-uefi-part-size-bz2228402.patch
Patch60: rear-luks-key-bz2228779.patch Patch60: rear-luks-key-bz2228779.patch
Patch61: rear-uefi-usb-secureboot-bz2196445.patch Patch61: rear-uefi-usb-secureboot-bz2196445.patch
Patch62: rear-vg-command-not-found-bz2121476.patch Patch62: rear-vg-command-not-found-bz2121476.patch
Patch63: rear-remove-lvmdevices-bz2145014.patch
Patch64: rear-save-lvm-poolmetadatasize-RHEL-6984.patch Patch64: rear-save-lvm-poolmetadatasize-RHEL-6984.patch
Patch65: rear-skip-useless-xfs-mount-options-RHEL-10478.patch Patch65: rear-skip-useless-xfs-mount-options-RHEL-10478.patch
@ -62,93 +50,52 @@ Patch111: rear-CVE-2024-23301.patch
# https://github.com/rear/rear/pull/3145 # https://github.com/rear/rear/pull/3145
Patch113: rear-restore-hybrid-bootloader-RHEL-16864.patch Patch113: rear-restore-hybrid-bootloader-RHEL-16864.patch
# Resolve libs for executable links in COPY_AS_IS
# https://github.com/rear/rear/commit/9f859c13f5ba285cd1d5983c9b595975c21888d3
Patch114: rear-resolve-libraries-for-symlinks-in-COPY_AS_IS-RHEL-15108.patch
# Skip invalid disk drives (zero sized, no media) when saving layout # Skip invalid disk drives (zero sized, no media) when saving layout
# https://github.com/rear/rear/commit/808b15a677191aac62faadd1bc71885484091316 # https://github.com/rear/rear/commit/808b15a677191aac62faadd1bc71885484091316
Patch115: rear-skip-invalid-drives-RHEL-22863.patch Patch115: rear-skip-invalid-drives-RHEL-22863.patch
# Fix useless warning that libsystemd-core requires additional libraries ### Dependencies on all distributions
# and ReaR recovery system needs additional libraries BuildRequires: asciidoc
# https://github.com/rear/rear/pull/3250 Requires: binutils
Patch116: rear-fix-libsystemd-ldd-warning.patch Requires: ethtool
Requires: gzip
Requires: iputils
Requires: parted
Requires: tar
Requires: openssl
Requires: gawk
Requires: attr
Requires: bc
Requires: file
Requires: dhcp-client
# Fix IPv6 addresses in nfs:// and sshfs:// BACKUP/OUTPUT_URL ### If you require NFS, you may need the below packages
# https://github.com/rear/rear/pull/3242 #Requires: nfsclient portmap rpcbind
Patch117: rear-fix-ipv6.patch
# Remove obsolete FAT16 options to avoid kernel warning ### We drop LSB requirements because it pulls in too many dependencies
# https://github.com/rear/rear/pull/2576 ### The OS is hardcoded in /etc/rear/os.conf instead
Patch118: rear-no-fat-16.patch #Requires: redhat-lsb
# Install GRUB on multipath disks ### Required for Bacula/MySQL support
# https://github.com/rear/rear/pull/3334 #Requires: bacula-mysql
Patch119: rear-multipath-bios-grub.patch
# Improve docs of layout configuration in user guide ### Required for OBDR
# https://github.com/rear/rear/pull/3125 #Requires: lsscsi sg3_utils
Patch121: rear-improve-layout-guide.patch
# skip longhorn iscsi devices in disklayout.conf ### Optional requirement
# https://github.com/rear/rear/commit/d765abff976a8346ce6afa432c9a09d67ed63482 #Requires: cfg2html
Patch122: rear-skip-longhorn-iscsi-RHEL-83551.patch
# fix PPC PReP Boot detection on GPT layouts %ifarch x86_64 i686
# https://github.com/rear/rear/commit/1ca518c2a0e675ace956ef71bc79d67e4990562b Requires: syslinux
Patch123: rear-detect-prep-boot-on-gpt-RHEL-82098.patch
# fix recovery of LUKS encrypted systems with multiple keyslots
# https://github.com/rear/rear/commit/e9ce93f096e505968cc728a7eb5a06e25dc8d88b
Patch124: rear-support-multi-keyslot-luks-RHEL-83776.patch
# support generation of ed25519 SSH host keys in the rescue image
# https://github.com/rear/rear/commit/62d9a744ff710de34035ce15bd1b1bf810b6934a
Patch125: rear-rescue-ed25519-hostkey-support-RHEL-83479.patch
# enhance the 300_map_disks.sh script to also print the disk sizes
# https://github.com/rear/rear/commit/43d62fdfcac50b35be4f99d45bac3b5340525a7a
Patch126: rear-print-disk-mapping-with-sizes-RHEL-83241.patch
# add initial support for arm/aarch64 machines with UEFI
# https://github.com/rear/rear/commit/9b28f14fad26ff00a6f90b13c3e4906d85f3ae3c
Patch127: rear-support-aarch64-uefi-RHEL-56045.patch
######################
# downstream patches #
######################
# additional fixes for NBU support
Patch206: rear-nbu-RHEL-17390-RHEL-17393.patch
# support "export TMPDIR" again, temporarily, with a warning.
Patch207: rear-support-export-TMPDIR.patch
# error out if any unsupported OUTPUT used on s390
Patch208: rear-error-output-s390x-RHEL-99362.patch
# rear contains only bash scripts plus documentation so that on first glance it could be "BuildArch: noarch"
# but actually it is not "noarch" because it only works on those architectures that are explicitly supported.
# Of course the rear bash scripts can be installed on any architecture just as any binaries can be installed on any architecture.
# But the meaning of architecture dependent packages should be on what architectures they will work.
# Therefore only those architectures that are actually supported are explicitly listed.
# This avoids that rear can be "just installed" on architectures that are actually not supported:
ExclusiveArch: %ix86 x86_64 ppc ppc64 ppc64le ia64 s390x %arm aarch64
# Furthermore for some architectures it requires architecture dependent packages (like syslinux for x86 and x86_64)
# so that rear must be architecture dependent because ifarch conditions never match in case of "BuildArch: noarch"
# see the GitHub issue https://github.com/rear/rear/issues/629
%ifarch %ix86 x86_64
Requires: syslinux-extlinux
%endif %endif
# See https://github.com/rhboot/efi-rpm-macros/blob/main/README %ifarch x86_64 i686 aarch64
%ifarch %{efi}
# We need mkfs.vfat for recreating EFI System Partition # We need mkfs.vfat for recreating EFI System Partition
Recommends: dosfstools Recommends: dosfstools
# Needed for ISO image creation
Recommends: grub2-efi-%{efi_arch}-modules
Recommends: grub2-tools-extra
%endif %endif
%ifarch ppc ppc64
Requires: yaboot
%endif
%ifarch ppc ppc64 ppc64le %ifarch ppc ppc64 ppc64le
# Called by grub2-install (except on PowerNV) # Called by grub2-install (except on PowerNV)
Requires: /usr/sbin/ofpathname Requires: /usr/sbin/ofpathname
@ -160,38 +107,26 @@ Requires: /usr/sbin/bootlist
Requires: s390utils-base Requires: s390utils-base
Requires: s390utils-core Requires: s390utils-core
%endif %endif
# In the end this should tell the user that rear is known to work only on ix86 x86_64 ppc ppc64 ppc64le ia64
# and on ix86 x86_64 syslinux is explicitly required to make the bootable ISO image
# (in addition to the default installed bootloader grub2) while on ppc ppc64 the
# default installed bootloader yaboot is also useed to make the bootable ISO image.
BuildRequires: efi-srpm-macros Requires: crontabs
# Required for HTML user guide
BuildRequires: make
BuildRequires: asciidoctor
### Mandatory dependencies:
Requires: binutils
Requires: ethtool
Requires: gzip
Requires: iputils
Requires: parted
Requires: tar
Requires: openssl
Requires: gawk
Requires: attr
Requires: bc
Requires: iproute Requires: iproute
# No ISO image support on s390x (may change when we add support for LPARs) # No ISO image support on s390x (may change when we add support for LPARs)
%ifnarch s390x %ifnarch s390x
Requires: xorriso Requires: xorriso
%endif %endif
Requires: file
Requires: dhcp-client # mingetty is not available anymore with RHEL 7 (use agetty instead via systemd)
%if 0%{?rhel} # Note that CentOS also has rhel defined so there is no need to use centos
%if 0%{?rhel} && 0%{?rhel} > 6
Requires: util-linux
%else
Requires: mingetty
Requires: util-linux Requires: util-linux
%endif %endif
### The rear-snapshot package is no more
#Obsoletes: rear-snapshot
%description %description
Relax-and-Recover is the leading Open Source disaster recovery and system Relax-and-Recover is the leading Open Source disaster recovery and system
migration solution. It comprises of a modular migration solution. It comprises of a modular
@ -203,7 +138,7 @@ a migration tool as well.
Currently Relax-and-Recover supports various boot media (incl. ISO, PXE, Currently Relax-and-Recover supports various boot media (incl. ISO, PXE,
OBDR tape, USB or eSATA storage), a variety of network protocols (incl. OBDR tape, USB or eSATA storage), a variety of network protocols (incl.
sftp, ftp, http, nfs, cifs) as well as a multitude of backup strategies sftp, ftp, http, nfs, cifs) as well as a multitude of backup strategies
(incl. IBM TSM, MircroFocus Data Protector, Symantec NetBackup, EMC NetWorker, (incl. IBM TSM, HP DataProtector, Symantec NetBackup, EMC NetWorker,
Bacula, Bareos, BORG, Duplicity, rsync). Bacula, Bareos, BORG, Duplicity, rsync).
Relax-and-Recover was designed to be easy to set up, requires no maintenance Relax-and-Recover was designed to be easy to set up, requires no maintenance
@ -212,108 +147,93 @@ removes any excuse for not having a disaster recovery solution implemented.
Professional services and support are available. Professional services and support are available.
#-- PREP, BUILD & INSTALL -----------------------------------------------------# %pre
if [ $1 -gt 1 ] ; then
# during upgrade remove obsolete directories
%{__rm} -rf %{_datadir}/rear/output/NETFS
fi
%prep %prep
%autosetup -p1 %setup
%patch4 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
%patch51 -p1
%patch52 -p1
%patch53 -p1
%patch54 -p1
%patch56 -p1
%patch58 -p1
%patch59 -p1
%patch60 -p1
%patch61 -p1
%patch62 -p1
%patch64 -p1
%patch65 -p1
%patch111 -p1
%patch113 -p1
%patch115 -p1
echo "30 1 * * * root test -f /var/lib/rear/layout/disklayout.conf && /usr/sbin/rear checklayout || /usr/sbin/rear mkrescue" >rear.cron
### Add a specific os.conf so we do not depend on LSB dependencies ### Add a specific os.conf so we do not depend on LSB dependencies
%{?fedora:echo -e "OS_VENDOR=Fedora\nOS_VERSION=%{?fedora}" >etc/rear/os.conf} %{?fedora:echo -e "OS_VENDOR=Fedora\nOS_VERSION=%{?fedora}" >etc/rear/os.conf}
%{?rhel:echo -e "OS_VENDOR=RedHatEnterpriseServer\nOS_VERSION=%{?rhel}" >etc/rear/os.conf} %{?rhel:echo -e "OS_VENDOR=RedHatEnterpriseServer\nOS_VERSION=%{?rhel}" >etc/rear/os.conf}
# Change /lib to /usr/lib for COPY_AS_IS
sed -E -e "s:([\"' ])/lib:\1/usr/lib:g" \
-i usr/share/rear/prep/GNU/Linux/*include*.sh
# Same for Linux.conf
sed -e 's:/lib/:/usr/lib/:g' \
-e 's:/lib\*/:/usr/lib\*/:g' \
-e 's:/usr/usr/lib:/usr/lib:g' \
-i 'usr/share/rear/conf/GNU/Linux.conf'
%build %build
# build HTML user guide
# asciidoc writes a timestamp to files it produces, based on the last # asciidoc writes a timestamp to files it produces, based on the last
# modified date of the source file, but is sensitive to the timezone. # modified date of the source file, but is sensible to the timezone.
# This makes the results differ according to the timezone of the build machine # This makes the results differ according to the timezone of the build machine
# and spurious changes will be seen. # and spurious changes will be seen.
# Set the timezone to UTC as a workaround. # Set the timezone to UTC as a workaround.
# https://wiki.debian.org/ReproducibleBuilds/TimestampsInDocumentationGeneratedByAsciidoc # https://wiki.debian.org/ReproducibleBuilds/TimestampsInDocumentationGeneratedByAsciidoc
TZ=UTC make doc TZ=UTC %{__make} -C doc
%install %install
%{make_install} %{__rm} -rf %{buildroot}
install -p -d %{buildroot}%{_docdir}/%{name}/ %{__make} install DESTDIR="%{buildroot}"
install -m 0644 %{SOURCE1} %{buildroot}%{_docdir}/%{name}/ %{__install} -Dp -m0644 rear.cron %{buildroot}%{_sysconfdir}/cron.d/rear
install -m 0644 %{SOURCE2} %{buildroot}%{_docdir}/%{name}/
install -m 0644 %{SOURCE3} %{buildroot}%{_docdir}/%{name}/
#-- FILES ---------------------------------------------------------------------#
%files %files
%doc MAINTAINERS COPYING README.adoc doc/*.txt doc/user-guide/*.html %defattr(-, root, root, 0755)
%doc MAINTAINERS COPYING README.adoc doc/*.txt doc/user-guide/relax-and-recover-user-guide.html
%doc %{_mandir}/man8/rear.8* %doc %{_mandir}/man8/rear.8*
%doc %{_docdir}/%{name}/rear.* %config(noreplace) %{_sysconfdir}/cron.d/rear
%config(noreplace) %{_sysconfdir}/rear/ %config(noreplace) %{_sysconfdir}/rear/
%config(noreplace) %{_sysconfdir}/rear/cert/
%{_datadir}/rear/ %{_datadir}/rear/
%{_sharedstatedir}/rear/ %{_localstatedir}/lib/rear/
%{_sbindir}/rear %{_sbindir}/rear
#-- CHANGELOG -----------------------------------------------------------------#
%changelog %changelog
* Thu Aug 14 2025 Pavel Cahyna <pcahyna@redhat.com> - 2.6-27 * Wed Feb 21 2024 Pavel Cahyna <pcahyna@redhat.com> - 2.6-12
- add dependency on grub2-tools-extra and GRUB EFI modules on EFI machines
- add dependency on syslinux-extlinux on x86
- add initial support for aarch64 machines with UEFI
- enhance the 300_map_disks.sh script to also print the disk sizes
- support generation of ed25519 SSH host keys in the rescue image
- create sshd home directory in the rescue image on systems upgraded from EL8
- fix recovery of LUKS encrypted systems with multiple keyslots
- fix PPC PReP Boot detection on GPT layouts
- skip longhorn iscsi devices in disklayout.conf
- error out if any unsupported OUTPUT used on s390x
* Tue Feb 11 2025 Pavel Cahyna <pcahyna@redhat.com> - 2.6-26
- Install GRUB on multipath disks, PR 3334
- Improve docs of layout configuration in user guide, PR 3125
* Sat Jul 20 2024 Pavel Cahyna <pcahyna@redhat.com> - 2.6-25
- Backport PR 3250 to fix useless warning that libsystemd-core requires
additional libraries and ReaR recovery system needs additional libraries
- Backport PR 3242 to fix IPv6 address in nfs:// and sshfs:// BACKUP/OUTPUT_URL
- Backport PR 2576 to remove obsolete FAT16 options to avoid kernel warning
* Sat Feb 24 2024 Pavel Cahyna <pcahyna@redhat.com> - 2.6-24
- Support "export TMPDIR" in user configuration again, print a warning
when this is used - revert commit f464eae2, adapt PR 3163, add commit
b422845f.
Will be supported only until the update to 2.7
* Fri Feb 9 2024 Pavel Cahyna <pcahyna@redhat.com> - 2.6-23
- Resolve libs for executable links in COPY_AS_IS, PR 3073
- Skip invalid disk drives when saving layout PR 3047 - Skip invalid disk drives when saving layout PR 3047
* Thu Feb 8 2024 Pavel Cahyna <pcahyna@redhat.com> - 2.6-22
- Do not delete NetBackup logs in case of errors and save
/usr/openv/netbackup/logs to the restored system after a successful recovery
- Add /usr/openv/var to COPY_AS_IS_NBU, fixes an issue seen
with NetBackup 10.2.0.1
* Thu Feb 8 2024 Pavel Cahyna <pcahyna@redhat.com> - 2.6-21
- Support saving and restoring hybrid BIOS/UEFI bootloader, PRs 3145 3136 - Support saving and restoring hybrid BIOS/UEFI bootloader, PRs 3145 3136
- make initrd accessible only by root (CVE-2024-23301), PR 3123 - make initrd accessible only by root (CVE-2024-23301), PR 3123
* Fri Dec 1 2023 Pavel Cahyna <pcahyna@redhat.com> - 2.6-20
- Backport PR 3061 to save LVM pool metadata volume size in disk layout - Backport PR 3061 to save LVM pool metadata volume size in disk layout
and restore it and restore it
- Backport PR 3058 to skip useless xfs mount options when mounting - Backport PR 3058 to skip useless xfs mount options when mounting
during recovery, prevents mount errors like "logbuf size must be greater during recovery, prevents mount errors like "logbuf size must be greater
than or equal to log stripe size" than or equal to log stripe size"
* Fri Aug 25 2023 Pavel Cahyna <pcahyna@redhat.com> - 2.6-19 * Tue Aug 22 2023 Pavel Cahyna <pcahyna@redhat.com> - 2.6-10
- Add patch to force removal of lvmdevices, prevents LVM problems after
restoring to different disks/cloning. Upstream PR 3043
* Tue Aug 22 2023 Pavel Cahyna <pcahyna@redhat.com> - 2.6-18
- Add patch to start rsyslog and include NBU systemd units
- Apply PR 3027 to ensure correct creation of the rescue environment - Apply PR 3027 to ensure correct creation of the rescue environment
when a file is shrinking while being read when a file is shrinking while being read
- Backport PR 2774 to increase USB_UEFI_PART_SIZE to 1024 MiB - Backport PR 2774 to increase USB_UEFI_PART_SIZE to 1024 MiB
@ -322,59 +242,64 @@ install -m 0644 %{SOURCE3} %{buildroot}%{_docdir}/%{name}/
- Backport upstream PR 3031: Secure Boot support for OUTPUT=USB - Backport upstream PR 3031: Secure Boot support for OUTPUT=USB
- Correct a mistake done when backporting PR 2691 - Correct a mistake done when backporting PR 2691
* Wed Feb 22 2023 Pavel Cahyna <pcahyna@redhat.com> - 2.6-17 * Wed Feb 22 2023 Pavel Cahyna <pcahyna@redhat.com> - 2.6-9
- Backport PR2943 to fix s390x dasd formatting - Backport PR2943 to fix s390x dasd formatting
- Require s390utils-{core,base} on s390x - Require s390utils-{core,base} on s390x
* Sun Jan 15 2023 Pavel Cahyna <pcahyna@redhat.com> - 2.6-16 * Sun Jan 15 2023 Pavel Cahyna <pcahyna@redhat.com> - 2.6-8
- Apply PR2903 to protect against colons in pvdisplay output - Apply PR2903 to protect against colons in pvdisplay output
- Apply PR2873 to fix initrd regeneration on s390x - Apply PR2873 to fix initrd regeneration on s390x
- Apply PR2431 to migrate XFS configuration files - Apply PR2431 to migrate XFS configuration files
* Thu Aug 25 2022 Pavel Cahyna <pcahyna@redhat.com> - 2.6-15 * Wed Aug 24 2022 Pavel Cahyna <pcahyna@redhat.com> - 2.6-7
- Exclude /etc/lvm/devices from the rescue system to work around a segfault
in lvm pvcreate
* Wed Aug 24 2022 Pavel Cahyna <pcahyna@redhat.com> - 2.6-14
- Avoid stderr message about irrelevant broken links - Avoid stderr message about irrelevant broken links
- Changes for NetBackup (NBU) 9.x support - Changes for NetBackup (NBU) 9.x support
* Tue Aug 9 2022 Pavel Cahyna <pcahyna@redhat.com> - 2.6-13 * Tue Aug 9 2022 Pavel Cahyna <pcahyna@redhat.com> - 2.6-6
- Backport PR2831 - rsync URL refactoring - Restore usr/share/rear/output/PXE/default/820_copy_to_net.sh
fixes rsync OUTPUT_URL when different from BACKUP_URL removed in 2.4-19 with rsync refactor.
It is still needed to use a rsync OUTPUT_URL when OUTPUT=PXE and BACKUP=RSYNC
* Mon Aug 8 2022 Pavel Cahyna <pcahyna@redhat.com> - 2.6-12 * Mon Aug 8 2022 Pavel Cahyna <pcahyna@redhat.com> - 2.6-5
- Apply PR2795 to detect changes in system files between backup - Apply PR2795 to detect changes in system files between backup
and rescue image and rescue image
- Apply PR2808 to exclude dev/watchdog* from recovery system - Apply PR2808 to exclude dev/watchdog* from recovery system
- Backport upstream PRs 2827 and 2839 to pass -y to lvcreate instead of one "y" - Backport upstream PRs 2827 and 2839 to pass -y to lvcreate instead of one "y"
on stdin on stdin
- Apply PR2811 to add the PRE/POST_RECOVERY_COMMANDS directives - Apply PR2811 to add the PRE/POST_RECOVERY_COMMANDS directives
- Recommend dosfstools on x86_64, needed for EFI System Partition - Recommend dosfstools on x86 and aarch64, needed for EFI System Partition
- Backport PR2825 to replace defunct mkinitrd with dracut
- Apply PR2580 to load the nvram module in the rescue environment in order
to be able to set the boot order on ppc64le LPARs
- Backport PR2822 to include the true vi executable in rescue ramdisk
* Sun Feb 27 2022 Pavel Cahyna <pcahyna@redhat.com> - 2.6-11 * Sun Feb 27 2022 Pavel Cahyna <pcahyna@redhat.com> - 2.6-4
- Apply PR2675 to fix leftover temp dir bug (introduced in backported PR2625) - Apply PR2675 to fix leftover temp dir bug (introduced in backported PR2625)
- Apply PR2603 to ignore unused PV devices - Apply PR2603 to ignore unused PV devices
- Apply upstream PR2750 to avoid exclusion of wanted multipath devices - Apply upstream PR2750 to avoid exclusion of wanted multipath devices
- Remove unneeded xorriso dep on s390x (no ISO image support there) - Remove unneeded xorriso dep on s390x (no ISO image support there)
- Apply upstream PR2736 to add the EXCLUDE_{IP_ADDRESSES,NETWORK_INTERFACES} - Apply upstream PR2736 to add the EXCLUDE_{IP_ADDRESSES,NETWORK_INTERFACES}
options options
* Mon Aug 30 2021 Pavel Cahyna <pcahyna@redhat.com> - 2.6-3
- Add patch for better handling of thin pools and other LV types not supported - Add patch for better handling of thin pools and other LV types not supported
by vgcfgrestore by vgcfgrestore
Resolves: rhbz1747468
* Mon Aug 16 2021 Pavel Cahyna <pcahyna@redhat.com> - 2.6-10 * Mon Aug 16 2021 Pavel Cahyna <pcahyna@redhat.com> - 2.6-2
- Sync spec changes and downstream patches from RHEL 8 rear-2.6-2
- Fix multipath performance regression in 2.6, introduced by upstream PR #2299. - Fix multipath performance regression in 2.6, introduced by upstream PR #2299.
Resolves: rhbz1993296 Resolves: rhbz1993296
* Sat Aug 7 2021 Pavel Cahyna <pcahyna@redhat.com> - 2.6-1
- Rebase to upstream release 2.6 and drop unneded patches.
Add S/390 support.
Resolves: rhbz1983003, rhbz1988493, rhbz1868421
- Add missing dependencies on dhcp-client (see #1926451), file
- Patch documents to be compatible with asciidoc,
we don't have asciidoctor
- On POWER add bootlist & ofpathname to the list of required programs - On POWER add bootlist & ofpathname to the list of required programs
conditionally (bootlist only if running under PowerVM, ofpathname conditionally (bootlist only if running under PowerVM, ofpathname
always except on PowerNV) - upstream PR2665, add them to package always except on PowerNV) - upstream PR2665, add them to package
dependencies dependencies
Resolves: rhbz1983013 Resolves: rhbz1983013
* Tue May 11 2021 Pavel Cahyna <pcahyna@redhat.com> - 2.4-19
- Backport PR2608: - Backport PR2608:
Fix setting boot path in case of UEFI partition (ESP) on MD RAID Fix setting boot path in case of UEFI partition (ESP) on MD RAID
Resolves: rhbz1945869 Resolves: rhbz1945869
@ -382,65 +307,187 @@ install -m 0644 %{SOURCE3} %{buildroot}%{_docdir}/%{name}/
Prevents accidental backup removal in case of errors Prevents accidental backup removal in case of errors
Resolves: rhbz1958247 Resolves: rhbz1958247
- Fix rsync error and option handling - Fix rsync error and option handling
Fixes metadata storage when rsync user is not root
Resolves: rhbz1930662 Resolves: rhbz1930662
* Wed Aug 11 2021 Pavel Cahyna <pcahyna@redhat.com> - 2.6-9 * Mon Jan 11 2021 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.4-18
- Put TMPDIR on /var/tmp by default, otherwise it may lack space - Fix typo in default.conf
RHBZ #1988420, upstream PR2664 Resolves: #1882060
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 2.6-8
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Wed Jun 30 2021 Pavel Cahyna <pcahyna@redhat.com> - 2.6-7
- Sync spec changes and downstream patches from RHEL 8
- Require xorriso instead of genisoimage
- Add S/390 support and forgotten dependency on the file utility
- Backport upstream code related to LUKS2 support
- Modify the cron command to avoid an e-mail with error message after - Modify the cron command to avoid an e-mail with error message after
ReaR is installed but not properly configured when the cron command ReaR is installed but not properly configured when the cron command
is triggered for the first time is triggered for the first time
Resolves: #1729499
- Backport upstream code related to LUKS2 support
Resolves: #1832394
- Changes for NetBackup (NBU) support, upstream PR2544 - Changes for NetBackup (NBU) support, upstream PR2544
- Add dependency on dhcp-client, RHBZ #1926451 Resolves: #1898080
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 2.6-6 * Mon Aug 10 2020 Pavel Cahyna <pcahyna@redhat.com> - 2.4-17
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 - Update the Rubrik patch to include complete PR2445
Resolves: rhbz1867696
* Fri Feb 26 2021 Christopher Engelhard <ce@lcts.de> - 2.6-5 * Thu Jun 04 2020 Václav Doležal <vdolezal@redhat.com> - 2.4-16
- Change /lib to /usr/lib in scripts to fix RHBZ #1931112 - Apply upstream PR2373: Skip Longhorn Engine replica devices
Resolves: rhbz1843809
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.6-4 * Mon Jun 01 2020 Václav Doležal <vdolezal@redhat.com> - 2.4-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - Apply upstream PR2346: Have '-iso-level 3' option also for ppc64le
Resolves: rhbz1729502
* Wed Sep 23 2020 Christopher Engelhard <ce@lcts.de> - 2.6-3 * Mon Jun 01 2020 Václav Doležal <vdolezal@redhat.com> - 2.4-14
- Stop auto-creating a cronjob, but ship example cronjob/ - Backport remaining Rubrik related patches.
systemd timer units in docdir instead (upstream issue #1829) Related: rhbz1743303
- Build & ship HTML user guide
- Remove %pre scriptlet, as it was introduced only to fix a
specific upgrade issue with v1.15 in 2014
* Tue Sep 22 2020 Christopher Engelhard <ce@lcts.de> - 2.6-2 * Thu May 21 2020 Václav Doležal <vdolezal@redhat.com> - 2.4-13
- Backport upstream PR#2469 to fix RHBZ #1831311 - Backport upstream PR #2249 to add support for Rubrik backup method.
Resolves: rhbz1743303
* Tue Sep 22 2020 Christopher Engelhard <ce@lcts.de> - 2.6-1 * Mon Dec 16 2019 Pavel Cahyna <pcahyna@redhat.com> - 2.4-12
- Update to 2.6 - Backport upstream PR #2293 to use grub-mkstandalone instead of
- Streamline & clean up spec file grub-mkimage for UEFI (ISO image and GRUB_RESCUE image generation).
Avoids hardcoded module lists or paths and so is more robust.
Fixes an issue where the generated ISO image had no GRUB2 modules and
was therefore unbootable. The backport does not add new config settings.
Resolves: rhbz1737042
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.4-6 * Mon Nov 18 2019 Pavel Cahyna <pcahyna@redhat.com> - 2.4-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - Apply upstream PR2122: add additional NBU library path to fix support for
NetBackup 8.
Resolves: rhbz1747393
- Apply upstream PR2021: Be safe against empty docker_root_dir (issue 1989)
Resolves: rhbz1729493, where ReaR can not create a backup in rescue mode,
because it thinks that the Docker daemon is running and hits the problem
with empty docker_root_dir.
- Apply upstream PR2223 and commit 36cf20e to avoid an empty string in the
list of users to clone, which can lead to bash overflow with lots of users
and groups per user and to wrong passwd/group files in the rescue system.
Resolves: rhbz1729495
- Backport of Upstream fix for issue 2035: /run is not mounted in the rescue
chroot, which causes LVM to hang, especially if rebuilding initramfs.
Resolves: rhbz1757488
- Backport upstream PR 2218: avoid keeping build dir on errors
by default when used noninteractively
Resolves: rhbz1729501
- Apply upstream PR2173 - Cannot restore using Bacula method
due to "bconsole" not showing its prompt
Resolves: rhbz1726992
- Backport fix for upstream issue 2187 (disklayout.conf file contains
duplicate lines, breaking recovery in migration mode or when
thin pools are used). PR2194, 2196.
Resolves: rhbz1732308
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.4-5 * Tue Jun 4 2019 Pavel Cahyna <pcahyna@redhat.com> - 2.4-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - Apply upstream patch PR1993
Automatically exclude $BUILD_DIR from the backup
Resolves: rhbz1677733
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.4-4 * Mon Jun 3 2019 Pavel Cahyna <pcahyna@redhat.com> - 2.4-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - Update fix for bz#1657725. Previous fix was not correct, bootlist was still
invoked only with one partition argument due to incorrect array expansion.
See upstream PR2096, 2097, 2098.
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.4-3 * Tue May 28 2019 Pavel Cahyna <pcahyna@redhat.com> - 2.4-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - Apply upstream PR2065 (record permanent MAC address for team members)
Resolves: rhbz1685178
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.4-2 * Tue May 28 2019 Pavel Cahyna <pcahyna@redhat.com> - 2.4-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - Apply upstream PR2034 (multipath optimizations for lots of devices)
* Thu Jul 30 2015 Johannes Meixner <jsmeix@suse.de> * Mon Jan 14 2019 Pavel Cahyna <pcahyna@redhat.com> - 2.4-6
- For a changelog see the rear-release-notes.txt file. - Require xorriso instead of genisoimage, it is now the preferred method
and supports files over 4GB in size.
- Apply upstream PR2004 (support for custom network interface naming)
- Backport upstream PR2001 (UEFI support broken on Fedora 29 and RHEL 8)
* Thu Dec 13 2018 Pavel Cahyna <pcahyna@redhat.com> - 2.4-4
- Backport fixes for upstream bugs 1974 and 1975
- Backport fix for upstream bug 1913 (backup succeeds in case of tar error)
- Backport fix for upstream bug 1926 (support for LACP bonding and teaming)
- Apply upstream PR1954 (record permanent MAC address for bond members)
* Thu Aug 09 2018 Pavel Cahyna <pcahyna@redhat.com> - 2.4-3
- Merge some spec changes from Fedora.
- Apply upstream patch PR1887
LPAR/PPC64 bootlist is incorrectly set when having multiple 'prep' partitions
- Apply upstream patch PR1885
Partition information recorded is unexpected when disk has 4K block size
* Wed Jul 18 2018 Pavel Cahyna <pcahyna@redhat.com> - 2.4-2
- Build and install the HTML user guide. #1418459
* Wed Jun 27 2018 Pavel Cahyna <pcahyna@redhat.com> - 2.4-1
- Rebase to version 2.4, drop patches integrated upstream
Resolves #1534646 #1484051 #1498828 #1571266 #1496518
* Wed Feb 14 2018 Pavel Cahyna <pcahyna@redhat.com> - 2.00-6
- Ensure that NetBackup is started automatically upon recovery (PR#1544)
Also do not kill daemons spawned by sysinit.service at the service's end
(PR#1610, applies to NetBackup and also to dhclient)
Resolves #1506231
- Print a warning if grub2-mkimage is about to fail and suggest what to do.
bz#1492177
- Update the patch for #1388653 to the one actually merged upstream (PR1418)
* Fri Jan 12 2018 Pavel Cahyna <pcahyna@redhat.com> - 2.00-5
- cd to the correct directory before md5sum to fix BACKUP_INTEGRITY_CHECK.
Upstream PR#1685, bz1532676
* Mon Oct 23 2017 Pavel Cahyna <pcahyna@redhat.com> - 2.00-4
- Retry get_disk_size to fix upstream #1370, bz1388653
* Wed Sep 13 2017 Pavel Cahyna <pcahyna@redhat.com> - 2.00-3
- Fix rear mkrescue on systems w/o UEFI. Upstream PR#1481 issue#1478
- Resolves: #1479002
* Wed May 17 2017 Jakub Mazanek <jmazanek@redhat.com> - 2.00-2
- Excluding Archs s390 and s390x
- Related #1355667
* Mon Feb 20 2017 Jakub Mazanek <jmazanek@redhat.com> - 2.00-1
- Rebase to version 2.00
- Resolves #1355667
* Tue Jul 19 2016 Petr Hracek <phracek@redhat.com> - 1.17.2-6
- Replace experimental grep -P with grep -E
Resolves: #1290205
* Wed Mar 23 2016 Petr Hracek <phracek@redhat.com> - 1.17.2-5
- Remove backuped patched files
Related: #1283930
* Wed Mar 23 2016 Petr Hracek <phracek@redhat.com> - 1.17.2-4
- Rear recovery over teaming interface will not work
Resolves: #1283930
* Tue Mar 08 2016 Petr Hracek <phracek@redhat.com> - 1.17.2-3
- Replace experimental grep -P with grep -E
Resolves: #1290205
* Tue Feb 23 2016 Petr Hracek <phracek@redhat.com> - 1.17.2-2
- rear does not require syslinux
- changing to arch package so that syslinux is installed
- Resolves: #1283927
* Mon Sep 14 2015 Petr Hracek <phracek@redhat.com> - 1.17.2-1
- New upstream release 1.17.2
Related: #1059196
* Wed May 13 2015 Petr Hracek <phracek@redhat.com> 1.17.0-2
- Fix Source tag
Related: #1059196
* Mon May 04 2015 Petr Hracek <phracek@redhat.com> 1.17.0-1
- Initial package for RHEL 7
Resolves: #1059196
* Fri Oct 17 2014 Gratien D'haese <gratien.dhaese@gmail.com>
- added the suse_version lines to identify the corresponding OS_VERSION
* Fri Jun 20 2014 Gratien D'haese <gratien.dhaese@gmail.com>
- add %%pre section
* Thu Apr 11 2013 Gratien D'haese <gratien.dhaese@gmail.com>
- changes Source
* Thu Jun 03 2010 Dag Wieers <dag@wieers.com>
- Initial package. (using DAR)