import rear-2.6-3.el8

This commit is contained in:
CentOS Sources 2021-11-09 05:02:29 -05:00 committed by Stepan Oksanichenko
parent eda9b4f3c7
commit e28ffcfbe4
35 changed files with 4013 additions and 3502 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/rear-2.4.tar.gz
SOURCES/rear-2.6.tar.gz

View File

@ -1 +1 @@
9f6037ea582635ed78f1dffaa8a7cc5cdc7db37a SOURCES/rear-2.4.tar.gz
13c23ad59254438ffcd0cde6400fd991cbfe194e SOURCES/rear-2.6.tar.gz

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,275 +0,0 @@
diff --git a/usr/share/rear/backup/NETFS/default/500_make_backup.sh b/usr/share/rear/backup/NETFS/default/500_make_backup.sh
index 47266910..7170cda6 100644
--- a/usr/share/rear/backup/NETFS/default/500_make_backup.sh
+++ b/usr/share/rear/backup/NETFS/default/500_make_backup.sh
@@ -67,49 +67,99 @@ else
SPLIT_COMMAND="dd of=$backuparchive"
fi
+# Used by "tar" method to record which pipe command failed
+FAILING_BACKUP_PROG_FILE="$TMP_DIR/failing_backup_prog"
+FAILING_BACKUP_PROG_RC_FILE="$TMP_DIR/failing_backup_prog_rc"
+
LogPrint "Creating $BACKUP_PROG archive '$backuparchive'"
ProgressStart "Preparing archive operation"
(
case "$(basename ${BACKUP_PROG})" in
- # tar compatible programs here
- (tar)
- set_tar_features
- Log $BACKUP_PROG $TAR_OPTIONS --sparse --block-number --totals --verbose \
- --no-wildcards-match-slash --one-file-system \
- --ignore-failed-read "${BACKUP_PROG_OPTIONS[@]}" \
- $BACKUP_PROG_CREATE_NEWER_OPTIONS \
- ${BACKUP_PROG_BLOCKS:+-b $BACKUP_PROG_BLOCKS} "${BACKUP_PROG_COMPRESS_OPTIONS[@]}" \
- -X $TMP_DIR/backup-exclude.txt -C / -c -f - \
- $(cat $TMP_DIR/backup-include.txt) $RUNTIME_LOGFILE \| $BACKUP_PROG_CRYPT_OPTIONS BACKUP_PROG_CRYPT_KEY \| $SPLIT_COMMAND
- $BACKUP_PROG $TAR_OPTIONS --sparse --block-number --totals --verbose \
- --no-wildcards-match-slash --one-file-system \
- --ignore-failed-read "${BACKUP_PROG_OPTIONS[@]}" \
- $BACKUP_PROG_CREATE_NEWER_OPTIONS \
- ${BACKUP_PROG_BLOCKS:+-b $BACKUP_PROG_BLOCKS} "${BACKUP_PROG_COMPRESS_OPTIONS[@]}" \
- -X $TMP_DIR/backup-exclude.txt -C / -c -f - \
- $(cat $TMP_DIR/backup-include.txt) $RUNTIME_LOGFILE | $BACKUP_PROG_CRYPT_OPTIONS $BACKUP_PROG_CRYPT_KEY | $SPLIT_COMMAND
- ;;
- (rsync)
- # make sure that the target is a directory
- mkdir -p $v "$backuparchive" >&2
- Log $BACKUP_PROG --verbose "${BACKUP_RSYNC_OPTIONS[@]}" --one-file-system --delete \
- --exclude-from=$TMP_DIR/backup-exclude.txt --delete-excluded \
- $(cat $TMP_DIR/backup-include.txt) "$backuparchive"
- $BACKUP_PROG --verbose "${BACKUP_RSYNC_OPTIONS[@]}" --one-file-system --delete \
- --exclude-from=$TMP_DIR/backup-exclude.txt --delete-excluded \
- $(cat $TMP_DIR/backup-include.txt) "$backuparchive" >&2
- ;;
- (*)
- Log "Using unsupported backup program '$BACKUP_PROG'"
- Log $BACKUP_PROG "${BACKUP_PROG_COMPRESS_OPTIONS[@]}" \
- $BACKUP_PROG_OPTIONS_CREATE_ARCHIVE $TMP_DIR/backup-exclude.txt \
- "${BACKUP_PROG_OPTIONS[@]}" $backuparchive \
- $(cat $TMP_DIR/backup-include.txt) $RUNTIME_LOGFILE > $backuparchive
- $BACKUP_PROG "${BACKUP_PROG_COMPRESS_OPTIONS[@]}" \
- $BACKUP_PROG_OPTIONS_CREATE_ARCHIVE $TMP_DIR/backup-exclude.txt \
- "${BACKUP_PROG_OPTIONS[@]}" $backuparchive \
- $(cat $TMP_DIR/backup-include.txt) $RUNTIME_LOGFILE > $backuparchive
- ;;
+ # tar compatible programs here
+ (tar)
+ set_tar_features
+ Log $BACKUP_PROG $TAR_OPTIONS --sparse --block-number --totals --verbose \
+ --no-wildcards-match-slash --one-file-system \
+ --ignore-failed-read "${BACKUP_PROG_OPTIONS[@]}" \
+ $BACKUP_PROG_CREATE_NEWER_OPTIONS \
+ ${BACKUP_PROG_BLOCKS:+-b $BACKUP_PROG_BLOCKS} "${BACKUP_PROG_COMPRESS_OPTIONS[@]}" \
+ -X $TMP_DIR/backup-exclude.txt -C / -c -f - \
+ $(cat $TMP_DIR/backup-include.txt) $RUNTIME_LOGFILE \| $BACKUP_PROG_CRYPT_OPTIONS BACKUP_PROG_CRYPT_KEY \| $SPLIT_COMMAND
+
+ # Variable used to record the short name of piped commands in case of
+ # error, e.g. ( "tar" "cat" "dd" ) in case of unencrypted and unsplit backup.
+ backup_prog_shortnames=(
+ "$(basename $(echo "$BACKUP_PROG" | awk '{ print $1 }'))"
+ "$(basename $(echo "$BACKUP_PROG_CRYPT_OPTIONS" | awk '{ print $1 }'))"
+ "$(basename $(echo "$SPLIT_COMMAND" | awk '{ print $1 }'))"
+ )
+ for index in ${!backup_prog_shortnames[@]} ; do
+ [ -n "${backup_prog_shortnames[$index]}" ] || BugError "No computed shortname for pipe component $index"
+ done
+
+ $BACKUP_PROG $TAR_OPTIONS --sparse --block-number --totals --verbose \
+ --no-wildcards-match-slash --one-file-system \
+ --ignore-failed-read "${BACKUP_PROG_OPTIONS[@]}" \
+ $BACKUP_PROG_CREATE_NEWER_OPTIONS \
+ ${BACKUP_PROG_BLOCKS:+-b $BACKUP_PROG_BLOCKS} \
+ "${BACKUP_PROG_COMPRESS_OPTIONS[@]}" \
+ -X $TMP_DIR/backup-exclude.txt -C / -c -f - \
+ $(cat $TMP_DIR/backup-include.txt) $RUNTIME_LOGFILE | \
+ \
+ $BACKUP_PROG_CRYPT_OPTIONS $BACKUP_PROG_CRYPT_KEY | \
+ \
+ $SPLIT_COMMAND
+ pipes_rc=( ${PIPESTATUS[@]} )
+
+ # Exit code logic:
+ # - never return rc=1 (this is reserved for "tar" warning about modified files)
+ # - process exit code in pipe's reverse order
+ # - if last command failed (e.g. "dd"), return an error
+ # - otherwise if previous command failed (e.g. "encrypt"), return an error
+ # ...
+ # - otherwise return "tar" exit code
+ #
+ # When an error occurs, record the program name in $FAILING_BACKUP_PROG_FILE
+ # and real exit code in $FAILING_BACKUP_PROG_RC_FILE.
+
+ let index=${#pipes_rc[@]}-1
+ while [ $index -ge 0 ] ; do
+ rc=${pipes_rc[$index]}
+ if [ $rc -ne 0 ] ; then
+ echo "${backup_prog_shortnames[$index]}" > $FAILING_BACKUP_PROG_FILE
+ echo "$rc" > $FAILING_BACKUP_PROG_RC_FILE
+ if [ $rc -eq 1 ] && [ "${backup_prog_shortnames[$index]}" != "tar" ] ; then
+ rc=2
+ fi
+ exit $rc
+ fi
+ # This pipe command succeeded, check the previous one
+ let index--
+ done
+ # This was a success
+ exit 0
+ ;;
+ (rsync)
+ # make sure that the target is a directory
+ mkdir -p $v "$backuparchive" >&2
+ Log $BACKUP_PROG --verbose "${BACKUP_RSYNC_OPTIONS[@]}" --one-file-system --delete \
+ --exclude-from=$TMP_DIR/backup-exclude.txt --delete-excluded \
+ $(cat $TMP_DIR/backup-include.txt) "$backuparchive"
+ $BACKUP_PROG --verbose "${BACKUP_RSYNC_OPTIONS[@]}" --one-file-system --delete \
+ --exclude-from=$TMP_DIR/backup-exclude.txt --delete-excluded \
+ $(cat $TMP_DIR/backup-include.txt) "$backuparchive" >&2
+ ;;
+ (*)
+ Log "Using unsupported backup program '$BACKUP_PROG'"
+ Log $BACKUP_PROG "${BACKUP_PROG_COMPRESS_OPTIONS[@]}" \
+ $BACKUP_PROG_OPTIONS_CREATE_ARCHIVE $TMP_DIR/backup-exclude.txt \
+ "${BACKUP_PROG_OPTIONS[@]}" $backuparchive \
+ $(cat $TMP_DIR/backup-include.txt) $RUNTIME_LOGFILE > $backuparchive
+ $BACKUP_PROG "${BACKUP_PROG_COMPRESS_OPTIONS[@]}" \
+ $BACKUP_PROG_OPTIONS_CREATE_ARCHIVE $TMP_DIR/backup-exclude.txt \
+ "${BACKUP_PROG_OPTIONS[@]}" $backuparchive \
+ $(cat $TMP_DIR/backup-include.txt) $RUNTIME_LOGFILE > $backuparchive
+ ;;
esac 2> "${TMP_DIR}/${BACKUP_PROG_ARCHIVE}.log"
# important trick: the backup prog is the last in each case entry and the case .. esac is the last command
# in the (..) subshell. As a result the return code of the subshell is the return code of the backup prog!
@@ -121,44 +171,44 @@ sleep 1 # Give the backup software a good chance to start working
# return disk usage in bytes
function get_disk_used() {
- let "$(stat -f -c 'used=(%b-%f)*%S' $1)"
- echo $used
+ let "$(stat -f -c 'used=(%b-%f)*%S' $1)"
+ echo $used
}
# While the backup runs in a sub-process, display some progress information to the user.
# ProgressInfo texts have a space at the end to get the 'OK' from ProgressStop shown separated.
test "$PROGRESS_WAIT_SECONDS" || PROGRESS_WAIT_SECONDS=1
case "$( basename $BACKUP_PROG )" in
- (tar)
- while sleep $PROGRESS_WAIT_SECONDS ; kill -0 $BackupPID 2>/dev/null; do
- #blocks="$(stat -c %b ${backuparchive})"
- #size="$((blocks*512))"
- size="$(stat -c %s ${backuparchive}* | awk '{s+=$1} END {print s}')"
- ProgressInfo "Archived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec] "
- done
- ;;
- (rsync)
- # since we do not want to do a $(du -s) run every second we count disk usage instead
- # this obviously leads to wrong results in case something else is writing to the same
- # disk at the same time as is very likely with a networked file system. For local disks
- # this should be good enough and in any case this is only some eye candy.
- # TODO: Find a fast way to count the actual transfer data, preferrable getting the info from rsync.
- let old_disk_used="$(get_disk_used "$backuparchive")"
- while sleep $PROGRESS_WAIT_SECONDS ; kill -0 $BackupPID 2>/dev/null; do
- let disk_used="$(get_disk_used "$backuparchive")" size=disk_used-old_disk_used
- ProgressInfo "Archived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec] "
- done
- ;;
- (*)
- while sleep $PROGRESS_WAIT_SECONDS ; kill -0 $BackupPID 2>/dev/null; do
- size="$(stat -c "%s" "$backuparchive")" || {
- kill -9 $BackupPID
- ProgressError
- Error "$(basename $BACKUP_PROG) failed to create the archive file"
- }
- ProgressInfo "Archived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec] "
- done
- ;;
+ (tar)
+ while sleep $PROGRESS_WAIT_SECONDS ; kill -0 $BackupPID 2>/dev/null; do
+ #blocks="$(stat -c %b ${backuparchive})"
+ #size="$((blocks*512))"
+ size="$(stat -c %s ${backuparchive}* | awk '{s+=$1} END {print s}')"
+ ProgressInfo "Archived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec] "
+ done
+ ;;
+ (rsync)
+ # since we do not want to do a $(du -s) run every second we count disk usage instead
+ # this obviously leads to wrong results in case something else is writing to the same
+ # disk at the same time as is very likely with a networked file system. For local disks
+ # this should be good enough and in any case this is only some eye candy.
+ # TODO: Find a fast way to count the actual transfer data, preferrable getting the info from rsync.
+ let old_disk_used="$(get_disk_used "$backuparchive")"
+ while sleep $PROGRESS_WAIT_SECONDS ; kill -0 $BackupPID 2>/dev/null; do
+ let disk_used="$(get_disk_used "$backuparchive")" size=disk_used-old_disk_used
+ ProgressInfo "Archived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec] "
+ done
+ ;;
+ (*)
+ while sleep $PROGRESS_WAIT_SECONDS ; kill -0 $BackupPID 2>/dev/null; do
+ size="$(stat -c "%s" "$backuparchive")" || {
+ kill -9 $BackupPID
+ ProgressError
+ Error "$(basename $BACKUP_PROG) failed to create the archive file"
+ }
+ ProgressInfo "Archived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec] "
+ done
+ ;;
esac
ProgressStop
transfertime="$((SECONDS-starttime))"
@@ -177,10 +227,12 @@ sleep 1
# everyone should see this warning, even if not verbose
case "$(basename $BACKUP_PROG)" in
(tar)
- if (( $backup_prog_rc == 1 )); then
- LogPrint "WARNING: $(basename $BACKUP_PROG) ended with return code $backup_prog_rc and below output:
+ if (( $backup_prog_rc != 0 )); then
+ prog="$(cat $FAILING_BACKUP_PROG_FILE)"
+ if (( $backup_prog_rc == 1 )); then
+ LogUserOutput "WARNING: $prog ended with return code 1 and below output:
---snip---
-$(grep '^tar: ' $RUNTIME_LOGFILE | sed -e 's/^/ /' | tail -n3)
+$(grep '^tar: ' "${TMP_DIR}/${BACKUP_PROG_ARCHIVE}.log" | sed -e 's/^/ /' | tail -n3)
----------
This means that files have been modified during the archiving
process. As a result the backup may not be completely consistent
@@ -188,16 +240,19 @@ or may not be a perfect copy of the system. Relax-and-Recover
will continue, however it is highly advisable to verify the
backup in order to be sure to safely recover this system.
"
- elif (( $backup_prog_rc > 1 )); then
- Error "$(basename $BACKUP_PROG) failed with return code $backup_prog_rc and below output:
+ else
+ rc=$(cat $FAILING_BACKUP_PROG_RC_FILE)
+ Error "$prog failed with return code $rc and below output:
---snip---
-$(grep '^tar: ' $RUNTIME_LOGFILE | sed -e 's/^/ /' | tail -n3)
+$(grep "^$prog: " "${TMP_DIR}/${BACKUP_PROG_ARCHIVE}.log" | sed -e 's/^/ /' | tail -n3)
----------
This means that the archiving process ended prematurely, or did
not even start. As a result it is unlikely you can recover this
system properly. Relax-and-Recover is therefore aborting execution.
"
- fi;;
+ fi
+ fi
+ ;;
(*)
if (( $backup_prog_rc > 0 )) ; then
Error "$(basename $BACKUP_PROG) failed with return code $backup_prog_rc
@@ -212,10 +267,12 @@ esac
tar_message="$(tac $RUNTIME_LOGFILE | grep -m1 '^Total bytes written: ')"
if [ $backup_prog_rc -eq 0 -a "$tar_message" ] ; then
- LogPrint "$tar_message in $transfertime seconds."
+ LogPrint "$tar_message in $transfertime seconds."
elif [ "$size" ]; then
- LogPrint "Archived $((size/1024/1024)) MiB in $((transfertime)) seconds [avg $((size/1024/transfertime)) KiB/sec]"
+ LogPrint "Archived $((size/1024/1024)) MiB in $((transfertime)) seconds [avg $((size/1024/transfertime)) KiB/sec]"
fi
### Copy progress log to backup media
cp $v "${TMP_DIR}/${BACKUP_PROG_ARCHIVE}.log" "${opath}/${BACKUP_PROG_ARCHIVE}.log" >&2
+
+# vim: set et ts=4 sw=4:

File diff suppressed because it is too large Load Diff

View File

@ -1,156 +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 9c4212ae..873e244e 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
@@ -54,9 +54,13 @@ Log "copy_as_is_executables = ${copy_as_is_executables[@]}"
# add them to the LIBS list if they are not yet included in the copied files:
Log "Adding required libraries of executables in all the copied files to LIBS"
local required_library=""
-for required_library in $( RequiredSharedOjects "${copy_as_is_executables[@]}" ) ; do
- # Skip when the required library was already actually copied by 'tar' above:
- grep -q "$required_library" $copy_as_is_filelist_file && continue
+for required_library in $( RequiredSharedObjects "${copy_as_is_executables[@]}" ) ; do
+ # Skip when the required library was already actually copied by 'tar' above.
+ # grep for a full line (copy_as_is_filelist_file contains 1 file name per line)
+ # to avoid that libraries get skipped when their library path is a substring
+ # of another already copied library, e.g. do not skip /path/to/lib when
+ # /other/path/to/lib was already copied, cf. https://github.com/rear/rear/pull/1976
+ grep -q "^${required_library}\$" $copy_as_is_filelist_file && continue
# Skip when the required library is already in LIBS:
IsInArray "$required_library" "${LIBS[@]}" && continue
Log "Adding required library '$required_library' to LIBS"
diff --git a/usr/share/rear/build/GNU/Linux/390_copy_binaries_libraries.sh b/usr/share/rear/build/GNU/Linux/390_copy_binaries_libraries.sh
index f7809bc7..ed02dea9 100644
--- a/usr/share/rear/build/GNU/Linux/390_copy_binaries_libraries.sh
+++ b/usr/share/rear/build/GNU/Linux/390_copy_binaries_libraries.sh
@@ -62,16 +62,16 @@ Log "Binaries being copied: ${all_binaries[@]}"
copy_binaries "$ROOTFS_DIR/bin" "${all_binaries[@]}"
# Copy libraries:
-# It is crucial to also have all LIBS itself in all_libs because RequiredSharedOjects()
+# It is crucial to also have all LIBS itself in all_libs because RequiredSharedObjects()
# outputs only those libraries that are required by a library but not the library itself
# so that without all LIBS itself in all_libs those libraries in LIBS are missing that
# are not needed by a binary in all_binaries (all_binaries were already copied above).
-# RequiredSharedOjects outputs the required shared objects on STDOUT.
+# RequiredSharedObjects outputs the required shared objects on STDOUT.
# The output are absolute paths to the required shared objects.
# The output can also be symbolic links (also as absolute paths).
# In case of symbolic links only the link but not the link target is output.
# Therefore for symbolic links also the link target gets copied below.
-local all_libs=( "${LIBS[@]}" $( RequiredSharedOjects "${all_binaries[@]}" "${LIBS[@]}" ) )
+local all_libs=( "${LIBS[@]}" $( RequiredSharedObjects "${all_binaries[@]}" "${LIBS[@]}" ) )
Log "Libraries being copied: ${all_libs[@]}"
local lib=""
diff --git a/usr/share/rear/build/OPALPBA/Linux-i386/391_list_executable_dependencies.sh b/usr/share/rear/build/OPALPBA/Linux-i386/391_list_executable_dependencies.sh
index 9803200d..8cb27d78 100644
--- a/usr/share/rear/build/OPALPBA/Linux-i386/391_list_executable_dependencies.sh
+++ b/usr/share/rear/build/OPALPBA/Linux-i386/391_list_executable_dependencies.sh
@@ -8,7 +8,7 @@ if is_true $KEEP_BUILD_DIR; then
executable_dependencies_list="$TMP_DIR/executable-dependencies"
for executable in "${executables[@]}"; do
- dependents=( $(RequiredSharedOjects "$ROOTFS_DIR/$executable") )
+ dependents=( $(RequiredSharedObjects "$ROOTFS_DIR/$executable") )
echo "$executable: ${dependents[*]}"
done > "$executable_dependencies_list"
diff --git a/usr/share/rear/build/default/980_verify_rootfs.sh b/usr/share/rear/build/default/980_verify_rootfs.sh
index f8b3e8e9..d03e5f34 100644
--- a/usr/share/rear/build/default/980_verify_rootfs.sh
+++ b/usr/share/rear/build/default/980_verify_rootfs.sh
@@ -51,6 +51,11 @@ if test "$BACKUP" = "SESAM" ; then
# related libraries
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SESAM_LD_LIBRARY_PATH
fi
+if test "$BACKUP" = "NBU" ; then
+ # Use a NBU-specific LD_LIBRARY_PATH to find NBU libraries
+ # see https://github.com/rear/rear/issues/1974
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$NBU_LD_LIBRARY_PATH
+fi
# Actually test all binaries for 'not found' libraries.
# Find all binaries and libraries also e.g. those that are copied via COPY_AS_IS into other paths:
for binary in $( find $ROOTFS_DIR -type f -executable -printf '/%P\n' ); do
diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf
index 0f0d0675..796f228a 100644
--- a/usr/share/rear/conf/default.conf
+++ b/usr/share/rear/conf/default.conf
@@ -1467,7 +1467,8 @@ OBDR_BLOCKSIZE=2048
##
#
COPY_AS_IS_NBU=( /usr/openv/bin/vnetd /usr/openv/bin/vopied /usr/openv/lib /usr/openv/netbackup /usr/openv/var/auth/[mn]*.txt )
-COPY_AS_IS_EXCLUDE_NBU=( "/usr/openv/netbackup/logs/*" "/usr/openv/netbackup/bin/bpjava*" "/usr/openv/netbackup/bin/xbp" )
+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/shared/vddk /usr/openv/netbackup/baremetal )
+NBU_LD_LIBRARY_PATH="/usr/openv/lib"
PROGS_NBU=( )
##
diff --git a/usr/share/rear/lib/_input-output-functions.sh b/usr/share/rear/lib/_input-output-functions.sh
index d5eed43e..bdbf593d 100644
--- a/usr/share/rear/lib/_input-output-functions.sh
+++ b/usr/share/rear/lib/_input-output-functions.sh
@@ -324,10 +324,11 @@ function LogToSyslog () {
# see https://github.com/rear/rear/issues/729
function has_binary () {
for bin in $@ ; do
- # Suppress success output via stdout (but keep failure output via stderr):
- if type $bin 1>/dev/null ; then
- return 0
- fi
+ # Suppress success output via stdout which is crucial when has_binary is called
+ # in other functions that provide their intended function results via stdout
+ # to not pollute intended function results with intermixed has_binary stdout
+ # (e.g. the RequiredSharedObjects function) but keep failure output via stderr:
+ type $bin 1>/dev/null && return 0
done
return 1
}
diff --git a/usr/share/rear/lib/linux-functions.sh b/usr/share/rear/lib/linux-functions.sh
index 6a767367..3fb44e6d 100644
--- a/usr/share/rear/lib/linux-functions.sh
+++ b/usr/share/rear/lib/linux-functions.sh
@@ -100,13 +100,13 @@ function FindStorageDrivers () {
# Determine all required shared objects (shared/dynamic libraries)
# for programs and/or shared objects (binaries) specified in $@.
-# RequiredSharedOjects outputs the required shared objects on STDOUT.
+# RequiredSharedObjects outputs the required shared objects on STDOUT.
# The output are absolute paths to the required shared objects.
# The output can also be symbolic links (also as absolute paths).
# In case of symbolic links only the link but not the link target is output.
-function RequiredSharedOjects () {
- has_binary ldd || Error "Cannot run RequiredSharedOjects() because there is no ldd binary"
- Log "RequiredSharedOjects: Determining required shared objects"
+function RequiredSharedObjects () {
+ has_binary ldd || Error "Cannot run RequiredSharedObjects() because there is no ldd binary"
+ Log "RequiredSharedObjects: Determining required shared objects"
# It uses 'ldd' to determine all required shared objects because 'ldd' outputs
# also transitively required shared objects i.e. libraries needed by libraries,
# e.g. for /usr/sbin/parted also the libraries needed by the libparted library:
@@ -164,10 +164,11 @@ function RequiredSharedOjects () {
# 2. Line: " lib (mem-addr)" -> virtual library
# 3. Line: " lib => not found" -> print error to stderr
# 4. Line: " lib => /path/to/lib (mem-addr)" -> print $3 '/path/to/lib'
- # 5. Line: " /path/to/lib (mem-addr)" -> print $1 '/path/to/lib'
+ # 5. Line: " /path/to/lib => /path/to/lib2 (mem-addr)" -> print $3 '/path/to/lib2'
+ # 6. Line: " /path/to/lib (mem-addr)" -> print $1 '/path/to/lib'
ldd "$@" | awk ' /^\t.+ => not found/ { print "Shared object " $1 " not found" > "/dev/stderr" }
/^\t.+ => \// { print $3 }
- /^\t\// { print $1 } ' | sort -u
+ /^\t\// && !/ => / { print $1 } ' | sort -u
}
# Provide a shell, with custom exit-prompt and history
diff --git a/usr/share/rear/prep/NBU/default/450_check_nbu_client_configured.sh b/usr/share/rear/prep/NBU/default/450_check_nbu_client_configured.sh
index e01dcdbd..3cc29777 100644
--- a/usr/share/rear/prep/NBU/default/450_check_nbu_client_configured.sh
+++ b/usr/share/rear/prep/NBU/default/450_check_nbu_client_configured.sh
@@ -5,5 +5,6 @@
Log "Running: /usr/openv/netbackup/bin/bplist command"
LANG=C /usr/openv/netbackup/bin/bplist -l -s `date -d "-5 days" \
"+%m/%d/%Y"` / >/dev/null
-[ $? -gt 0 ] && LogPrint "WARNING: Netbackup bplist check failed with error code $?.
+rc=$?
+[ $rc -gt 0 ] && LogPrint "WARNING: Netbackup bplist check failed with error code ${rc}.
See $RUNTIME_LOGFILE for more details."

View File

@ -1,17 +0,0 @@
diff --git a/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh b/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh
index 4698618c..6b3194bd 100644
--- a/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh
+++ b/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh
@@ -854,7 +854,11 @@ function handle_physdev () {
DebugPrint "$network_interface is a physical device"
- mac="$( cat $sysfspath/address )" || BugError "Could not read a MAC address for '$network_interface'."
+ if [ -e $sysfspath/bonding_slave/perm_hwaddr ] ; then
+ mac="$( cat $sysfspath/bonding_slave/perm_hwaddr )"
+ else
+ mac="$( cat $sysfspath/address )" || BugError "Could not read a MAC address for '$network_interface'."
+ fi
# Skip fake interfaces without MAC address
[ "$mac" != "00:00:00:00:00:00" ] || return $rc_error

View File

@ -1,35 +0,0 @@
diff --git a/usr/sbin/rear b/usr/sbin/rear
index a51f820c..e21156bf 100755
--- a/usr/sbin/rear
+++ b/usr/sbin/rear
@@ -527,6 +527,10 @@ Build date: $( date -R )
if test "$WORKFLOW" != "help" ; then
# Create temporary work area and register removal exit task:
BUILD_DIR="$( mktemp -d -t rear.XXXXXXXXXXXXXXX || Error "Could not create build area '$BUILD_DIR'" )"
+ # Since 'mktemp' doesn't always return a path under /tmp, the build
+ # directory has always to be excluded for safety
+ BACKUP_PROG_EXCLUDE+=( "$BUILD_DIR" )
+
QuietAddExitTask cleanup_build_area_and_end_program
Log "Using build area '$BUILD_DIR'"
ROOTFS_DIR=$BUILD_DIR/rootfs
@@ -582,3 +586,5 @@ if test "$WORKFLOW" != "help" ; then
fi
exit $EXIT_CODE
+
+# vim: set et ts=4 sw=4:
diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf
index ef118998..52b05eea 100644
--- a/usr/share/rear/conf/default.conf
+++ b/usr/share/rear/conf/default.conf
@@ -47,7 +47,9 @@
# 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
+#
# export TMPDIR="/prefix/for/rear/working/directory"
+#
# 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.

View File

@ -1,91 +0,0 @@
diff --git a/usr/share/rear/skel/default/etc/scripts/system-setup.d/55-migrate-network-devices.sh b/usr/share/rear/skel/default/etc/scripts/system-setup.d/55-migrate-network-devices.sh
index e3ebacce..17cd1dd6 100644
--- a/usr/share/rear/skel/default/etc/scripts/system-setup.d/55-migrate-network-devices.sh
+++ b/usr/share/rear/skel/default/etc/scripts/system-setup.d/55-migrate-network-devices.sh
@@ -26,18 +26,47 @@ ORIGINAL_MACS=()
# The ORIGINAL_DEVICES collects the original device names:
ORIGINAL_DEVICES=()
# The ORIG_MACS_FILE contains lines of the form: network_interface mac_address
+
+# Temporary rear_mappings_mac used when interfaces have been renamed
+tmp_mac_mapping_file=$(mktemp)
+
# TODO: What should happen if there is no ORIG_MACS_FILE or when it is empty?
while read orig_dev orig_mac junk ; do
ORIGINAL_DEVICES=( "${ORIGINAL_DEVICES[@]}" "$orig_dev")
ORIGINAL_MACS=( "${ORIGINAL_MACS[@]}" "$orig_mac" )
- # Continue with the next original MAC address if it is found on the current system:
- ip link show | grep -q "$orig_mac" && continue
- MIGRATE_DEVNAMES=( "${MIGRATE_DEVNAMES[@]}" "$orig_dev" )
- MIGRATE_MACS=( "${MIGRATE_MACS[@]}" "$orig_mac" )
+ # Continue with the next original MAC address if it is found on the current
+ # system, otherwise we consider it needs migration:
+ new_dev=$( get_device_by_hwaddr "$orig_mac" )
+ if [ -n "$new_dev" ] ; then
+ [ "$new_dev" = "$orig_dev" ] && continue
+ # The device was found but has been renamed (it was customized in
+ # source system).
+ # Create a temporary mac mapping, we don't want finalize() to update
+ # the ifcfg-* files!
+ echo "$orig_mac $orig_mac $orig_dev" >> $tmp_mac_mapping_file
+ else
+ MIGRATE_MACS+=( "$orig_mac" )
+ fi
done < $ORIG_MACS_FILE
-# Skip this process if all MACs and network interfacs (devices) are accounted for:
-test ${#MIGRATE_MACS[@]} -eq 0 && test ${#MIGRATE_DEVNAMES[@]} -eq 0 && return 0
+
+if [ ${#MIGRATE_MACS[@]} -ne 0 ] ; then
+ # If some MACs were not found (MIGRATE_MACS not empty) then, we need a migration
+ :
+elif [ -s $tmp_mac_mapping_file ] ; then
+ # Else, if some devices were renamed, we also need a migration, but it will
+ # be automatic thanks to the $tmp_mac_mapping_file mapping file
+
+ # We do not need the $MAC_MAPPING_FILE file from the user, just overwrite it
+ # Later, we will remove that file to not have finalize() modify the ifcfg-*
+ # files.
+ mkdir -p $(dirname $MAC_MAPPING_FILE)
+ cp $tmp_mac_mapping_file $MAC_MAPPING_FILE
+else
+ # Skip this process if all MACs and network interfaces (devices) are accounted for
+ unset tmp_mac_mapping_file
+ return 0
+fi
# Find the MAC addresses that are now available.
# This is an array with values of the form "$dev $mac $driver"
@@ -74,7 +103,7 @@ done
# so that it is shown to the user what MAC address mappings will be done:
if read_and_strip_file $MAC_MAPPING_FILE ; then
while read orig_dev orig_mac junk ; do
- read_and_strip_file $MAC_MAPPING_FILE | grep -q "$orig_mac" && MANUAL_MAC_MAPPING=true
+ read_and_strip_file $MAC_MAPPING_FILE | grep -qw "^$orig_mac" && MANUAL_MAC_MAPPING=true
done < $ORIG_MACS_FILE
fi
@@ -237,7 +266,7 @@ if is_true $reload_udev ; then
echo -n "Reloading udev ... "
# Force udev to reload rules (as they were just changed)
# Failback to "udevadm control --reload" in case of problem (as specify in udevadm manpage in SLES12)
- # If nothing work, then wait 1 seconf delay. It should let the time for udev to detect changes in the rules files.
+ # If nothing work, then wait 1 second delay. It should let the time for udev to detect changes in the rules files.
udevadm control --reload-rules || udevadm control --reload || sleep 1
my_udevtrigger
sleep 1
@@ -252,5 +281,13 @@ if is_true $reload_udev ; then
fi
# A later script in finalize/* will also go over the MAC mappings file and
-# apply them to the files in the recovered system.
+# apply them to the files in the recovered system, unless we did the mapping
+# automatically, which means some device has been renamed and will probably
+# gets its name back upon reboot.
+if [ -s $tmp_mac_mapping_file ] ; then
+ rm $MAC_MAPPING_FILE $tmp_mac_mapping_file
+fi
+
+unset tmp_mac_mapping_file
+# vim: set et ts=4 sw=4:

View File

@ -1,17 +0,0 @@
diff --git a/usr/share/rear/lib/uefi-functions.sh b/usr/share/rear/lib/uefi-functions.sh
index e40f2ab0..95e6292d 100644
--- a/usr/share/rear/lib/uefi-functions.sh
+++ b/usr/share/rear/lib/uefi-functions.sh
@@ -46,6 +46,11 @@ function build_bootx86_efi {
Log "Did not find grub-mkimage (cannot build bootx86.efi)"
return
fi
- $gmkimage $v -O x86_64-efi -c $TMP_DIR/mnt/EFI/BOOT/embedded_grub.cfg -o $TMP_DIR/mnt/EFI/BOOT/BOOTX64.efi -p "/EFI/BOOT" part_gpt part_msdos fat ext2 normal chain boot configfile linux linuxefi multiboot jfs iso9660 usb usbms usb_keyboard video udf ntfs all_video gzio efi_gop reboot search test echo btrfs
+ # as not all Linux distro's have the same grub modules present we verify what we have (see also https://github.com/rear/rear/pull/2001)
+ grub_modules=""
+ for grub_module in part_gpt part_msdos fat ext2 normal chain boot configfile linux linuxefi multiboot jfs iso9660 usb usbms usb_keyboard video udf ntfs all_video gzio efi_gop reboot search test echo btrfs ; do
+ test "$( find /boot -type f -name "$grub_module.mod" 2>/dev/null )" && grub_modules="$grub_modules $grub_module"
+ done
+ $gmkimage $v -O x86_64-efi -c $TMP_DIR/mnt/EFI/BOOT/embedded_grub.cfg -o $TMP_DIR/mnt/EFI/BOOT/BOOTX64.efi -p "/EFI/BOOT" $grub_modules
StopIfError "Error occurred during $gmkimage of BOOTX64.efi"
}

View File

@ -1,94 +0,0 @@
diff --git a/usr/share/rear/lib/layout-functions.sh b/usr/share/rear/lib/layout-functions.sh
index aa6fc938..4bc59131 100644
--- a/usr/share/rear/lib/layout-functions.sh
+++ b/usr/share/rear/lib/layout-functions.sh
@@ -478,6 +478,9 @@ get_sysfs_name() {
### /dev/dm-3 -> /dev/mapper/system-tmp
### /dev/dm-4 -> /dev/mapper/oralun
### /dev/dm-5 -> /dev/mapper/oralunp1
+### /dev/sda -> /dev/sda
+###
+### Returns 0 on success, 1 if device is not existing
get_device_name() {
### strip common prefixes
local name=${1#/dev/}
@@ -485,47 +488,39 @@ get_device_name() {
contains_visible_char "$name" || BugError "Empty string passed to get_device_name"
- ### Translate dm-8 -> mapper/test
- local device dev_number mapper_number
- if [[ -d /sys/block/$name ]] ; then
+ if [[ "$name" =~ ^mapper/ ]]; then
+ echo "/dev/$name"
+ return 0
+ fi
+
+ if [[ -L "/dev/$name" ]] ; then
+ # Map vg/lv into dm-X, which will then be resolved later
+ name="$( basename $(readlink -f /dev/$name) )"
+ fi
+
+ if [[ "$name" =~ ^dm- ]] ; then
+ local device
if [[ -r /sys/block/$name/dm/name ]] ; then
### recent kernels have a dm subfolder
- echo "/dev/mapper/$( < /sys/block/$name/dm/name)";
- return 0
+ device="$( < /sys/block/$name/dm/name )"
else
- ### loop over all block devices
- dev_number=$( < /sys/block/$name/dev)
- for device in /dev/mapper/* ; do
- mapper_number=$(dmsetup info -c --noheadings -o major,minor ${device#/dev/mapper/} 2>/dev/null )
- if [ "$dev_number" = "$mapper_number" ] ; then
- echo "$device"
- return 0
- fi
- done
+ local dev_number=$( < /sys/block/$name/dev)
+ if [[ ! -r "$TMP_DIR/dmsetup_info.txt" ]] ; then
+ dmsetup info --noheadings -c -o name,major,minor > "$TMP_DIR/dmsetup_info.txt"
+ fi
+ device="$( awk -F ':' "/$dev_number\$/ { print \$1 }" < "$TMP_DIR/dmsetup_info.txt" )"
+ [[ -n "$device" ]] || BugError "No device returned for major/minor $dev_number"
fi
- fi
-
- ### Translate device name to mapper name. ex: vg/lv -> mapper/vg-lv
- if [[ "$name" =~ ^mapper/ ]]; then
- echo "/dev/$name"
+ echo "/dev/mapper/$device"
return 0
fi
- if my_dm=`readlink /dev/$name`; then
- for mapper_dev in /dev/mapper/*; do
- if mapper_dm=`readlink $mapper_dev`; then
- if [ "$my_dm" = "$mapper_dm" ]; then
- echo $mapper_dev
- return 0
- fi
- fi
- done
- fi
### handle cciss sysfs naming
name=${name//!//}
### just return the possibly nonexisting name
echo "/dev/$name"
+ [[ -r "/dev/$name" ]] && return 0
return 1
}
diff --git a/usr/share/rear/rescue/GNU/Linux/270_fc_transport_info.sh b/usr/share/rear/rescue/GNU/Linux/270_fc_transport_info.sh
index 0de4f60b..64276dfe 100644
--- a/usr/share/rear/rescue/GNU/Linux/270_fc_transport_info.sh
+++ b/usr/share/rear/rescue/GNU/Linux/270_fc_transport_info.sh
@@ -1,3 +1,6 @@
+# don't collect this anymore, this can be very slow
+return 0
+
# collect output from production SAN disks
find /sys/class/fc_transport -follow -maxdepth 6 \( -name model -o -name vendor -o -name rev -name state -o -name model_name -o -name size -o -name node_name \) 2>/dev/null| egrep -v 'driver|rport|power|drivers|devices' | xargs grep '.' > $VAR_DIR/recovery/fc_transport.info >&2

View File

@ -1,40 +0,0 @@
diff --git a/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh b/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh
index 6b3194bd..57e8777a 100644
--- a/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh
+++ b/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh
@@ -562,7 +562,12 @@ function handle_team () {
local network_interface=$1
local sysfspath=/sys/class/net/$network_interface
- if [ "$( ethtool -i $network_interface | awk '$1 == "driver:" { print $2 }' )" != "team" ] ; then
+ if has_binary ethtool ; then
+ if [ "$( ethtool -i $network_interface | awk '$1 == "driver:" { print $2 }' )" != "team" ] ; then
+ return $rc_error
+ fi
+ else
+ LogPrintError "Couldn't determine if network interface '$network_interface' is a Team, skipping."
return $rc_error
fi
@@ -854,10 +859,17 @@ function handle_physdev () {
DebugPrint "$network_interface is a physical device"
- if [ -e $sysfspath/bonding_slave/perm_hwaddr ] ; then
- mac="$( cat $sysfspath/bonding_slave/perm_hwaddr )"
- else
- mac="$( cat $sysfspath/address )" || BugError "Could not read a MAC address for '$network_interface'."
+ local mac=""
+
+ if has_binary ethtool ; then
+ mac="$( ethtool -P $network_interface 2>/dev/null | awk '{ print $NF }' )"
+ fi
+ if [ -z "$mac" ] ; then
+ if [ -e $sysfspath/bonding_slave/perm_hwaddr ] ; then
+ mac="$( cat $sysfspath/bonding_slave/perm_hwaddr )"
+ else
+ mac="$( cat $sysfspath/address )" || BugError "Could not read a MAC address for '$network_interface'."
+ fi
fi
# Skip fake interfaces without MAC address
[ "$mac" != "00:00:00:00:00:00" ] || return $rc_error

View File

@ -1,33 +0,0 @@
diff -up rear-2.4/usr/share/rear/conf/GNU/Linux.conf.empty rear-2.4/usr/share/rear/conf/GNU/Linux.conf
--- rear-2.4/usr/share/rear/conf/GNU/Linux.conf.empty 2019-09-10 09:45:50.381285069 +0200
+++ rear-2.4/usr/share/rear/conf/GNU/Linux.conf 2019-09-10 09:45:50.421284309 +0200
@@ -276,6 +276,6 @@ COPY_AS_IS_EXCLUDE=( "${COPY_AS_IS_EXCLU
# some stuff for the Linux command line
KERNEL_CMDLINE="$KERNEL_CMDLINE selinux=0"
# common users and groups
-CLONE_USERS=( "${CLONE_USERS[@]:-}" daemon rpc usbmuxd usbmux vcsa nobody dbus )
-CLONE_GROUPS=( "${CLONE_GROUPS[@]:-}" tty usbmuxd usbmux fuse kvm oinstall dbus )
+CLONE_USERS+=( daemon rpc usbmuxd usbmux vcsa nobody dbus )
+CLONE_GROUPS+=( tty usbmuxd usbmux fuse kvm oinstall dbus )
diff -up rear-2.4/usr/share/rear/rescue/default/900_clone_users_and_groups.sh.empty rear-2.4/usr/share/rear/rescue/default/900_clone_users_and_groups.sh
--- rear-2.4/usr/share/rear/rescue/default/900_clone_users_and_groups.sh.empty 2018-06-21 10:40:53.000000000 +0200
+++ rear-2.4/usr/share/rear/rescue/default/900_clone_users_and_groups.sh 2019-09-10 09:45:50.421284309 +0200
@@ -40,6 +40,8 @@ local group=""
# because it should succeed when there is any non-empty array member, not necessarily the first one:
test "${CLONE_USERS[*]}" && Log "Cloning users: ${CLONE_USERS[@]}"
for user in "${CLONE_USERS[@]}" ; do
+ # Skip empty user values, cf. https://github.com/rear/rear/issues/2220
+ test $user || continue
# Skip if the user exists already in the ReaR recovery system:
grep -q "^$user:" $ROOTFS_DIR/etc/passwd && continue
# Skip if the user does not exist in the current system:
@@ -78,6 +80,8 @@ done
# because it should succeed when there is any non-empty array member, not necessarily the first one:
test "${CLONE_GROUPS[*]}" && Log "Cloning groups: ${CLONE_GROUPS[@]}"
for group in "${CLONE_GROUPS[@]}" ; do
+ # Skip empty group values, cf. https://github.com/rear/rear/issues/2220
+ test $group || continue
# Skip if the group exists already in the ReaR recovery system:
grep -q "^$group:" $ROOTFS_DIR/etc/group && continue
# Skip if the group does not exist in the current system:

View File

@ -1,113 +0,0 @@
diff -up rear-2.4/usr/share/rear/build/default/980_verify_rootfs.sh.build rear-2.4/usr/share/rear/build/default/980_verify_rootfs.sh
--- rear-2.4/usr/share/rear/build/default/980_verify_rootfs.sh.build 2019-09-10 09:31:05.971102125 +0200
+++ rear-2.4/usr/share/rear/build/default/980_verify_rootfs.sh 2019-09-10 09:31:06.002101535 +0200
@@ -3,6 +3,33 @@
# i.e. test that the ReaR recovery system will be usable
# to avoid issues like https://github.com/rear/rear/issues/1494
+if test "$KEEP_BUILD_DIR" = "errors"; then
+ local keep_build_dir_on_errors=1
+else
+ # KEEP_BUILD_DIR does not say to keep it on errors
+ # - effective value depends on whether we are running interactively
+ if tty -s ; then
+ local keep_build_dir_on_errors=1
+ else
+ local keep_build_dir_on_errors=0
+ fi
+fi
+
+function keep_build_dir() {
+ if ! is_true "$KEEP_BUILD_DIR" && ! is_false "$KEEP_BUILD_DIR"; then
+ # is either empty or equal to "errors" ... or some garbage value
+ local orig_keep_build_dir="$KEEP_BUILD_DIR"
+ KEEP_BUILD_DIR="${keep_build_dir_on_errors}"
+ fi
+ if is_true "$KEEP_BUILD_DIR" ; then
+ LogPrintError "Build area kept for investigation in $BUILD_DIR, remove it when not needed"
+ elif ! is_false "$orig_keep_build_dir" ; then
+ # if users disabled preserving the build dir explicitly, let's not bother them with messages
+ LogPrintError "Build area $BUILD_DIR will be removed"
+ LogPrintError "To preserve it for investigation set KEEP_BUILD_DIR=errors or run ReaR with -d"
+ fi
+}
+
# In case the filesystem that contains the ROOTFS_DIR is mounted 'noexec' we cannot do the 'chroot' tests.
# The filesystem_name function in linux-functions.sh returns the mountpoint (not a filesystem name like 'ext4'):
local rootfs_dir_fs_mountpoint=$( filesystem_name $ROOTFS_DIR )
@@ -16,7 +43,7 @@ Log "Testing that $ROOTFS_DIR contains a
# The bash test ensures that we have a working bash in the ReaR recovery system:
if ! chroot $ROOTFS_DIR /bin/bash -c true ; then
- KEEP_BUILD_DIR=1
+ keep_build_dir
BugError "ReaR recovery system in '$ROOTFS_DIR' is broken: 'bash -c true' failed"
fi
@@ -25,7 +52,7 @@ fi
# First test is 'ldd /bin/bash' to ensure 'ldd' works:
Log "Testing 'ldd /bin/bash' to ensure 'ldd' works for the subsequent 'ldd' tests"
if ! chroot $ROOTFS_DIR /bin/ldd /bin/bash 1>&2 ; then
- KEEP_BUILD_DIR=1
+ keep_build_dir
BugError "ReaR recovery system in '$ROOTFS_DIR' is broken: 'ldd /bin/bash' failed"
fi
# Now test each binary (except links) with ldd and look for 'not found' libraries.
@@ -83,7 +110,7 @@ test $old_LD_LIBRARY_PATH && export LD_L
# Report binaries with 'not found' shared object dependencies:
if contains_visible_char "$broken_binaries" ; then
LogPrintError "There are binaries or libraries in the ReaR recovery system that need additional libraries"
- KEEP_BUILD_DIR=1
+ keep_build_dir
local fatal_missing_library=""
local ldd_output=""
for binary in $broken_binaries ; do
@@ -113,9 +140,10 @@ if contains_visible_char "$broken_binari
# 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" )"
done
+ LogPrintError "ReaR recovery system in '$ROOTFS_DIR' needs additional libraries, check $RUNTIME_LOGFILE for details"
+ is_true "$fatal_missing_library" && keep_build_dir
# Usually it should be no BugError when there are libraries missing for particular binaries because probably
# the reason is that the user added only the plain binaries with COPY_AS_IS (instead of using REQUIRED_PROGS):
is_true "$fatal_missing_library" && Error "ReaR recovery system in '$ROOTFS_DIR' not usable"
- LogPrintError "ReaR recovery system in '$ROOTFS_DIR' needs additional libraries, check $RUNTIME_LOGFILE for details"
fi
diff -up rear-2.4/usr/share/rear/conf/default.conf.build rear-2.4/usr/share/rear/conf/default.conf
--- rear-2.4/usr/share/rear/conf/default.conf.build 2019-09-10 09:31:05.996101649 +0200
+++ rear-2.4/usr/share/rear/conf/default.conf 2019-09-10 09:31:06.002101535 +0200
@@ -125,9 +125,19 @@ OS_VERSION=none
# supported values that could make it work even for your system.
# See the SetOSVendorAndVersion function in the config-functions.sh script.
-# Keep the build area after we are done (BOOL).
+# Keep the build area after we are done (ternary).
# Useful to inspect the ReaR recovery system content in $TMPDIR/rear.XXXXXXXXXXXXXXX/rootfs/
-# directly without the need to extract it from the initramfs/initrd in the ISO image:
+# directly without the need to extract it from the initramfs/initrd in the ISO image.
+# Set to "y", "Yes", etc. to always keep the build area, to "n", "No", etc. to never keep it.
+# KEEP_BUILD_DIR is automatically set to true in debug mode (-d) and in debugscript mode (-D).
+# In addition to true (any value that is recognized as 'yes' by the is_true function)
+# and false (any value that is recognized as 'no' by the is_false function) it can be set
+# to several special values:
+# - "errors" to obtain the old behaviour where KEEP_BUILD_DIR was always set
+# to true to keep the build area when errors in the ReaR recovery system were detected.
+# - empty (KEEP_BUILD_DIR="") which means that the build area will be kept on errors
+# if running interactively (in a terminal) and not otherwise (to avoid cluttering
+# /tmp by cron or other automated jobs in case of errors).
KEEP_BUILD_DIR=""
# No default workflows. This variable is filled in where the workflows are defined
diff -up rear-2.4/usr/share/rear/lib/framework-functions.sh.build rear-2.4/usr/share/rear/lib/framework-functions.sh
--- rear-2.4/usr/share/rear/lib/framework-functions.sh.build 2018-06-21 10:40:53.000000000 +0200
+++ rear-2.4/usr/share/rear/lib/framework-functions.sh 2019-09-10 09:31:06.002101535 +0200
@@ -106,7 +106,7 @@ function SourceStage () {
function cleanup_build_area_and_end_program () {
# Cleanup build area
Log "Finished in $((SECONDS-STARTTIME)) seconds"
- if test "$KEEP_BUILD_DIR" ; then
+ if is_true "$KEEP_BUILD_DIR" ; then
LogPrint "You should also rm -Rf $BUILD_DIR"
else
Log "Removing build area $BUILD_DIR"

View File

@ -1,12 +0,0 @@
diff -up rear-2.4/usr/share/rear/conf/default.conf.nbu rear-2.4/usr/share/rear/conf/default.conf
--- rear-2.4/usr/share/rear/conf/default.conf.nbu 2019-09-10 09:37:56.619290929 +0200
+++ rear-2.4/usr/share/rear/conf/default.conf 2019-09-10 09:37:56.621290891 +0200
@@ -1480,7 +1480,7 @@ OBDR_BLOCKSIZE=2048
#
COPY_AS_IS_NBU=( /usr/openv/bin/vnetd /usr/openv/bin/vopied /usr/openv/lib /usr/openv/netbackup /usr/openv/var/auth/[mn]*.txt )
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/shared/vddk /usr/openv/netbackup/baremetal )
-NBU_LD_LIBRARY_PATH="/usr/openv/lib"
+NBU_LD_LIBRARY_PATH="/usr/openv/lib:/usr/openv/netbackup/sec/at/lib/"
PROGS_NBU=( )
##

View File

@ -1,87 +0,0 @@
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 2fc8ccd3..60306718 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
@@ -50,13 +50,28 @@ fi
# so that in particular what is mounted at '/' is output before other stuff.
read_filesystems_command="$read_filesystems_command | sort -t ' ' -k 1,1 -u"
-# docker daemon mounts file systems for its docker containers
-# see also https://docs.docker.com/storage/storagedriver/device-mapper-driver/#configure-direct-lvm-mode-for-production
-# As it is for container usage only we do not to backup these up or recreate as this disk device is completely under
-# control by docker itself (even the recreation of it incl, the creation of the volume group). Usually this is
-# done via a kind of cookbook (Chef, puppet or ansible)
+# The Docker daemon mounts file systems for its Docker containers, see also
+# https://docs.docker.com/storage/storagedriver/device-mapper-driver/#configure-direct-lvm-mode-for-production
+# As it is for container usage only we do not to backup these up or recreate as this disk device is completely
+# under control by Docker itself (even the recreation of it incl, the creation of the volume group).
+# Usually this is done via a kind of cookbook (Chef, puppet or ansible).
docker_is_running=""
-service docker status >/dev/null 2>&1 && docker_is_running="yes"
+docker_root_dir=""
+if service docker status &>/dev/null ; then
+ docker_is_running="yes"
+ # When the Docker daemon/service is running, try to get its 'Docker Root Dir':
+ # Kill 'docker info' with SIGTERM after 5 seconds and with SIGKILL after additional 2 seconds
+ # because there are too many crippled Docker installations, cf. https://github.com/rear/rear/pull/2021
+ docker_root_dir=$( timeout -k 2s 5s docker info | grep 'Docker Root Dir' | awk '{print $4}' )
+ # Things may go wrong in the 'Docker specific exclude part' below
+ # when Docker is used but its 'Docker Root Dir' cannot be determined
+ # cf. https://github.com/rear/rear/issues/1989
+ if test "$docker_root_dir" ; then
+ LogPrint "Docker is running, skipping filesystems mounted below Docker Root Dir $docker_root_dir"
+ else
+ LogPrintError "Cannot determine Docker Root Dir - things may go wrong - check $DISKLAYOUT_FILE"
+ fi
+fi
# Begin writing output to DISKLAYOUT_FILE:
(
@@ -64,9 +79,10 @@ service docker status >/dev/null 2>&1 && docker_is_running="yes"
echo "# Format: fs <device> <mountpoint> <fstype> [uuid=<uuid>] [label=<label>] [<attributes>]"
# Read the output of the read_filesystems_command:
while read device mountpoint fstype options junk ; do
+ Log "Processing filesystem '$fstype' on '$device' mounted at '$mountpoint'"
# Empty device or mountpoint or fstype may may indicate an error. In this case be verbose and inform the user:
if test -z "$device" -o -z "$mountpoint" -o -z "$fstype" ; then
- LogPrint "Empty device='$device' or mountpoint='$mountpoint' or fstype='$fstype', skipping saving filesystem layout for it."
+ LogPrintError "Empty device='$device' or mountpoint='$mountpoint' or fstype='$fstype', skipping saving filesystem layout for it."
continue
fi
# FIXME: I (jsmeix@suse.de) have no idea what the reason for the following is.
@@ -88,15 +104,18 @@ service docker status >/dev/null 2>&1 && docker_is_running="yes"
Log "$device is CD/DVD type device [fstype=$fstype], skipping."
continue
fi
- # docker specific exclude part
+ # Docker specific exclude part:
if is_true $docker_is_running ; then
- # docker daemon/service is running
- docker_root_dir=$( docker info 2>/dev/null | grep 'Docker Root Dir' | awk '{print $4}' )
- # If $docker_root_dir is in the beginning of the $mountpoint string then FS is under docker control
- # and we better exclude from saving the layout,
- # see https://github.com/rear/rear/issues/1749
- Log "$device is mounted below $docker_root_dir (mount point $mountpoint is under docker control), skipping."
- echo "$mountpoint" | grep -q "^$docker_root_dir" && continue
+ # If docker_root_dir is the beginning of the mountpoint string then the filesystem is under Docker control
+ # and we better exclude it from saving the layout, see https://github.com/rear/rear/issues/1749
+ # but ensure docker_root_dir is not empty (otherwise any mountpoint string matches "^" which
+ # would skip all mountpoints), see https://github.com/rear/rear/issues/1989#issuecomment-456054278
+ if test "$docker_root_dir" ; then
+ if echo "$mountpoint" | grep -q "^$docker_root_dir" ; then
+ Log "Filesystem $fstype on $device mounted at $mountpoint is below Docker Root Dir $docker_root_dir, skipping."
+ continue
+ fi
+ fi
fi
# Replace a symbolic link /dev/disk/by-uuid/a1b2c3 -> ../../sdXn
# by the fully canonicalized target of the link e.g. /dev/sdXn
@@ -232,7 +251,7 @@ service docker status >/dev/null 2>&1 && docker_is_running="yes"
test -z "$btrfs_default_subvolume_path" && btrfs_default_subvolume_path="/"
# Empty btrfs_default_subvolume_ID may may indicate an error. In this case be verbose and inform the user:
if test -z "$btrfs_default_subvolume_ID" ; then
- LogPrint "Empty btrfs_default_subvolume_ID, no btrfs default subvolume stored for $btrfs_device at $btrfs_mountpoint"
+ LogPrintError "Empty btrfs_default_subvolume_ID, no btrfs default subvolume stored for $btrfs_device at $btrfs_mountpoint"
else
echo "btrfsdefaultsubvol $btrfs_device $btrfs_mountpoint $btrfs_default_subvolume_ID $btrfs_default_subvolume_path"
fi

View File

@ -1,17 +0,0 @@
diff --git a/usr/share/rear/restore/BACULA/default/400_restore_backup.sh b/usr/share/rear/restore/BACULA/default/400_restore_backup.sh
index eac4d275..d21af71c 100644
--- a/usr/share/rear/restore/BACULA/default/400_restore_backup.sh
+++ b/usr/share/rear/restore/BACULA/default/400_restore_backup.sh
@@ -110,7 +110,11 @@ WARNING: The new root is mounted under '$TARGET_FS_ROOT'.
Press ENTER to start bconsole"
read
- bconsole
+ if bconsole 0<&6 1>&7 2>&8 ; then
+ Log "bconsole finished with zero exit code"
+ else
+ Log "bconsole finished with non-zero exit code $?"
+ fi
LogPrint "
Please verify that the backup has been restored correctly to '$TARGET_FS_ROOT'

View File

@ -1,37 +0,0 @@
From 686fc5335c9b95388a095ced0abedbde8348bdf8 Mon Sep 17 00:00:00 2001
From: Johannes Meixner <jsmeix@suse.com>
Date: Mon, 23 Mar 2020 11:18:23 +0100
Subject: [PATCH] Update 820_create_iso_image.sh
Have a hardcoded '-iso-level 3' option in output/ISO/Linux-ppc64le/820_create_iso_image.sh
because it is also hardcoded in output/ISO/Linux-i386/820_create_iso_image.sh
and it seems to also work in general on POWER architecture
cf. https://github.com/rear/rear/issues/2344#issuecomment-601949828
Resolves: rhbz#1726043
---
.../rear/output/ISO/Linux-ppc64le/820_create_iso_image.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/usr/share/rear/output/ISO/Linux-ppc64le/820_create_iso_image.sh b/usr/share/rear/output/ISO/Linux-ppc64le/820_create_iso_image.sh
index 28b6464f..44b31b80 100644
--- a/usr/share/rear/output/ISO/Linux-ppc64le/820_create_iso_image.sh
+++ b/usr/share/rear/output/ISO/Linux-ppc64le/820_create_iso_image.sh
@@ -17,7 +17,13 @@ else
chrp_boot_option="-chrp-boot"
fi
-$ISO_MKISOFS_BIN $v -o "$ISO_DIR/$ISO_PREFIX.iso" -U $chrp_boot_option -R -J -volid "$ISO_VOLID" -v -graft-points "${ISO_FILES[@]}" >&2
+# Have a hardcoded '-iso-level 3' option also here because it is
+# also hardcoded in output/ISO/Linux-i386/820_create_iso_image.sh
+# and it seems to also work in general on POWER architecture
+# cf. https://github.com/rear/rear/issues/2344#issuecomment-601949828
+$ISO_MKISOFS_BIN $v -o "$ISO_DIR/$ISO_PREFIX.iso" \
+ -U $chrp_boot_option -R -J -volid "$ISO_VOLID" -v -iso-level 3 -graft-points \
+ "${ISO_FILES[@]}" >&2
StopIfError "Could not create ISO image (with $ISO_MKISOFS_BIN)"
popd >&2
--
2.25.4

View File

@ -1,119 +0,0 @@
diff --git a/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh b/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh
index e43ff896..a9730435 100644
--- a/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh
+++ b/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh
@@ -53,6 +53,7 @@ Log "Saving LVM layout."
done
header_printed=0
+ already_processed_lvs=""
## Get all logical volumes
# format: lvmvol <volume_group> <name> <size(bytes)> <layout> [key:value ...]
@@ -61,7 +62,7 @@ Log "Saving LVM layout."
if lvm lvs -o lv_layout >/dev/null 2>&1; then
- lvm 8>&- 7>&- lvs --separator=":" --noheadings --units b --nosuffix -o origin,lv_name,vg_name,lv_size,lv_layout,pool_lv,chunk_size,stripes,stripe_size | while read line ; do
+ lvm 8>&- 7>&- lvs --separator=":" --noheadings --units b --nosuffix -o origin,lv_name,vg_name,lv_size,lv_layout,pool_lv,chunk_size,stripes,stripe_size,seg_size | while read line ; do
if [ $header_printed -eq 0 ] ; then
echo "# Format for LVM LVs"
@@ -72,7 +73,7 @@ Log "Saving LVM layout."
origin="$(echo "$line" | awk -F ':' '{ print $1 }')"
# Skip snapshots (useless) or caches (dont know how to handle that)
if [ -n "$origin" ] ; then
- echo "# Skipped snapshot of cache information '$line'"
+ echo "# Skipped snapshot or cache information '$line'"
continue
fi
@@ -84,25 +85,45 @@ Log "Saving LVM layout."
chunksize="$(echo "$line" | awk -F ':' '{ print $7 }')"
stripes="$(echo "$line" | awk -F ':' '{ print $8 }')"
stripesize="$(echo "$line" | awk -F ':' '{ print $9 }')"
+ segmentsize="$(echo "$line" | awk -F ':' '{ print $10 }')"
kval=""
+ infokval=""
[ -z "$thinpool" ] || kval="${kval:+$kval }thinpool:$thinpool"
[ $chunksize -eq 0 ] || kval="${kval:+$kval }chunksize:${chunksize}b"
[ $stripesize -eq 0 ] || kval="${kval:+$kval }stripesize:${stripesize}b"
+ [ $segmentsize -eq $size ] || infokval="${infokval:+$infokval }segmentsize:${segmentsize}b"
if [[ ,$layout, == *,mirror,* ]] ; then
kval="${kval:+$kval }mirrors:$(($stripes - 1))"
elif [[ ,$layout, == *,striped,* ]] ; then
kval="${kval:+$kval }stripes:$stripes"
fi
- echo "lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [[ " $already_processed_lvs " == *\ $vg/$lv\ * ]] ; then
+ # The LV has multiple segments; the create_lvmvol() function in
+ # 110_include_lvm_code.sh is not able to recreate this, but
+ # keep the information for the administrator anyway.
+ echo "#lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [ -n "$infokval" ] ; then
+ echo "# extra parameters for the line above not taken into account when restoring using 'lvcreate': $infokval"
+ fi
+ else
+ if [ $segmentsize -ne $size ] ; then
+ echo "# WARNING: Volume $vg/$lv has multiple segments. Restoring it in Migration Mode using 'lvcreate' won't preserve segments and properties of the other segments as well!"
+ fi
+ echo "lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [ -n "$infokval" ] ; then
+ echo "# extra parameters for the line above not taken into account when restoring using 'lvcreate': $infokval"
+ fi
+ already_processed_lvs="${already_processed_lvs:+$already_processed_lvs }$vg/$lv"
+ fi
done
else
# Compatibility with older LVM versions (e.g. <= 2.02.98)
# No support for 'lv_layout', too bad, do our best!
- lvm 8>&- 7>&- lvs --separator=":" --noheadings --units b --nosuffix -o origin,lv_name,vg_name,lv_size,modules,pool_lv,chunk_size,stripes,stripe_size | while read line ; do
+ lvm 8>&- 7>&- lvs --separator=":" --noheadings --units b --nosuffix -o origin,lv_name,vg_name,lv_size,modules,pool_lv,chunk_size,stripes,stripe_size,seg_size | while read line ; do
if [ $header_printed -eq 0 ] ; then
echo "# Format for LVM LVs"
@@ -125,11 +146,14 @@ Log "Saving LVM layout."
chunksize="$(echo "$line" | awk -F ':' '{ print $7 }')"
stripes="$(echo "$line" | awk -F ':' '{ print $8 }')"
stripesize="$(echo "$line" | awk -F ':' '{ print $9 }')"
+ segmentsize="$(echo "$line" | awk -F ':' '{ print $10 }')"
kval=""
+ infokval=""
[ -z "$thinpool" ] || kval="${kval:+$kval }thinpool:$thinpool"
[ $chunksize -eq 0 ] || kval="${kval:+$kval }chunksize:${chunksize}b"
[ $stripesize -eq 0 ] || kval="${kval:+$kval }stripesize:${stripesize}b"
+ [ $segmentsize -eq $size ] || infokval="${infokval:+$infokval }segmentsize:${segmentsize}b"
if [[ "$modules" == "" ]] ; then
layout="linear"
[ $stripes -eq 0 ] || kval="${kval:+$kval }stripes:$stripes"
@@ -148,7 +172,24 @@ Log "Saving LVM layout."
kval="${kval:+$kval }stripes:$stripes"
fi
- echo "lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [[ " $already_processed_lvs " == *\ $vg/$lv\ * ]]; then
+ # The LV has multiple segments; the create_lvmvol() function in
+ # 110_include_lvm_code.sh is not able to recreate this, but
+ # keep the information for the administrator anyway.
+ echo "#lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [ -n "$infokval" ] ; then
+ echo "# extra parameters for the line above not taken into account when restoring using 'lvcreate': $infokval"
+ fi
+ else
+ if [ $segmentsize -ne $size ] ; then
+ echo "# WARNING: Volume $vg/$lv has multiple segments. Restoring it in Migration Mode using 'lvcreate' won't preserve segments and properties of the other segments as well!"
+ fi
+ echo "lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [ -n "$infokval" ] ; then
+ echo "# extra parameters for the line above not taken into account when restoring using 'lvcreate': $infokval"
+ fi
+ already_processed_lvs="${already_processed_lvs:+$already_processed_lvs }$vg/$lv"
+ fi
done
fi

View File

@ -1,194 +0,0 @@
diff --git a/usr/share/rear/lib/uefi-functions.sh b/usr/share/rear/lib/uefi-functions.sh
index 95e6292d..c583e044 100644
--- a/usr/share/rear/lib/uefi-functions.sh
+++ b/usr/share/rear/lib/uefi-functions.sh
@@ -37,20 +37,76 @@ function trim {
}
function build_bootx86_efi {
- local gmkimage
- if has_binary grub-mkimage; then
- gmkimage=grub-mkimage
- elif has_binary grub2-mkimage; then
- gmkimage=grub2-mkimage
+ local outfile="$1"
+ local embedded_config=""
+ local gmkstandalone=""
+ local gprobe=""
+ local dirs=()
+ # modules is the list of modules to load
+ local modules=()
+
+ # Configuration file is optional for image creation.
+ shift
+ if [[ -n "$1" ]] ; then
+ # graft point syntax. $1 will appear as /boot/grub/grub.cfg in the image
+ embedded_config="/boot/grub/grub.cfg=$1"
+ shift
+ # directories that should be accessible by GRUB2 (e.g. because they contain the kernel)
+ dirs=( ${@:+"$@"} )
+ fi
+
+ if has_binary grub-mkstandalone ; then
+ gmkstandalone=grub-mkstandalone
+ elif has_binary grub2-mkstandalone ; then
+ # At least SUSE systems use 'grub2' prefixed names for GRUB2 programs:
+ gmkstandalone=grub2-mkstandalone
else
- Log "Did not find grub-mkimage (cannot build bootx86.efi)"
- return
+ # 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):
+ Error "Cannot make bootable EFI image of GRUB2 (neither grub-mkstandalone nor grub2-mkstandalone found)"
+ fi
+
+ # Determine what modules need to be loaded in order to access given directories
+ # (if the list of modules is not overriden by GRUB2_MODULES_LOAD)
+ if (( ${#dirs[@]} )) && ! (( ${#modules[@]} )) ; then
+ if has_binary grub-probe ; then
+ gprobe=grub-probe
+ elif has_binary grub2-probe ; then
+ # At least SUSE systems use 'grub2' prefixed names for GRUB2 programs:
+ gprobe=grub2-probe
+ else
+ LogWarn "Neither grub-probe nor grub2-probe found"
+ if test /usr/lib/grub*/x86_64-efi/partmap.lst ; then
+ LogWarn "including all partition modules"
+ modules=( $(cat /usr/lib/grub*/x86_64-efi/partmap.lst) )
+ else
+ Error "Can not determine partition modules, ${dirs[*]} would be likely inaccessible in GRUB2"
+ fi
+ fi
+
+ if [ -n "$gprobe" ]; then
+ # this is unfortunately only a crude approximation of the Grub internal probe_mods() function
+ modules=( $( for p in "${dirs[@]}" ; do
+ $gprobe --target=fs "$p"
+ $gprobe --target=partmap "$p" | sed -e 's/^/part_/'
+ $gprobe --target=abstraction "$p"
+ done | sort -u ) )
+ fi
+ fi
+
+ # grub-mkimage needs /usr/lib/grub/x86_64-efi/moddep.lst (cf. https://github.com/rear/rear/issues/1193)
+ # and at least on SUSE systems grub2-mkimage needs /usr/lib/grub2/x86_64-efi/moddep.lst (in 'grub2' directory)
+ # so that we error out if grub-mkimage or grub2-mkimage would fail when its moddep.lst is missing.
+ # Careful: usr/sbin/rear sets nullglob so that /usr/lib/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/lib/grub*/x86_64-efi/moddep.lst'
+ # also 'test -n' succeeds with empty argument but (fortunately/intentionally?) plain 'test' fails with empty argument:
+ test /usr/lib/grub*/x86_64-efi/moddep.lst || Error "$gmkstandalone would not make bootable EFI image of GRUB2 (no /usr/lib/grub*/x86_64-efi/moddep.lst file)"
+
+ (( ${#modules[@]} )) && LogPrint "GRUB2 modules to load: ${modules[*]}"
+
+ if ! $gmkstandalone $v ${modules:+"--modules=${modules[*]}"} -O x86_64-efi -o $outfile $embedded_config ; then
+ Error "Failed to make bootable EFI image of GRUB2 (error during $gmkstandalone of $outfile)"
fi
- # as not all Linux distro's have the same grub modules present we verify what we have (see also https://github.com/rear/rear/pull/2001)
- grub_modules=""
- for grub_module in part_gpt part_msdos fat ext2 normal chain boot configfile linux linuxefi multiboot jfs iso9660 usb usbms usb_keyboard video udf ntfs all_video gzio efi_gop reboot search test echo btrfs ; do
- test "$( find /boot -type f -name "$grub_module.mod" 2>/dev/null )" && grub_modules="$grub_modules $grub_module"
- done
- $gmkimage $v -O x86_64-efi -c $TMP_DIR/mnt/EFI/BOOT/embedded_grub.cfg -o $TMP_DIR/mnt/EFI/BOOT/BOOTX64.efi -p "/EFI/BOOT" $grub_modules
- StopIfError "Error occurred during $gmkimage of BOOTX64.efi"
}
+
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 fdf66039..e9325012 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
@@ -2,6 +2,9 @@
is_true $USING_UEFI_BOOTLOADER || return 0 # empty or 0 means NO UEFI
+local boot_dir="/boot"
+local efi_boot_tmp_dir="$TMP_DIR/mnt/EFI/BOOT"
+
mkdir $v -p $TMP_DIR/mnt/EFI/BOOT >&2
StopIfError "Could not create $TMP_DIR/mnt/EFI/BOOT"
@@ -56,14 +59,8 @@ title Relax-and-Recover (no Secure Boot)
EOF
else
-# create small embedded grub.cfg file for grub-mkimage
-cat > $TMP_DIR/mnt/EFI/BOOT/embedded_grub.cfg <<EOF
-set prefix=(cd0)/EFI/BOOT
-configfile /EFI/BOOT/grub.cfg
-EOF
-
-# create a grub.cfg
- create_grub2_cfg > $TMP_DIR/mnt/EFI/BOOT/grub.cfg
+ # create a grub.cfg
+ create_grub2_cfg > $efi_boot_tmp_dir/grub.cfg
fi
# Create BOOTX86.efi but only if we are NOT secure booting.
@@ -72,15 +69,15 @@ fi
# See issue #1374
# build_bootx86_efi () can be safely used for other scenarios.
if ! test -f "$SECURE_BOOT_BOOTLOADER" ; then
- build_bootx86_efi
+ build_bootx86_efi $TMP_DIR/mnt/EFI/BOOT/BOOTX64.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.
# Because usr/sbin/rear sets 'shopt -s nullglob' the 'echo -n' command
# outputs nothing if nothing matches the bash globbing pattern '/boot/grub*'
-local grubdir="$( echo -n /boot/grub* )"
+local grubdir="$( echo -n ${boot_dir}/grub* )"
# Use '/boot/grub' as fallback if nothing matches '/boot/grub*'
-test -d "$grubdir" || grubdir='/boot/grub'
+test -d "$grubdir" || grubdir="${boot_dir}/grub"
if [ -d $(dirname ${UEFI_BOOTLOADER})/fonts ]; then
cp $v $(dirname ${UEFI_BOOTLOADER})/fonts/* $TMP_DIR/mnt/EFI/BOOT/fonts/ >&2
diff --git a/usr/share/rear/output/default/940_grub2_rescue.sh b/usr/share/rear/output/default/940_grub2_rescue.sh
index a94957de..fbbd7074 100644
--- a/usr/share/rear/output/default/940_grub2_rescue.sh
+++ b/usr/share/rear/output/default/940_grub2_rescue.sh
@@ -144,13 +144,18 @@ if is_true $USING_UEFI_BOOTLOADER ; then
# probably a bug, as I was able to boot with value set to root=anything
root_uuid=$(mount | grep -w 'on /' | awk '{print $1}' | xargs blkid -s UUID -o value)
- # Grub2 modules that will be used for booting "Relax-and-Recover"
- # It might be useful to make this variable global in the future
- grub2_modules="linux echo all_video part_gpt ext2 btrfs search configfile"
-
# Create configuration file for "Relax-and-Recover" UEFI boot entry.
# This file will not interact with existing Grub2 configuration in any way.
- ( echo "menuentry '$grub_rear_menu_entry_name' --class os {"
+ ( echo "set btrfs_relative_path=y"
+ echo "insmod efi_gop"
+ echo "insmod efi_uga"
+ echo "insmod video_bochs"
+ echo "insmod video_cirrus"
+ echo "insmod all_video"
+ echo ""
+ echo "set gfxpayload=keep"
+ echo ""
+ echo "menuentry '$grub_rear_menu_entry_name' --class os {"
echo " search --no-floppy --fs-uuid --set=root $grub_boot_uuid"
echo " echo 'Loading kernel $boot_kernel_file ...'"
echo " linux $grub_boot_dir/$boot_kernel_name root=UUID=$root_uuid $KERNEL_CMDLINE"
@@ -159,19 +164,8 @@ if is_true $USING_UEFI_BOOTLOADER ; then
echo "}"
) > $grub_config_dir/rear.cfg
- # Tell rear.efi which configuration file to load
- ( echo "search --no-floppy --fs-uuid --set=root $grub_boot_uuid"
- echo ""
- echo "set btrfs_relative_path=y"
- echo "set prefix=(\$root)${grub_boot_dir}/grub${grub_num}"
- echo ""
- echo "configfile (\$root)${grub_boot_dir}/grub${grub_num}/rear.cfg"
- ) > $grub_config_dir/rear_embed.cfg
-
# Create rear.efi at UEFI default boot directory location.
- if ! grub${grub_num}-mkimage -o $boot_dir/efi/EFI/BOOT/rear.efi -O x86_64-efi -c $grub_config_dir/rear_embed.cfg -p /EFI/BOOT $grub2_modules ; then
- Error "Could not create UEFI boot image"
- fi
+ build_bootx86_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,

View File

@ -1,354 +0,0 @@
diff --git a/.gitignore b/.gitignore
index 5e3dc940..a644c865 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,6 @@
build-stamp
/var
/etc/rear/site.conf
+.DS_Store
+.vscode
+servers
diff --git a/doc/user-guide/16-Rubrik-CDM.adoc b/doc/user-guide/16-Rubrik-CDM.adoc
new file mode 100644
index 00000000..41f37d20
--- /dev/null
+++ b/doc/user-guide/16-Rubrik-CDM.adoc
@@ -0,0 +1,106 @@
+= Documentation for the Rubrik Cloud Data Management (CDM) Backup and Restore Method
+
+== Summary
+
+The Rubrik CDM backup and restore method for ReaR allows Rubrik CDM to perform bare metal recovery of Linux systems that are supported by ReaR. It does this by including the installed Rubrik CDM RBS agent files in the ISO that is created by `rear mkrescue` via a pre-script in the fileset. The ISO is left in place under `/var/lib/rear/output/rear-<hostname>.iso` by default. During the fileset backup Rubrik will backup the main operating system files as well as the ReaR ISO file.
+
+Bare Metal Recovery is performed by first restoring the ReaR ISO file from Rubrik CDM to an alternate host. Next the host being restored is booted from the ISO via CD/DVD, USB, vSphere Datastore ISO, etc... Once booted running `rear recover` will prepare the host for restore and start the Rubrik CDM RBS agent. If the host has a new IP address the new RBS agent will need to be registered with the Rubrik cluster. Registration is not necessary if the recovery host is reusing the same IP address as the original. All of the files for the host are then recovered from Rubrik CDM to the recovery host's `/mnt/local` directory by the user. Once complete the user exit's ReaR and reboots the host.
+
+== Configuration
+
+1. Install and configure ReaR in accordance with:
+- Red Hat
+ * https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/ch-relax-and-recover_rear
+- Ubuntu
+ * http://manpages.ubuntu.com/manpages/disco/en/man8/rear.8.html
+- SUSE
+ * https://en.opensuse.org/SDB:Disaster_Recovery
+ * https://documentation.suse.com/sle-ha/15-SP1/html/SLE-HA-all/cha-ha-rear.html
+- Generic
+ * https://github.com/rear/rear
+
+ NOTE: Ignore any instructions to configure external storage like NFS, CIFS/SMB or ftp. Also ignore any instructions to configure a specific backup method. This will be taken care of in the next steps.
+
+ NOTE: Ignore any instructions to schedule ReaR to run via the host based scheduler (cron). Rubrik CDM will run ReaR via a pre-script in the fileset. If this is not preferred ReaR can be scheduled on the host, however, the ISOs created may not be in sync with the backups.
+
+ NOTE: If installing the pre-release or development version for which there is no installer, copy the repo to the host being protected. Then run `make install` from its root directory of the repo.
+
+1. Install the Rubrik CDM RBS agent as directed by the Rubrik documentation.
+1. Edit `/etc/rear/local.conf` and enter:
+
+ OUTPUT=ISO
+ BACKUP=CDM
+
+1. Test `ReaR` by running `rear -v mkrescue`
+1. Configure fileset backup of the host and add `/usr/sbin/rear mkrescue` as a prescript.
+1. ISOs will be saved as `/var/lib/rear/output/*.iso`
+
+- Recovery
+
+1. Recover `/var/lib/rear/output/rear-<hostname>.iso` from host to be restored.
+1. Boot recovery machine using recovered ISO.
+
+ NOTE: Recovered system will use the same networking as the original machine. Verify no IP conflicts will occur.
+
+ NOTE: If the same static IP address may be used it will need to be changed if the original machine is still running.
+
+1. Verify Firewall is down on recovery host.
+1. Run `rear recover`
+1. Answer inline questions until `rear>` prompt appears.
+1. Run `ps -eaf` and verify that `backup_agent_main` and `bootstrap_agent_main` are running.
+1. Get the IP address of the system using `ip addr`
+1. Register the new IP with the Rubrik appliance (if needed)
+1. Perform a re-directed export of `/` to `/mnt/local`
+1. Reboot
+1. Recover other file systems as needed.
+
+ Note: that the Rubrik RBS agent will connect as the original machine now. The host may need to be reinstalled and re-registered if the original machine is still running.
+
+== Known Issues
+
+* Recovery via IPv6 is not yet supported.
+* Automatic recovery from replica CDM cluster is not supported
+* CDM may take some time to recognize that the IP address has moved from one system to another. When restoring using the same IP give CDM up to 10 minutes to recognize that the agent is running on another machine. This usually comes up during testing when the original machine is shutdown but not being restored to.
+* Recovery from a replica CDM cluster is only supported with CDM v4.2.1 and higher.
+* Care must be taken with SUSE systems on DHCP. They tend to request the same IP as the original host. If this is not the desired behavior the system will have to be adjusted after booting from the ReaR ISO.
+* If multiple restores are performed using the same temporary IP, the temporary IP must first be deleted from Servers & Apps -> Linux and Unix Servers and re-added upon each reuse.
+* ReaR's `ldd` check of other binaries or libraries may result in libraries not being found. This can generally be fixed by adding the path to those libraries to the `LD_LIBRARY_PATH` variable in `/etc/rear/local.conf`. Do this by adding the following line in `/etc/rear/local.conf`:
++
+ export LD_LIBRARY_PATH-"$LD_LIBRARY_PATH:<path>"
++
+To make CentoOS v7.7 work the following line was needed:
++
+ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib64/bind9-export"
++
+To make CentOS v8.0 work the following line was needed:
++
+ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib64/bind9-export:/usr/lib64/eog:/usr/lib64/python3.6/site-packages:/usr/lib64/samba:/usr/lib64/firefox"
+
+== Troubleshooting
+
+* Verify that ReaR will recover your system without using the CDM backup and restore method. Most errors are due to configuration with ReaR itself and not Rubrik CDM. Use the default ReaR backup and restore method to test with.
+* Follow the OS specific configuration guides as mentioned at the beginning of this document.
+
+== Test Matrix
+
+.Test Matrix
+[%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,
+CentOS 7.6,Pass,,Pass,,Pass,,,,Pass,,Pass,
+CentOS 7.7,Pass,,Pass,Pass,Pass,,,,Pass,,Pass,
+CentOS 8.0,Pass,,Pass,,Pass,,,,Pass,,Pass,
+CentOS 5.11,,,,,,,,,,,,
+CentOS 6.10,,,,,,,,,,,,
+RHEL 7.6,Pass,,Pass,,Pass,,,,,,,
+RHEL 7.4,,,,,,,,,,,,
+RHEL 6.10,,,,,,,,,,,,
+SUSE 11 SP4,,,,,,,,,,,,
+SUSE 12 SP4,Pass (uses same IP as original),,Pass,,,,,,,Pass,Pass,
+Ubuntu 14.04 LTS,,,,,,,,,,,,
+Ubuntu 16.04 LTS,Pass,,,,Pass,,,Pass,,,Pass,
+Ubuntu 17.04 LTS,,,,,,,,,,,,
+|===
+
+* Empty cells indicate that no tests were run.
diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf
index 0f0d0675..56967132 100644
--- a/usr/share/rear/conf/default.conf
+++ b/usr/share/rear/conf/default.conf
@@ -1334,6 +1334,17 @@ LANG_RECOVER=C
# low-quality master encryption key. For details, see the cryptsetup(8) manual page.
LUKS_CRYPTSETUP_OPTIONS="--iter-time 2000 --use-random"
+##
+# BACKUP=CDM (Rubrik CDM; Cloud Data Managemnt)
+##
+# ReaR support for Rubrik Cloud Data Managment (CDM).
+# ReaR will copy the Rubrk RBS agent and required OS binaries to its ISO for incluson on boot.
+# ReaR will start the Rubrik RBS agent when 'rear recover' is run.
+COPY_AS_IS_CDM=( /etc/rubrik /usr/bin/rubrik /var/log/rubrik /etc/pki /usr/lib64 )
+COPY_AS_IS_EXCLUDE_CDM=( /var/log/rubrik/* )
+PROGS_CDM=( /usr/bin/rubrik/backup_agent_main /usr/bin/rubrik/bootstrap_agent_main openssl uuidgen )
+
+
##
# BACKUP=FDRUPSTREAM stuff
##
diff --git a/usr/share/rear/prep/CDM/default/400_prep_cdm.sh b/usr/share/rear/prep/CDM/default/400_prep_cdm.sh
new file mode 100644
index 00000000..d3fd11b7
--- /dev/null
+++ b/usr/share/rear/prep/CDM/default/400_prep_cdm.sh
@@ -0,0 +1,7 @@
+#
+# prepare stuff for CDM
+#
+
+COPY_AS_IS=( "${COPY_AS_IS[@]}" "${COPY_AS_IS_CDM[@]}" )
+COPY_AS_IS_EXCLUDE=( "${COPY_AS_IS_EXCLUDE[@]}" "${COPY_AS_IS_EXCLUDE_CDM[@]}" )
+PROGS=( "${PROGS[@]}" "${PROGS_CDM[@]}" fmt )
diff --git a/usr/share/rear/prep/CDM/default/450_check_cdm_client.sh b/usr/share/rear/prep/CDM/default/450_check_cdm_client.sh
new file mode 100644
index 00000000..637fac5f
--- /dev/null
+++ b/usr/share/rear/prep/CDM/default/450_check_cdm_client.sh
@@ -0,0 +1,13 @@
+# 450_check_cdm_client.sh
+#
+# This script checks if a Rubrik CDM client is installed and running
+#
+
+Log "Backup method is Rubrik (CDM): check backup_agent_main"
+if [ ! -x /usr/bin/rubrik/backup_agent_main ]; then
+ StopIfError 1 "Please install Rubrik (CDM) RBS client software."
+fi
+
+ps ax | grep -v grep | grep backup_agent_main
+StopIfError $? "Rubrik (CDM) RBS backup_agent_main was not running on this client."
+
diff --git a/usr/share/rear/restore/CDM/default/400_restore_with_cdm.sh b/usr/share/rear/restore/CDM/default/400_restore_with_cdm.sh
new file mode 100644
index 00000000..bc4811c4
--- /dev/null
+++ b/usr/share/rear/restore/CDM/default/400_restore_with_cdm.sh
@@ -0,0 +1,19 @@
+# 400_restore_with_cdm.sh
+#
+#
+
+LogPrint "Please start the restore process on the Rubrik (CDM) cluster."
+
+if is_true $CDM_NEW_AGENT_UUID; then
+ LogPrint ""
+ LogPrint "Register the appropriate IP address from this list with Rubrik (CDM):"
+ LogPrint "$( ip addr | grep inet | cut -d / -f 1 | grep -v 127.0.0.1 | grep -v ::1 )"
+ LogPrint ""
+fi
+LogPrint "Make sure all required data is restored to $TARGET_FS_ROOT ."
+LogPrint ""
+LogPrint "Next type 'exit' to continue the recovery."
+LogPrint "Info: You can check the recovery process i.e. with the command 'df'."
+LogPrint ""
+
+rear_shell "Has the restore been completed and are you ready to continue the recovery?"
diff --git a/usr/share/rear/verify/CDM/default/410_use_replica_cdm_cluster_cert.sh b/usr/share/rear/verify/CDM/default/410_use_replica_cdm_cluster_cert.sh
new file mode 100644
index 00000000..518387e3
--- /dev/null
+++ b/usr/share/rear/verify/CDM/default/410_use_replica_cdm_cluster_cert.sh
@@ -0,0 +1,88 @@
+# 410_use_replica_cdm_cluster_cert.sh
+# If restoring from a replica Rubrik (CDM) cluster use its cert for RBS.
+
+LogPrint "If restoring from a replica Rubrik (CDM) cluster its cert will be downloaded and used for RBS"
+
+CDM_RBA_DIR=/etc/rubrik
+CDM_KEYS_DIR=${CDM_RBA_DIR}/keys
+
+local prompt="Is the data being restored from the original CDM Cluster?"
+local input_value=""
+local wilful_input=""
+while true ; do
+ # Find out if the restore is being done from the original CDM cluster or a Replica
+ # the default (i.e. the automated response after the timeout) should be 'no':
+ input_value="$( UserInput -I CDM_REPLICA_CLUSTER -p "$prompt" -D 'no' )" && wilful_input="yes" || wilful_input="no"
+ if is_false "$input_value" ; then
+ if is_true "$wilful_input" ; then
+ LogPrint "User confirmed the data is not being restored from the original CDM Cluster"
+ else
+ LogPrint "Assuming the data is not being restored from the original CDM Cluster"
+ fi
+ break
+ fi
+ if is_true "$input_value" ; then
+ LogPrint "User confirmed the data is being restored from the original CDM Cluster"
+ return 0
+ fi
+done
+
+LogPrint "Downloading cert from replica CDM cluster"
+# The name of the tar file that is being downloaded has changed in Rubrik CDM v5.1.
+# Before Rubrik CDM v5.1 it was rubrik-agent-sunos5.10.sparc.tar.gz
+# since Rubrik CDM v5.1 it is rubrik-agent-solaris.sparc.tar.gz
+# cf. https://github.com/rear/rear/issues/2441
+CDM_SUNOS_TAR=rubrik-agent-sunos5.10.sparc.tar.gz
+CDM_SOLARIS_TAR=rubrik-agent-solaris.sparc.tar.gz
+pushd $TMPDIR
+while true ; do
+ prompt="Enter one of the IP addresses for the replica CDM cluster (or 'no' to cancel)"
+ CDM_CLUSTER_IP="$( UserInput -I CDM_CLUSTER_IP -r -t 0 -p "$prompt" )"
+ test $CDM_CLUSTER_IP || continue
+ if is_false "$CDM_CLUSTER_IP" ; then
+ LogPrint "User canceled downloading cert from replica CDM cluster (data restore may fail now)"
+ popd
+ return 0
+ fi
+ # When curl fails for all files continue with an empty CDM_TAR_FILE to denote that nothing was downloaded:
+ for CDM_TAR_FILE in $CDM_SOLARIS_TAR $CDM_SUNOS_TAR '' ; do
+ test $CDM_TAR_FILE || continue
+ curl $v -fskLOJ https://${CDM_CLUSTER_IP}/connector/${CDM_TAR_FILE} && break
+ done
+ if ! test -s "$CDM_TAR_FILE" ; then
+ LogPrintError "Could not download Rubrik agent from https://${CDM_CLUSTER_IP}/connector/${CDM_SOLARIS_TAR} or https://${CDM_CLUSTER_IP}/connector/${CDM_SUNOS_TAR}"
+ while true ; do
+ prompt="Enter URL to download Rubrik agent tar archive (or 'no' to cancel)"
+ CDM_AGENT_URL="$( UserInput -I CDM_AGENT_URL -r -t 0 -p "$prompt" )"
+ test $CDM_AGENT_URL || continue
+ if is_false "$CDM_AGENT_URL" ; then
+ LogPrint "User canceled downloading Rubrik agent (data restore may fail now)"
+ popd
+ return 0
+ fi
+ curl $v -fskLOJ $CDM_AGENT_URL && break
+ LogPrintError "Could not download Rubrik agent from $CDM_AGENT_URL"
+ done
+ CDM_TAR_FILE=$( basename "$CDM_AGENT_URL" )
+ fi
+ if ! tar $v -xzf $CDM_TAR_FILE ; then
+ LogPrintError "Could not extract Rubrik agent (failed to 'tar -xzf $CDM_TAR_FILE')"
+ continue
+ fi
+ CDM_CERT_FILE=$(find ./ -name "rubrik.crt")
+ mv $v ${CDM_KEYS_DIR}/rubrik.crt ${CDM_KEYS_DIR}/rubrik.crt.orig
+ if ! cp $v $CDM_CERT_FILE $CDM_KEYS_DIR ; then
+ LogPrintError "Could not copy replica CDM cluster certificate"
+ continue
+ fi
+ chmod $v 600 ${CDM_KEYS_DIR}/rubrik.crt
+ mv $v ${CDM_KEYS_DIR}/agent.crt ${CDM_KEYS_DIR}/agent.crt.orig
+ mv $v ${CDM_KEYS_DIR}/agent.pem ${CDM_KEYS_DIR}/agent.pem.orig
+ # TODO: Actually do something if /etc/rubrik/rba-keygen.sh failed.
+ # Is /etc/rubrik/rba-keygen.sh perhaps only optional?
+ # cf. https://github.com/rear/rear/pull/2445#discussion_r448217873
+ /etc/rubrik/rba-keygen.sh || LogPrintError "/etc/rubrik/rba-keygen.sh failed (data restore may also fail)"
+ break
+done
+popd
+LogPrint "Replica Rubrik (CDM) cluster certificate installed"
diff --git a/usr/share/rear/verify/CDM/default/430_gen_rbs_uuid_for_cdm.sh b/usr/share/rear/verify/CDM/default/430_gen_rbs_uuid_for_cdm.sh
new file mode 100644
index 00000000..5e99b79c
--- /dev/null
+++ b/usr/share/rear/verify/CDM/default/430_gen_rbs_uuid_for_cdm.sh
@@ -0,0 +1,29 @@
+# 430_gen_rbs_uuid_for_cdm.sh
+# Reset the UUID used by RBS if the IP address has changed
+
+CDM_RBA_DIR=/etc/rubrik
+CDM_AGENT_UUID=${CDM_RBA_DIR}/conf/uuid
+
+# When USER_INPUT_CDM_SAME_AGENT_UUID has Does this client have the same IP address as the original 'y' was actually meant:
+LogPrint ""
+LogPrint "Found the following IP addresses on this system:"
+LogPrint "$( ip addr | grep inet | cut -d / -f 1 | grep -v 127.0.0.1 | grep -v ::1 )"
+LogPrint ""
+is_true "$USER_INPUT_CDM_SAME_AGENT_UUID" && USER_INPUT_SAME_AGENT_UUID="y"
+while true ; do
+ # Find out if the IP address has changed from the original. If so generate a new UUID.
+ # the default (i.e. the automated response after the timeout) should be 'n':
+ answer="$( UserInput -I CDM_SAME_AGENT_UUID -p "Does this client have the same IP address as the original? (y/n)" -D 'y' -t 300 )"
+ is_true "$answer" && return 0
+ if is_false "$answer" ; then
+ break
+ fi
+ UserOutput "Please answer 'y' or 'n'"
+done
+
+mv $v ${CDM_AGENT_UUID} ${CDM_AGENT_UUID}.old
+/usr/bin/uuidgen | tee -a ${CDM_AGENT_UUID} >&2
+StopIfError "Unable to generate new UUID"
+
+CDM_NEW_AGENT_UUID="true"
+LogPrint "Rubrik (CDM) RBS agent now has new UUID."
diff --git a/usr/share/rear/verify/CDM/default/450_start_cdm_rbs.sh b/usr/share/rear/verify/CDM/default/450_start_cdm_rbs.sh
new file mode 100644
index 00000000..571da1da
--- /dev/null
+++ b/usr/share/rear/verify/CDM/default/450_start_cdm_rbs.sh
@@ -0,0 +1,17 @@
+# 450_start_cdm_rbs.sh
+# Start the Rubrik (CDM) RBS Agent
+
+RBA_DIR=/etc/rubrik
+RBA_BIN_DIR=/usr/bin/rubrik
+
+BOOTSTRAP_DAEMON_OPTS="$( < ${RBA_DIR}/conf/bootstrap_flags.conf )"
+AGENT_DAEMON_OPTS="$( < ${RBA_DIR}/conf/agent_flags.conf )"
+BOOTSTRAP_DAEMON=$RBA_BIN_DIR/bootstrap_agent_main
+AGENT_DAEMON=$RBA_BIN_DIR/backup_agent_main
+
+$BOOTSTRAP_DAEMON $BOOTSTRAP_DAEMON_OPTS
+StopIfError "Unable to start RBS Bootstrap service"
+$AGENT_DAEMON $AGENT_DAEMON_OPTS
+StopIfError "Unable to start RBS Agent service"
+
+LogPrint "Rubrik (CDM) RBS agent started."

View File

@ -0,0 +1,112 @@
diff --git a/usr/share/rear/layout/prepare/GNU/Linux/110_include_lvm_code.sh b/usr/share/rear/layout/prepare/GNU/Linux/110_include_lvm_code.sh
index 7cfdfcf2..1be17ba8 100644
--- a/usr/share/rear/layout/prepare/GNU/Linux/110_include_lvm_code.sh
+++ b/usr/share/rear/layout/prepare/GNU/Linux/110_include_lvm_code.sh
@@ -68,9 +68,9 @@ create_lvmgrp() {
local vg=${vgrp#/dev/}
cat >> "$LAYOUT_CODE" <<EOF
-create_volume_group=1
-create_logical_volumes=1
-create_thin_volumes_only=0
+create_volume_group+=( "$vg" )
+create_logical_volumes+=( "$vg" )
+create_thin_volumes_only=( \$( RmInArray "$vg" "\${create_thin_volumes_only[@]}" ) )
EOF
@@ -83,7 +83,7 @@ EOF
# '--mirrorlog', etc.
# Also, we likely do not support every layout yet (e.g. 'cachepool').
- if ! is_true "$MIGRATION_MODE" ; then
+ if ! is_true "$MIGRATION_MODE" && lvmgrp_supports_vgcfgrestore "$vgrp" ; then
cat >> "$LAYOUT_CODE" <<EOF
LogPrint "Restoring LVM VG '$vg'"
if [ -e "$vgrp" ] ; then
@@ -97,9 +97,12 @@ if lvm vgcfgrestore -f "$VAR_DIR/layout/lvm/${vg}.cfg" $vg >&2 ; then
LogPrint "Sleeping 3 seconds to let udev or systemd-udevd create their devices..."
sleep 3 >&2
- create_volume_group=0
- create_logical_volumes=0
+ create_volume_group=( \$( RmInArray "$vg" "\${create_volume_group[@]}" ) )
+ create_logical_volumes=( \$( RmInArray "$vg" "\${create_logical_volumes[@]}" ) )
+EOF
+ if is_true "${FORCE_VGCFGRESTORE-no}"; then
+ cat >> "$LAYOUT_CODE" <<EOF
#
# It failed ... restore layout using 'vgcfgrestore --force', but then remove Thin volumes, they are broken
#
@@ -121,9 +124,12 @@ elif lvm vgcfgrestore --force -f "$VAR_DIR/layout/lvm/${vg}.cfg" $vg >&2 ; then
sleep 3 >&2
# All logical volumes have been created, except Thin volumes and pools
- create_volume_group=0
- create_thin_volumes_only=1
+ create_volume_group=( \$( RmInArray "$vg" "\${create_volume_group[@]}" ) )
+ create_thin_volumes_only+=( "$vg" )
+EOF
+ fi
+ cat >> "$LAYOUT_CODE" <<EOF
#
# It failed also ... restore using 'vgcreate/lvcreate' commands
#
@@ -138,7 +144,7 @@ EOF
local -a devices=($(awk "\$1 == \"lvmdev\" && \$2 == \"$vgrp\" { print \$3 }" "$LAYOUT_FILE"))
cat >> "$LAYOUT_CODE" <<EOF
-if [ \$create_volume_group -eq 1 ] ; then
+if IsInArray $vg "\${create_volume_group[@]}" ; then
LogPrint "Creating LVM VG '$vg'; Warning: some properties may not be preserved..."
if [ -e "$vgrp" ] ; then
rm -rf "$vgrp"
@@ -240,9 +246,9 @@ create_lvmvol() {
local warnraidline
if [ $is_thin -eq 0 ] ; then
- ifline="if [ \"\$create_logical_volumes\" -eq 1 ] && [ \"\$create_thin_volumes_only\" -eq 0 ] ; then"
+ ifline="if IsInArray $vg \"\${create_logical_volumes[@]}\" && ! \$IsInArray $vg \"\${create_thin_volumes_only[@]}\" ; then"
else
- ifline="if [ \"\$create_logical_volumes\" -eq 1 ] ; then"
+ ifline="if IsInArray $vg \"\${create_logical_volumes[@]}\" ; then"
fi
if [ $is_raidunknown -eq 1 ]; then
diff --git a/usr/share/rear/lib/layout-functions.sh b/usr/share/rear/lib/layout-functions.sh
index 54ddb50f..ae62d666 100644
--- a/usr/share/rear/lib/layout-functions.sh
+++ b/usr/share/rear/lib/layout-functions.sh
@@ -1308,4 +1308,30 @@ delete_dummy_partitions_and_resize_real_ones() {
last_partition_number=0
}
+# vgcfgrestore can properly restore only volume groups that do not use
+# any kernel metadata. All volume types except linear and striped use
+# kernel metadata.
+# Check whether a VG (given as /dev/<vgname> in the first argument)
+# doesn't contain any LVs that use kernel metadata.
+# If the function returns true, we can safely use vgcfgrestore to restore the VG.
+function lvmgrp_supports_vgcfgrestore() {
+ if is_true "${FORCE_VGCFGRESTORE-no}"; then
+ # If we are willing to use vgcfgrestore --force and then remove broken volumes,
+ # then everything can be considered supported. Don't do it by default though.
+ return 0
+ fi
+
+ local lvmvol vgrp lvname size layout kval
+
+ local supported_layouts=("linear" "striped")
+
+ while read lvmvol vgrp lvname size layout kval; do
+ [ "$vgrp" == "$1" ] || BugError "vgrp '$vgrp' != '$1'"
+ if ! IsInArray $layout "${supported_layouts[@]}"; then
+ LogPrint "Layout '$layout' of LV '$lvname' in VG '$vgrp' not supported by vgcfgrestore"
+ return 1
+ fi
+ done < <(grep "^lvmvol $1 " "$LAYOUT_FILE")
+}
+
# vim: set et ts=4 sw=4:

View File

@ -1,8 +1,23 @@
diff -up rear-2.4/usr/share/rear/layout/prepare/GNU/Linux/160_include_luks_code.sh.orig rear-2.4/usr/share/rear/layout/prepare/GNU/Linux/160_include_luks_code.sh
--- rear-2.4/usr/share/rear/layout/prepare/GNU/Linux/160_include_luks_code.sh.orig 2018-06-21 10:40:53.000000000 +0200
+++ rear-2.4/usr/share/rear/layout/prepare/GNU/Linux/160_include_luks_code.sh 2020-11-25 09:21:55.186716041 +0100
@@ -1,35 +1,74 @@
# Code to recreate LUKS volumes.
diff --git a/doc/user-guide/06-layout-configuration.adoc b/doc/user-guide/06-layout-configuration.adoc
index f59384db..88ba0420 100644
--- a/doc/user-guide/06-layout-configuration.adoc
+++ b/doc/user-guide/06-layout-configuration.adoc
@@ -630,7 +630,7 @@ lvmvol <volume_group> <name> <size(bytes)> <layout> [key:value ...]
=== LUKS Devices ===
----------------------------------
-crypt /dev/mapper/<name> <device> [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>] [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 05279bc8..0c662f67 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
@@ -1,35 +1,75 @@
+
# Code to recreate and/or open LUKS volumes.
create_crypt() {
+ # See the create_device() function in lib/layout-functions.sh what "device type" means:
@ -63,38 +78,38 @@ diff -up rear-2.4/usr/share/rear/layout/prepare/GNU/Linux/160_include_luks_code.
+ ;;
+ (cipher)
+ test $value && cryptsetup_options+=" --cipher $value"
;;
- key_size)
- cryptsetup_options+=" --key-size $value"
+ ;;
+ (key_size)
+ test $value && cryptsetup_options+=" --key-size $value"
;;
- hash)
- cryptsetup_options+=" --hash $value"
- key_size)
- cryptsetup_options+=" --key-size $value"
+ (hash)
+ test $value && cryptsetup_options+=" --hash $value"
;;
- uuid)
- cryptsetup_options+=" --uuid $value"
- hash)
- cryptsetup_options+=" --hash $value"
+ (uuid)
+ test $value && cryptsetup_options+=" --uuid $value"
;;
- keyfile)
- keyfile=$value
- uuid)
- cryptsetup_options+=" --uuid $value"
+ (keyfile)
+ test $value && keyfile=$value
;;
- password)
- password=$value
- keyfile)
- keyfile=$value
+ (password)
+ test $value && password=$value
+ ;;
;;
- password)
- password=$value
+ (*)
+ LogPrintError "Skipping unsupported LUKS cryptsetup option '$key' in 'crypt $target_device $source_device' entry in $LAYOUT_FILE"
;;
esac
done
@@ -37,26 +76,25 @@ create_crypt() {
@@ -37,26 +77,25 @@ create_crypt() {
cryptsetup_options+=" $LUKS_CRYPTSETUP_OPTIONS"
(
@ -128,33 +143,122 @@ diff -up rear-2.4/usr/share/rear/layout/prepare/GNU/Linux/160_include_luks_code.
fi
echo ""
) >> "$LAYOUT_CODE"
diff -up rear-2.4/usr/share/rear/layout/save/GNU/Linux/260_crypt_layout.sh.orig rear-2.4/usr/share/rear/layout/save/GNU/Linux/260_crypt_layout.sh
--- rear-2.4/usr/share/rear/layout/save/GNU/Linux/260_crypt_layout.sh.orig 2018-06-21 10:40:53.000000000 +0200
+++ rear-2.4/usr/share/rear/layout/save/GNU/Linux/260_crypt_layout.sh 2020-11-25 09:19:31.406669210 +0100
@@ -64,38 +103,61 @@ create_crypt() {
# Function open_crypt() is meant to be used by the 'mountonly' workflow
open_crypt() {
+ # See the do_mount_device() function in lib/layout-functions.sh what "device type" means:
+ local device_type="$1"
+ if ! grep -q "^crypt $device_type " "$LAYOUT_FILE" ; then
+ LogPrintError "Skip opening LUKS volume $device_type (no 'crypt $device_type' entry in $LAYOUT_FILE)"
+ # FIXME: The return code is ignored in the do_mount_device() function in lib/layout-functions.sh:
+ return 1
+ fi
+
local crypt target_device source_device options
- read crypt target_device source_device options < <(grep "^crypt $1 " "$LAYOUT_FILE")
+ local mapping_name option key value
+ local cryptsetup_options="" keyfile="" password=""
- local target_name=${target_device#/dev/mapper/}
+ read crypt target_device source_device options < <( grep "^crypt $device_type " "$LAYOUT_FILE" )
+
+ if ! test -b "$source_device" ; then
+ LogPrintError "Skip opening LUKS volume $device_type on device '$source_device' that is no block device (see the 'crypt $device_type' entry in $LAYOUT_FILE)"
+ # FIXME: The return code is ignored in the do_mount_device() function in lib/layout-functions.sh:
+ return 1
+ fi
+
+ mapping_name=${target_device#/dev/mapper/}
+ if ! test $mapping_name ; then
+ LogPrintError "Skip opening LUKS volume $device_type on $source_device: No /dev/mapper/... mapping name (see the 'crypt $device_type' entry in $LAYOUT_FILE)"
+ # FIXME: The return code is ignored in the do_mount_device() function in lib/layout-functions.sh:
+ return 1
+ fi
- local cryptsetup_options="" keyfile="" password=""
- local option key value
for option in $options ; do
- key=${option%=*}
+ # $option is of the form keyword=value and
+ # we assume keyword has no '=' character but value could be anything that may have a '=' character
+ # so we split keyword=value at the leftmost '=' character so that
+ # e.g. keyword=foo=bar gets split into key="keyword" and value="foo=bar":
+ key=${option%%=*}
value=${option#*=}
-
case "$key" in
- keyfile)
- keyfile=$value
+ (keyfile)
+ test $value && keyfile=$value
;;
- password)
- password=$value
+ (password)
+ test $value && password=$value
;;
esac
done
(
- echo "Log \"Opening LUKS device $target_name on $source_device\""
+ echo "LogPrint \"Opening LUKS volume $mapping_name on $source_device\""
if [ -n "$keyfile" ] ; then
# During a 'mountonly' workflow, the original keyfile is supposed to be
# available at this point.
- echo "cryptsetup luksOpen --key-file $keyfile $source_device $target_name"
+ echo "cryptsetup luksOpen --key-file $keyfile $source_device $mapping_name"
elif [ -n "$password" ] ; then
- echo "echo \"$password\" | cryptsetup luksOpen $source_device $target_name"
+ echo "echo \"$password\" | cryptsetup luksOpen $source_device $mapping_name"
else
- echo "LogPrint \"Please enter the password for LUKS device $target_name ($source_device):\""
- echo "cryptsetup luksOpen $source_device $target_name"
+ echo "LogUserOutput \"Enter the password for LUKS volume $mapping_name (for 'cryptsetup luksOpen' on $source_device):\""
+ echo "cryptsetup luksOpen $source_device $mapping_name"
fi
echo ""
) >> "$LAYOUT_CODE"
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 c1e1cfd5..afeabf6a 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
@@ -9,6 +9,8 @@ Log "Saving Encrypted volumes."
REQUIRED_PROGS=( "${REQUIRED_PROGS[@]}" cryptsetup dmsetup )
COPY_AS_IS=( "${COPY_AS_IS[@]}" /usr/share/cracklib/\* /etc/security/pwquality.conf )
REQUIRED_PROGS+=( cryptsetup dmsetup )
COPY_AS_IS+=( /usr/share/cracklib/\* /etc/security/pwquality.conf )
+local invalid_cryptsetup_option_value="no"
+
while read target_name junk ; do
# find the target device we're mapping
if ! [ -e /dev/mapper/$target_name ] ; then
@@ -30,17 +32,96 @@ while read target_name junk ; do
@@ -30,29 +32,96 @@ while read target_name junk ; do
source_device="$(get_device_name ${slave##*/})"
done
- if ! cryptsetup isLuks $source_device >/dev/null 2>&1; then
+ if ! blkid -p -o export $source_device >$TMP_DIR/blkid.output ; then
+ LogPrintError "Error: Cannot get attributes for $target_name ('blkid -p -o export $source_device' failed)"
+ continue
+ fi
+
continue
fi
- # gather crypt information
- cipher=$(cryptsetup luksDump $source_device | grep "Cipher name" | sed -r 's/^.+:\s*(.+)$/\1/')
- mode=$(cryptsetup luksDump $source_device | grep "Cipher mode" | cut -d: -f2- | awk '{printf("%s",$1)};')
- key_size=$(cryptsetup luksDump $source_device | grep "MK bits" | sed -r 's/^.+:\s*(.+)$/\1/')
- hash=$(cryptsetup luksDump $source_device | grep "Hash spec" | sed -r 's/^.+:\s*(.+)$/\1/')
- uuid=$(cryptsetup luksDump $source_device | grep "UUID" | sed -r 's/^.+:\s*(.+)$/\1/')
- keyfile_option=$([ -f /etc/crypttab ] && awk '$1 == "'"$target_name"'" && $3 != "none" && $3 != "-" && $3 != "" { print "keyfile=" $3; }' /etc/crypttab)
+ if ! grep -q "TYPE=crypto_LUKS" $TMP_DIR/blkid.output ; then
+ Log "Skipping $target_name (no 'TYPE=crypto_LUKS' in 'blkid -p -o export $source_device' output)"
+ continue
+ fi
+
- # LUKS version 2 is not yet suppported, see https://github.com/rear/rear/issues/2204
- # When LUKS version 2 is used the above code fails at least to determine the hash value
- # so we use an empty hash value as a simple test if gathering crypt information was successful:
- test "$hash" || Error "No hash value for LUKS device '$target_name' at '$source_device' (only LUKS version 1 is supported)"
+ # Detect LUKS version:
+ # Remove all non-digits in particular to avoid leading or trailing spaces in the version string
+ # cf. "Beware of the emptiness" in https://github.com/rear/rear/wiki/Coding-Style
@ -165,12 +269,14 @@ diff -up rear-2.4/usr/share/rear/layout/save/GNU/Linux/260_crypt_layout.sh.orig
+ continue
+ fi
+ luks_type=luks$version
+
- echo "crypt /dev/mapper/$target_name $source_device cipher=$cipher-$mode key_size=$key_size hash=$hash uuid=$uuid $keyfile_option" >> $DISKLAYOUT_FILE
-done < <( dmsetup ls --target crypt )
+ # 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)"
continue
fi
+ 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 )
+ if test $luks_type = "luks1" ; then
@ -193,13 +299,11 @@ diff -up rear-2.4/usr/share/rear/layout/save/GNU/Linux/260_crypt_layout.sh.orig
+ hash=$( grep "Hash" $TMP_DIR/cryptsetup.luksDump | sed -r 's/^.+:\s*(.+)$/\1/' )
+ fi
- # gather crypt information
- cipher=$(cryptsetup luksDump $source_device | grep "Cipher name" | sed -r 's/^.+:\s*(.+)$/\1/')
- mode=$(cryptsetup luksDump $source_device | grep "Cipher mode" | cut -d: -f2- | awk '{printf("%s",$1)};')
- key_size=$(cryptsetup luksDump $source_device | grep "MK bits" | sed -r 's/^.+:\s*(.+)$/\1/')
- hash=$(cryptsetup luksDump $source_device | grep "Hash spec" | sed -r 's/^.+:\s*(.+)$/\1/')
- uuid=$(cryptsetup luksDump $source_device | grep "UUID" | sed -r 's/^.+:\s*(.+)$/\1/')
- keyfile_option=$([ -f /etc/crypttab ] && awk '$1 == "'"$target_name"'" && $3 != "none" && $3 != "-" { print "keyfile=" $3; }' /etc/crypttab)
-# cryptsetup is required in the recovery system if disklayout.conf contains at least one 'crypt' entry
-# see the create_crypt function in layout/prepare/GNU/Linux/160_include_luks_code.sh
-# what program calls are written to diskrestore.sh
-# cf. https://github.com/rear/rear/issues/1963
-grep -q '^crypt ' $DISKLAYOUT_FILE && REQUIRED_PROGS+=( cryptsetup ) || true
+ # Basic checks that the cipher key_size hash uuid values exist
+ # cf. https://github.com/rear/rear/pull/2504#issuecomment-718729198
+ # because some values are needed during "rear recover"
@ -240,9 +344,8 @@ diff -up rear-2.4/usr/share/rear/layout/save/GNU/Linux/260_crypt_layout.sh.orig
+ 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 "crypt /dev/mapper/$target_name $source_device cipher=$cipher-$mode key_size=$key_size hash=$hash uuid=$uuid $keyfile_option" >> $DISKLAYOUT_FILE
done < <( dmsetup ls --target crypt )
+
+done < <( dmsetup ls --target crypt )
+# Let this script return successfully when invalid_cryptsetup_option_value is not true:
+is_true $invalid_cryptsetup_option_value && Error "Invalid or empty LUKS cryptsetup option value(s) in $DISKLAYOUT_FILE" || true

View File

@ -1,60 +0,0 @@
From 2dbd93153df83aef0d413c104335b4e035a81c02 Mon Sep 17 00:00:00 2001
From: Gratien D'haese <gratien.dhaese@gmail.com>
Date: Thu, 16 Apr 2020 16:54:18 +0200
Subject: [PATCH] skip Longhorn Engine replica devices
Resolves: https://github.com/rear/rear/issues/2365
Signed-off-by: Gratien D'haese <gratien.dhaese@gmail.com>
---
.../save/GNU/Linux/230_filesystem_layout.sh | 31 ++++++++++++++++++-
1 file changed, 30 insertions(+), 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 60306718..afc658a6 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
@@ -111,10 +111,39 @@ fi
# but ensure docker_root_dir is not empty (otherwise any mountpoint string matches "^" which
# would skip all mountpoints), see https://github.com/rear/rear/issues/1989#issuecomment-456054278
if test "$docker_root_dir" ; then
- if echo "$mountpoint" | grep -q "^$docker_root_dir" ; then
+ if echo "$mountpoint" | grep -q "^${docker_root_dir}/" ; then
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
# Replace a symbolic link /dev/disk/by-uuid/a1b2c3 -> ../../sdXn
--
2.25.4

View File

@ -1,14 +0,0 @@
diff -up rear-2.4/usr/share/rear/conf/default.conf.orig rear-2.4/usr/share/rear/conf/default.conf
--- rear-2.4/usr/share/rear/conf/default.conf.orig 2020-12-02 10:12:49.617305887 +0100
+++ rear-2.4/usr/share/rear/conf/default.conf 2020-12-02 10:12:49.628306023 +0100
@@ -592,8 +592,8 @@ ISO_MAX_SIZE=
# ebiso (https://github.com/gozora/ebiso/) can be used as alternative
# for mkisofs/genisoimage on UEFI bootable systems
# to use ebiso, specify ISO_MKISOFS_BIN=<full_path_to_ebiso>/ebiso
-# in /etc/rear/local.conf or /etc/rear/site.conv
-# xorisofs is now used as the preferred method for generating the iso image
+# in /etc/rear/local.conf or /etc/rear/site.conf
+# xorrisofs is now used as the preferred method for generating the iso image
# with mkisofs and genisoimage as second and third option
ISO_MKISOFS_BIN="$( type -p xorrisofs || type -p mkisofs || type -p genisoimage )"

View File

@ -0,0 +1,693 @@
diff --git a/usr/share/rear/backup/NETFS/default/500_make_backup.sh b/usr/share/rear/backup/NETFS/default/500_make_backup.sh
index 02c204c5..60c80b5f 100644
--- a/usr/share/rear/backup/NETFS/default/500_make_backup.sh
+++ b/usr/share/rear/backup/NETFS/default/500_make_backup.sh
@@ -16,6 +16,8 @@ function set_tar_features () {
FEATURE_TAR_IS_SET=1
}
+local backup_prog_rc
+
local scheme=$( url_scheme $BACKUP_URL )
local path=$( url_path $BACKUP_URL )
local opath=$( backup_path $scheme $path )
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 c560ec94..1692ba4c 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
@@ -1,5 +1,7 @@
# Start SELinux if it was stopped - check presence of $TMP_DIR/selinux.mode
+local backup_prog_rc
+
[ -f $TMP_DIR/selinux.mode ] && {
touch "${TMP_DIR}/selinux.autorelabel"
cat $TMP_DIR/selinux.mode > $SELINUX_ENFORCE
@@ -13,19 +15,19 @@
ssh $RSYNC_USER@$RSYNC_HOST "chmod $v 755 ${RSYNC_PATH}/${RSYNC_PREFIX}/backup" 2>/dev/null
$BACKUP_PROG -a "${TMP_DIR}/selinux.autorelabel" \
"$RSYNC_USER@$RSYNC_HOST:${RSYNC_PATH}/${RSYNC_PREFIX}/backup/.autorelabel" 2>/dev/null
- _rc=$?
- if [ $_rc -ne 0 ]; then
- LogPrint "Failed to create .autorelabel on ${RSYNC_PATH}/${RSYNC_PREFIX}/backup [${rsync_err_msg[$_rc]}]"
+ 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"
fi
;;
(rsync)
- $BACKUP_PROG -a "${TMP_DIR}/selinux.autorelabel" ${BACKUP_RSYNC_OPTIONS[@]} \
+ $BACKUP_PROG -a "${TMP_DIR}/selinux.autorelabel" "${BACKUP_RSYNC_OPTIONS[@]}" \
"${RSYNC_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/${RSYNC_PATH}/${RSYNC_PREFIX}/backup/.autorelabel"
- _rc=$?
- if [ $_rc -ne 0 ]; then
- LogPrint "Failed to create .autorelabel on ${RSYNC_PATH}/${RSYNC_PREFIX}/backup [${rsync_err_msg[$_rc]}]"
+ 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"
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 cae12e38..9a17d6bb 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
@@ -1,3 +1,5 @@
+local backup_prog_rc
+
[ -f $TMP_DIR/force.autorelabel ] && {
> "${TMP_DIR}/selinux.autorelabel"
@@ -11,19 +13,19 @@
ssh $RSYNC_USER@$RSYNC_HOST "chmod $v 755 ${RSYNC_PATH}/${RSYNC_PREFIX}/backup" 2>/dev/null
$BACKUP_PROG -a "${TMP_DIR}/selinux.autorelabel" \
"$RSYNC_USER@$RSYNC_HOST:${RSYNC_PATH}/${RSYNC_PREFIX}/backup/.autorelabel" 2>/dev/null
- _rc=$?
- if [ $_rc -ne 0 ]; then
- LogPrint "Failed to create .autorelabel on ${RSYNC_PATH}/${RSYNC_PREFIX}/backup [${rsync_err_msg[$_rc]}]"
+ 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"
fi
;;
(rsync)
- $BACKUP_PROG -a "${TMP_DIR}/selinux.autorelabel" ${BACKUP_RSYNC_OPTIONS[@]} \
+ $BACKUP_PROG -a "${TMP_DIR}/selinux.autorelabel" "${BACKUP_RSYNC_OPTIONS[@]}" \
"${RSYNC_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/${RSYNC_PATH}/${RSYNC_PREFIX}/backup/.autorelabel"
- _rc=$?
- if [ $_rc -ne 0 ]; then
- LogPrint "Failed to create .autorelabel on ${RSYNC_PATH}/${RSYNC_PREFIX}/backup [${rsync_err_msg[$_rc]}]"
+ 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"
fi
;;
@@ -35,8 +37,7 @@
# probably using the BACKUP=NETFS workflow instead
if [ -d "${opath}" ]; then
if [ ! -f "${opath}/selinux.autorelabel" ]; then
- > "${opath}/selinux.autorelabel"
- StopIfError "Failed to create selinux.autorelabel on ${opath}"
+ > "${opath}/selinux.autorelabel" || Error "Failed to create selinux.autorelabel on ${opath}"
fi
fi
;;
diff --git a/usr/share/rear/backup/RSYNC/default/200_check_rsync_relative_option.sh b/usr/share/rear/backup/RSYNC/default/200_check_rsync_relative_option.sh
index 60330007..cedee9ce 100644
--- a/usr/share/rear/backup/RSYNC/default/200_check_rsync_relative_option.sh
+++ b/usr/share/rear/backup/RSYNC/default/200_check_rsync_relative_option.sh
@@ -4,7 +4,7 @@
# check for the --relative option in BACKUP_RSYNC_OPTIONS array
# for the default values see the standard definition in conf/default.conf file
-if ! grep -q relative <<< $(echo ${BACKUP_RSYNC_OPTIONS[@]}); then
+if ! grep -q relative <<< "${BACKUP_RSYNC_OPTIONS[*]}" ; then
BACKUP_RSYNC_OPTIONS+=( --relative )
Log "Added option '--relative' to the BACKUP_RSYNC_OPTIONS array during $WORKFLOW workflow"
fi
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 0d67d362..750a04ca 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
@@ -2,6 +2,9 @@
# 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 backup_prog_rc
+local backup_log_message
+
Log "Include list:"
while read -r ; do
Log " $REPLY"
@@ -11,9 +14,9 @@ while read -r ; do
Log " $REPLY"
done < $TMP_DIR/backup-exclude.txt
-LogPrint "Creating $BACKUP_PROG archive on '${RSYNC_HOST}:${RSYNC_PATH}'"
+LogPrint "Creating $BACKUP_PROG backup on '${RSYNC_HOST}:${RSYNC_PATH}'"
-ProgressStart "Running archive operation"
+ProgressStart "Running backup operation"
(
case "$(basename $BACKUP_PROG)" in
@@ -37,7 +40,7 @@ ProgressStart "Running archive operation"
;;
(*)
- # no other backup programs foreseen then rsync so far
+ # no other backup programs foreseen than rsync so far
:
;;
@@ -96,7 +99,7 @@ case "$(basename $BACKUP_PROG)" in
;;
esac
- ProgressInfo "Archived $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]"
+ ProgressInfo "Backed up $((size/1024/1024)) MiB [avg $((size/1024/(SECONDS-starttime))) KiB/sec]"
done
;;
@@ -113,24 +116,23 @@ ProgressStop
wait $BackupPID
transfertime="$((SECONDS-starttime))"
-_rc="$(cat $TMP_DIR/retval)"
+backup_prog_rc="$(cat $TMP_DIR/retval)"
sleep 1
# everyone should see this warning, even if not verbose
-test "$_rc" -gt 0 && VERBOSE=1 LogPrint "WARNING !
-There was an error (${rsync_err_msg[$_rc]}) during archive creation.
-Please check the archive and see '$RUNTIME_LOGFILE' for more information.
+test "$backup_prog_rc" -gt 0 && Error "
+There was an error (${rsync_err_msg[$backup_prog_rc]}) during backup creation.
+Please check the destination and see '$RUNTIME_LOGFILE' for more information.
-Since errors are often related to files that cannot be saved by
-$BACKUP_PROG, we will continue the $WORKFLOW process. However, you MUST
-verify the backup yourself before trusting it !
+If the error is related to files that cannot and should not be saved by
+$BACKUP_PROG, they should be excluded from the backup.
"
-_message="$(tail -14 ${TMP_DIR}/${BACKUP_PROG_ARCHIVE}.log)"
-if [ $_rc -eq 0 -a "$_message" ] ; then
- LogPrint "$_message in $transfertime seconds."
+backup_log_message="$(tail -14 ${TMP_DIR}/${BACKUP_PROG_ARCHIVE}.log)"
+if [ $backup_prog_rc -eq 0 -a "$backup_log_message" ] ; then
+ LogPrint "$backup_log_message in $transfertime seconds."
elif [ "$size" ]; then
- LogPrint "Archived $((size/1024/1024)) MiB in $((transfertime)) seconds [avg $((size/1024/transfertime)) KiB/sec]"
+ LogPrint "Backed up $((size/1024/1024)) MiB in $((transfertime)) seconds [avg $((size/1024/transfertime)) KiB/sec]"
fi
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 01801a4e..b90d459b 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,6 +1,8 @@
# copy the backup.log & rear.log file to remote destination with timestamp added
-Timestamp=$( date +%Y%m%d.%H%M )
+local timestamp
+
+timestamp=$( date +%Y%m%d.%H%M )
# compress the log file first
gzip "$TMP_DIR/$BACKUP_PROG_ARCHIVE.log" || Error "Failed to 'gzip $TMP_DIR/$BACKUP_PROG_ARCHIVE.log'"
@@ -10,15 +12,15 @@ case $RSYNC_PROTO in
# 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_USER}@${RSYNC_HOST}:${RSYNC_PATH}/${RSYNC_PREFIX}/${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_USER}@${RSYNC_HOST}:${RSYNC_PATH}/${RSYNC_PREFIX}/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"
+ $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"
- $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_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/${RSYNC_PATH}/${RSYNC_PREFIX}//rear-${timestamp}.log"
;;
esac
diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf
index 455aa3ce..0c230f38 100644
--- a/usr/share/rear/conf/default.conf
+++ b/usr/share/rear/conf/default.conf
@@ -1106,7 +1106,8 @@ BACKUP_ONLY_EXCLUDE="no"
MANUAL_INCLUDE=NO
# Disable SELinux policy during backup with NETFS or RSYNC (default yes)
BACKUP_SELINUX_DISABLE=1
-# Enable integrity check of the backup archive (only with BACKUP=NETFS and BACKUP_PROG=tar)
+# Enable integrity check of the backup archive (full check only with BACKUP=NETFS and BACKUP_PROG=tar,
+# with BACKUP=rsync or BACKUP_PROG=rsync it only checks whether rsync completed the restore successfully)
BACKUP_INTEGRITY_CHECK=
# Define BACKUP_TYPE.
# By default BACKUP_TYPE is empty which means "rear mkbackup" will create a full backup.
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 32ac391d..519febf5 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
@@ -2,21 +2,19 @@
# 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!!)
-mkdir -p $v -m0750 "${TMP_DIR}/rsync/${RSYNC_PREFIX}" >&2
-StopIfError "Could not mkdir '${TMP_DIR}/rsync/${RSYNC_PREFIX}'"
-mkdir -p $v -m0755 "${TMP_DIR}/rsync/${RSYNC_PREFIX}/backup" >&2
-StopIfError "Could not mkdir '${TMP_DIR}/rsync/${RSYNC_PREFIX}/backup'"
+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
(ssh)
- $BACKUP_PROG -a $v -r "${TMP_DIR}/rsync/${RSYNC_PREFIX}" "${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PATH}" >/dev/null 2>&1
- StopIfError "Could not create '${RSYNC_PATH}/${RSYNC_PREFIX}' on remote ${RSYNC_HOST}"
+ $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}"
;;
(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
- StopIfError "Could not create '${RSYNC_PATH}/${RSYNC_PREFIX}' on remote ${RSYNC_HOST}"
+ $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}"
;;
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 c7b430d8..96b62da1 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
@@ -5,19 +5,19 @@ LogPrint "Copying resulting files to $OUTPUT_URL location"
# if called as mkbackuponly then we just don't have any result files.
if test "$RESULT_FILES" ; then
- Log "Copying files '${RESULT_FILES[@]}' to $OUTPUT_URL location"
- cp $v "${RESULT_FILES[@]}" "${TMP_DIR}/rsync/${RSYNC_PREFIX}/"
- StopIfError "Could not copy files to local rsync location"
+ Log "Copying files '${RESULT_FILES[*]}' to $OUTPUT_URL location"
+ cp $v "${RESULT_FILES[@]}" "${TMP_DIR}/rsync/${RSYNC_PREFIX}/" \
+ || Error "Could not copy files to local rsync location"
fi
-echo "$VERSION_INFO" >"${TMP_DIR}/rsync/${RSYNC_PREFIX}/VERSION"
-StopIfError "Could not create VERSION file on local rsync location"
+echo "$VERSION_INFO" >"${TMP_DIR}/rsync/${RSYNC_PREFIX}/VERSION" \
+ || Error "Could not create VERSION file on local rsync location"
-cp $v $(get_template "RESULT_usage_$OUTPUT.txt") "${TMP_DIR}/rsync/${RSYNC_PREFIX}/README"
-StopIfError "Could not copy usage file to local rsync location"
+cp $v $(get_template "RESULT_usage_$OUTPUT.txt") "${TMP_DIR}/rsync/${RSYNC_PREFIX}/README" \
+ || Error "Could not copy usage file to local rsync location"
-cat "$RUNTIME_LOGFILE" >"${TMP_DIR}/rsync/${RSYNC_PREFIX}/rear.log"
-StopIfError "Could not copy $RUNTIME_LOGFILE to local rsync location"
+cat "$RUNTIME_LOGFILE" >"${TMP_DIR}/rsync/${RSYNC_PREFIX}/rear.log" \
+ || Error "Could not copy $RUNTIME_LOGFILE to local rsync location"
case $RSYNC_PROTO in
@@ -25,20 +25,20 @@ case $RSYNC_PROTO in
Log "$BACKUP_PROG -a ${TMP_DIR}/rsync/${RSYNC_PREFIX}/ ${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PATH}/${RSYNC_PREFIX}/"
# 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
- StopIfError "Could not copy '${RESULT_FILES[@]}' to $OUTPUT_URL location"
+ $BACKUP_PROG -a "${TMP_DIR}/rsync/${RSYNC_PREFIX}/" "${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PATH}/${RSYNC_PREFIX}/" 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_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/${RSYNC_PATH}/${RSYNC_PREFIX}/"
# 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
- StopIfError "Could not copy '${RESULT_FILES[@]}' to $OUTPUT_URL location"
+ $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 \
+ || Error "Could not copy '${RESULT_FILES[*]}' to $OUTPUT_URL location"
;;
esac
# cleanup the temporary space (need it for the log file during backup)
-rm -rf "${TMP_DIR}/rsync/${RSYNC_PREFIX}/"
-LogIfError "Could not cleanup temoprary rsync space: ${TMP_DIR}/rsync/${RSYNC_PREFIX}/"
+rm -rf "${TMP_DIR}/rsync/${RSYNC_PREFIX}/" \
+ || Log "Could not cleanup temporary rsync space: ${TMP_DIR}/rsync/${RSYNC_PREFIX}/"
diff --git a/usr/share/rear/prep/NETFS/default/400_automatic_exclude_recreate.sh b/usr/share/rear/prep/NETFS/default/400_automatic_exclude_recreate.sh
index fadf9d72..3c719c44 100644
--- a/usr/share/rear/prep/NETFS/default/400_automatic_exclude_recreate.sh
+++ b/usr/share/rear/prep/NETFS/default/400_automatic_exclude_recreate.sh
@@ -31,7 +31,7 @@ case $scheme in
backup_directory_mountpoint=$( df -P "$backup_directory" | tail -1 | awk '{print $6}' )
test "/" = "$backup_directory_mountpoint" && Error "URL '$BACKUP_URL' has the backup directory '$backup_directory' in the '/' filesystem which is forbidden."
# When the mountpoint of the backup directory is not yet excluded add its mountpoint to the EXCLUDE_RECREATE array:
- if ! grep -q "$backup_directory_mountpoint" <<< $( echo ${EXCLUDE_RECREATE[@]} ) ; then
+ if ! grep -q "$backup_directory_mountpoint" <<< "${EXCLUDE_RECREATE[*]}" ; then
EXCLUDE_RECREATE+=( "fs:$backup_directory_mountpoint" )
fi
;;
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 ac26edfa..eb7df29e 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
@@ -33,7 +33,7 @@ case $(basename $BACKUP_PROG) in
touch $TMP_DIR/force.autorelabel # after reboot the restored system do a forced SELinux relabeling
else
# if --xattrs is already set; no need to do it again
- if ! grep -q xattrs <<< $(echo ${BACKUP_RSYNC_OPTIONS[@]}); then
+ if ! grep -q xattrs <<< "${BACKUP_RSYNC_OPTIONS[*]}" ; then
BACKUP_RSYNC_OPTIONS+=( --xattrs )
fi
RSYNC_SELINUX=1 # variable used in recover mode (means using xattr and not 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 b8535352..c964a148 100644
--- a/usr/share/rear/prep/RSYNC/default/100_check_rsync.sh
+++ b/usr/share/rear/prep/RSYNC/default/100_check_rsync.sh
@@ -33,22 +33,20 @@ RSYNC_PORT=873 # default port (of rsync server)
RSYNC_PATH=
-echo $BACKUP_URL | egrep -q '(::)' # new style '::' means rsync protocol
-if [[ $? -eq 0 ]]; then
+if egrep -q '(::)' <<< $BACKUP_URL ; then # new style '::' means rsync protocol
RSYNC_PROTO=rsync
else
RSYNC_PROTO=ssh
fi
-echo $host | grep -q '@'
-if [[ $? -eq 0 ]]; then
+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)
-tmp2="${host#*@}"
+local tmp2="${host#*@}"
case "$RSYNC_PROTO" in
@@ -56,8 +54,7 @@ case "$RSYNC_PROTO" in
# tmp2=witsbebelnx02::backup or tmp2=witsbebelnx02::
RSYNC_HOST="${tmp2%%::*}"
# path=/gdhaese1@witsbebelnx02::backup or path=/backup
- echo $path | grep -q '::'
- if [[ $? -eq 0 ]]; then
+ if grep -q '::' <<< $path ; then
RSYNC_PATH="${path##*::}"
else
RSYNC_PATH="${path##*/}"
@@ -79,8 +76,7 @@ esac
# check if host is reachable
if test "$PING" ; then
- ping -c 2 "$RSYNC_HOST" >/dev/null
- StopIfError "Backup host [$RSYNC_HOST] not reachable."
+ ping -c 2 "$RSYNC_HOST" >/dev/null || Error "Backup host [$RSYNC_HOST] not reachable."
else
Log "Skipping ping test"
fi
@@ -89,15 +85,15 @@ fi
case "$RSYNC_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
- StopIfError "Rsync daemon not running on $RSYNC_HOST"
+ 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"
;;
(ssh)
Log "Test: ssh ${RSYNC_USER}@${RSYNC_HOST} /bin/true"
- ssh ${RSYNC_USER}@${RSYNC_HOST} /bin/true >/dev/null 2>&1
- StopIfError "Secure shell connection not setup properly [$RSYNC_USER@$RSYNC_HOST]"
+ ssh ${RSYNC_USER}@${RSYNC_HOST} /bin/true >/dev/null 2>&1 \
+ || Error "Secure shell connection not setup properly [$RSYNC_USER@$RSYNC_HOST]"
;;
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 446dd736..e9103531 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
@@ -2,15 +2,17 @@
# 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.
# try to grab the rsync protocol version of rsync on the remote server
+
+local remote_mountpoint
+
if [ -z "$RSYNC_PROTOCOL_VERSION" ]; then
case $RSYNC_PROTO in
(ssh)
- ssh ${RSYNC_USER}@${RSYNC_HOST} rsync --version >"$TMP_DIR/rsync_protocol" 2>&1
- StopIfError "Secure shell connection not setup properly [$RSYNC_USER@$RSYNC_HOST]"
- grep -q "protocol version" "$TMP_DIR/rsync_protocol"
- if [ $? -eq 0 ]; then
+ ssh ${RSYNC_USER}@${RSYNC_HOST} rsync --version >"$TMP_DIR/rsync_protocol" 2>&1 \
+ || Error "Secure shell connection not setup properly [$RSYNC_USER@$RSYNC_HOST]"
+ if grep -q "protocol version" "$TMP_DIR/rsync_protocol" ; then
RSYNC_PROTOCOL_VERSION=$(grep 'protocol version' "$TMP_DIR/rsync_protocol" | awk '{print $6}')
else
RSYNC_PROTOCOL_VERSION=29 # being conservative (old rsync version < 3.0)
@@ -30,25 +32,21 @@ else
fi
-if [ "${RSYNC_USER}" != "root" ]; then
+if [ "${RSYNC_USER}" != "root" -a $RSYNC_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)"
else
# when using --fake-super we must have user_xattr mount options on the remote mntpt
- _mntpt=$(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"
- StopIfError "Remote file system $_mntpt does not have user_xattr mount option set!"
- #BACKUP_RSYNC_OPTIONS+=( --xattrs --rsync-path="""rsync --fake-super""" )
+ 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" \
+ || 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""" )
+ BACKUP_RSYNC_OPTIONS+=( --rsync-path="rsync --fake-super" )
fi
else
- if [ ${BACKUP_RSYNC_OPTIONS[@]/--fake-super/} != ${BACKUP_RSUNC_OPTIONS[@]} ]; then
- Error "rsync --fake-super not possible on system ($RSYNC_HOST) (please upgrade rsync to 3.x)"
- else
- Log "Warning: rsync --fake-super not possible on system ($RSYNC_HOST) (please upgrade rsync to 3.x)"
- fi
+ Error "rsync --fake-super not possible on system ($RSYNC_HOST) (please upgrade rsync to 3.x)"
fi
fi
diff --git a/usr/share/rear/restore/DUPLICITY/default/400_restore_duplicity.sh b/usr/share/rear/restore/DUPLICITY/default/400_restore_duplicity.sh
index 0a9c9648..220ccc57 100644
--- a/usr/share/rear/restore/DUPLICITY/default/400_restore_duplicity.sh
+++ b/usr/share/rear/restore/DUPLICITY/default/400_restore_duplicity.sh
@@ -5,6 +5,8 @@
# Restore from remote backup via DUPLICIY over rsync
if [ "$BACKUP_PROG" = "duplicity" ]; then
+ local backup_prog_rc
+ local restore_log_message
LogPrint "========================================================================"
LogPrint "Restoring backup with $BACKUP_PROG from '$BACKUP_DUPLICITY_URL'"
@@ -49,7 +51,8 @@ if [ "$BACKUP_PROG" = "duplicity" ]; then
LogPrint "with CMD: $DUPLICITY_PROG -v 5 $GPG_KEY --force --tempdir=$DUPLICITY_TEMPDIR $BACKUP_DUPLICITY_URL/$HOSTNAME/ $TARGET_FS_ROOT"
$DUPLICITY_PROG -v 5 $GPG_KEY --force --tempdir="$DUPLICITY_TEMPDIR" $BACKUP_DUPLICITY_URL/$HOSTNAME/ $TARGET_FS_ROOT 0<&6 | tee $TMP_DIR/duplicity-restore.log
fi
- _rc=$?
+ # FIXME: this collects the exit code from "tee", not from $DUPLICITY_PROG
+ backup_prog_rc=$?
transfertime="$((SECONDS-$starttime))"
sleep 1
@@ -65,20 +68,20 @@ if [ "$BACKUP_PROG" = "duplicity" ]; then
LogPrint "========================================================================"
- if [ "$_rc" -gt 0 ]; then
+ if [ "$backup_prog_rc" -gt 0 ]; then
LogPrint "WARNING !
There was an error while restoring the archive.
Please check '$RUNTIME_LOGFILE' and $TMP_DIR/duplicity-restore.log for more information.
You should also manually check the restored system to see whether it is complete.
"
- _message="$(tail -14 ${TMP_DIR}/duplicity-restore.log)"
+ restore_log_message="$(tail -14 ${TMP_DIR}/duplicity-restore.log)"
LogPrint "Last 14 Lines of ${TMP_DIR}/duplicity-restore.log:"
- LogPrint "$_message"
+ LogPrint "$restore_log_message"
fi
- if [ $_rc -eq 0 ] ; then
+ if [ $backup_prog_rc -eq 0 ] ; then
LogPrint "Restore completed in $transfertime seconds."
fi
diff --git a/usr/share/rear/restore/RBME/default/400_restore_backup.sh b/usr/share/rear/restore/RBME/default/400_restore_backup.sh
index 28a3c354..3e97e16b 100644
--- a/usr/share/rear/restore/RBME/default/400_restore_backup.sh
+++ b/usr/share/rear/restore/RBME/default/400_restore_backup.sh
@@ -2,6 +2,8 @@ if [[ -z "$RBME_BACKUP" ]] ; then
Error "No RBME backup selected (BACKUP_URL?). Aborting."
fi
+local backup_prog_rc
+
scheme=$(url_scheme "$BACKUP_URL")
LogPrint "Restoring from backup $RBME_BACKUP."
@@ -43,11 +45,11 @@ transfertime="$((SECONDS-starttime))"
# harvest return code from background job. The kill -0 $BackupPID loop above should
# have made sure that this wait won't do any real "waiting" :-)
wait $BackupPID
-_rc=$?
+backup_prog_rc=$?
sleep 1
-test "$_rc" -gt 0 && LogPrint "WARNING !
-There was an error (${rsync_err_msg[$_rc]}) while restoring the archive.
+test "$backup_prog_rc" -gt 0 && LogPrint "WARNING !
+There was an error (${rsync_err_msg[$backup_prog_rc]}) while restoring the archive.
Please check '$RUNTIME_LOGFILE' for more information. You should also
manually check the restored system to see whether it is complete.
"
diff --git a/usr/share/rear/restore/RSYNC/default/200_remove_relative_rsync_option.sh b/usr/share/rear/restore/RSYNC/default/200_remove_relative_rsync_option.sh
index 53915322..a792f195 100644
--- a/usr/share/rear/restore/RSYNC/default/200_remove_relative_rsync_option.sh
+++ b/usr/share/rear/restore/RSYNC/default/200_remove_relative_rsync_option.sh
@@ -4,11 +4,11 @@
# without the --relative option ; my feeling says it is better to remove it from array BACKUP_RSYNC_OPTIONS
# If I'm wrong please let us know (use issue mentioned above to comment)
-if grep -q relative <<< $(echo ${BACKUP_RSYNC_OPTIONS[@]}); then
+if grep -q -- "--relative" <<< "${BACKUP_RSYNC_OPTIONS[*]}" ; then
BACKUP_RSYNC_OPTIONS=( $( RmInArray "--relative" "${BACKUP_RSYNC_OPTIONS[@]}" ) )
Log "Removed option '--relative' from the BACKUP_RSYNC_OPTIONS array during $WORKFLOW workflow"
fi
-if grep -q "-R" <<< $(echo ${BACKUP_RSYNC_OPTIONS[@]}); then
+if grep -q -- "-R" <<< "${BACKUP_RSYNC_OPTIONS[*]}" ; then
BACKUP_RSYNC_OPTIONS=( $( RmInArray "-R" "${BACKUP_RSYNC_OPTIONS[@]}" ) )
Log "Removed option '-R' from the BACKUP_RSYNC_OPTIONS array during $WORKFLOW workflow"
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 2a0bf15e..993088be 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
@@ -4,10 +4,10 @@ get_size() {
echo $( stat --format '%s' "$TARGET_FS_ROOT/$1" )
}
-mkdir -p "${TMP_DIR}/rsync/${NETFS_PREFIX}"
-StopIfError "Could not mkdir '$TMP_DIR/rsync/${NETFS_PREFIX}'"
+local backup_prog_rc
+local restore_log_message
-LogPrint "Restoring $BACKUP_PROG archive from '${RSYNC_HOST}:${RSYNC_PATH}'"
+LogPrint "Restoring $BACKUP_PROG backup from '${RSYNC_HOST}:${RSYNC_PATH}'"
ProgressStart "Restore operation"
(
@@ -33,9 +33,10 @@ ProgressStart "Restore operation"
;;
(*)
- # no other backup programs foreseen then rsync so far
+ # no other backup programs foreseen than rsync so far
:
;;
+
esac
echo $? >$TMP_DIR/retval
) >"${TMP_DIR}/${BACKUP_PROG_ARCHIVE}-restore.log" &
@@ -65,6 +66,7 @@ case "$(basename $BACKUP_PROG)" in
ProgressStep
done
;;
+
esac
ProgressStop
@@ -72,20 +74,28 @@ transfertime="$((SECONDS-starttime))"
# harvest return code from background job. The kill -0 $BackupPID loop above should
# have made sure that this wait won't do any real "waiting" :-)
-wait $BackupPID
-_rc=$?
+wait $BackupPID || LogPrintError "Restore job returned a nonzero exit code $?"
+# harvest the actual return code of rsync. Finishing the pipeline with an error code above is actually unlikely,
+# because rsync is not the last command in it. But error returns from rsync are common and must be handled.
+backup_prog_rc="$(cat $TMP_DIR/retval)"
sleep 1
-test "$_rc" -gt 0 && LogPrint "WARNING !
-There was an error (${rsync_err_msg[$_rc]}) while restoring the archive.
+if test "$backup_prog_rc" -gt 0 ; then
+ # TODO: Shouldn't we tell the user to check ${TMP_DIR}/${BACKUP_PROG_ARCHIVE}-restore.log as well?
+ LogPrintError "WARNING !
+There was an error (${rsync_err_msg[$backup_prog_rc]}) while restoring the backup.
Please check '$RUNTIME_LOGFILE' for more information. You should also
manually check the restored system to see whether it is complete.
"
+ is_true "$BACKUP_INTEGRITY_CHECK" && Error "Integrity check failed, restore aborted because BACKUP_INTEGRITY_CHECK is enabled"
+fi
-_message="$(tail -14 ${TMP_DIR}/${BACKUP_PROG_ARCHIVE}-restore.log)"
+restore_log_message="$(tail -14 ${TMP_DIR}/${BACKUP_PROG_ARCHIVE}-restore.log)"
-if [ $_rc -eq 0 -a "$_message" ] ; then
- LogPrint "$_message in $transfertime seconds."
+if [ $backup_prog_rc -eq 0 -a "$restore_log_message" ] ; then
+ LogPrint "$restore_log_message in $transfertime seconds."
elif [ "$size" ]; then
LogPrint "Restored $((size/1024/1024)) MiB in $((transfertime)) seconds [avg $((size/1024/transfertime)) KiB/sec]"
fi
+
+return $backup_prog_rc
diff --git a/usr/share/rear/verify/RSYNC/GNU/Linux/600_check_rsync_xattr.sh b/usr/share/rear/verify/RSYNC/GNU/Linux/600_check_rsync_xattr.sh
index 3622884a..890161f1 100644
--- a/usr/share/rear/verify/RSYNC/GNU/Linux/600_check_rsync_xattr.sh
+++ b/usr/share/rear/verify/RSYNC/GNU/Linux/600_check_rsync_xattr.sh
@@ -3,8 +3,8 @@
[[ $RSYNC_SELINUX ]] && {
# if --xattrs is already set; no need to do it again
- if ! grep -q xattrs <<< $(echo ${BACKUP_RSYNC_OPTIONS[@]}); then
- RSYNC_OPTIONS=( "${BACKUP_RSYNC_OPTIONS[@]}" --xattrs )
+ if ! grep -q xattrs <<< "${BACKUP_RSYNC_OPTIONS[*]}" ; then
+ BACKUP_RSYNC_OPTIONS+=( --xattrs )
fi
}
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 47ed9e02..b2fb72f5 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
@@ -3,12 +3,12 @@
case $RSYNC_PROTO in
(ssh)
- ssh ${RSYNC_USER}@${RSYNC_HOST} "ls -ld ${RSYNC_PATH}/${RSYNC_PREFIX}/backup" >/dev/null 2>&1
- StopIfError "Archive not found on [$RSYNC_USER@$RSYNC_HOST:${RSYNC_PATH}/${RSYNC_PREFIX}]"
+ 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}]"
;;
(rsync)
- $BACKUP_PROG "${RSYNC_PROTO}://${RSYNC_USER}@${RSYNC_HOST}:${RSYNC_PORT}/${RSYNC_PATH}/${RSYNC_PREFIX}/backup" >/dev/null 2>&1
- StopIfError "Archive not found on [$RSYNC_USER@$RSYNC_HOST:${RSYNC_PATH}/${RSYNC_PREFIX}]"
+ $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}]"
;;
esac

View File

@ -0,0 +1,274 @@
diff --git a/usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh b/usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh
old mode 100644
new mode 100755
index cc646359..33d87767
--- a/usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh
+++ b/usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh
@@ -8,6 +8,10 @@ is_true $USING_UEFI_BOOTLOADER || return 0
# (cf. finalize/Linux-i386/610_EFISTUB_run_efibootmgr.sh):
is_true $EFI_STUB && return
+LogPrint "Creating EFI Boot Manager entries..."
+
+local esp_mountpoint esp_mountpoint_inside boot_efi_parts boot_efi_dev
+
# When UEFI_BOOTLOADER is not a regular file in the restored target system
# (cf. how esp_mountpoint is set below) it means BIOS is used
# (cf. rescue/default/850_save_sysfs_uefi_vars.sh)
@@ -15,64 +19,80 @@ is_true $EFI_STUB && return
# because when UEFI_BOOTLOADER is empty the test below evaluates to
# test -f /mnt/local/
# which also returns false because /mnt/local/ is a directory
-# (cf. https://github.com/rear/rear/pull/2051/files#r258826856):
-test -f "$TARGET_FS_ROOT/$UEFI_BOOTLOADER" || return 0
+# (cf. https://github.com/rear/rear/pull/2051/files#r258826856)
+# but using BIOS conflicts with USING_UEFI_BOOTLOADER is true
+# i.e. we should create EFI Boot Manager entries but we cannot:
+if ! test -f "$TARGET_FS_ROOT/$UEFI_BOOTLOADER" ; then
+ LogPrintError "Failed to create EFI Boot Manager entries (UEFI bootloader '$UEFI_BOOTLOADER' not found under target $TARGET_FS_ROOT)"
+ return 1
+fi
# Determine where the EFI System Partition (ESP) is mounted in the currently running recovery system:
-esp_mountpoint=$( df -P "$TARGET_FS_ROOT/$UEFI_BOOTLOADER" | tail -1 | awk '{print $6}' )
-# Use TARGET_FS_ROOT/boot/efi as fallback ESP mountpoint:
-test "$esp_mountpoint" || esp_mountpoint="$TARGET_FS_ROOT/boot/efi"
+esp_mountpoint=$( filesystem_name "$TARGET_FS_ROOT/$UEFI_BOOTLOADER" )
+# Use TARGET_FS_ROOT/boot/efi as fallback ESP mountpoint (filesystem_name returns "/"
+# if mountpoint not found otherwise):
+if [ "$esp_mountpoint" = "/" ] ; then
+ esp_mountpoint="$TARGET_FS_ROOT/boot/efi"
+ LogPrint "Mountpoint of $TARGET_FS_ROOT/$UEFI_BOOTLOADER not found, trying $esp_mountpoint"
+fi
# Skip if there is no esp_mountpoint directory (e.g. the fallback ESP mountpoint may not exist).
# Double quotes are mandatory here because 'test -d' without any (possibly empty) argument results true:
-test -d "$esp_mountpoint" || return 0
-
-BootEfiDev="$( mount | grep "$esp_mountpoint" | awk '{print $1}' )"
-# /dev/sda1 or /dev/mapper/vol34_part2 or /dev/mapper/mpath99p4
-Dev=$( get_device_name $BootEfiDev )
-# 1 (must anyway be a low nr <9)
-ParNr=$( get_partition_number $Dev )
-# /dev/sda or /dev/mapper/vol34_part or /dev/mapper/mpath99p or /dev/mmcblk0p
-Disk=$( echo ${Dev%$ParNr} )
-
-# Strip trailing partition remainders like '_part' or '-part' or 'p'
-# if we have 'mapper' in disk device name:
-if [[ ${Dev/mapper//} != $Dev ]] ; then
- # we only expect mpath_partX or mpathpX or mpath-partX
- case $Disk in
- (*p) Disk=${Disk%p} ;;
- (*-part) Disk=${Disk%-part} ;;
- (*_part) Disk=${Disk%_part} ;;
- (*) Log "Unsupported kpartx partition delimiter for $Dev"
- esac
+if ! test -d "$esp_mountpoint" ; then
+ LogPrintError "Failed to create EFI Boot Manager entries (no ESP mountpoint directory $esp_mountpoint)"
+ return 1
fi
-# For eMMC devices the trailing 'p' in the Disk value
-# (as in /dev/mmcblk0p that is derived from /dev/mmcblk0p1)
-# needs to be stripped (to get /dev/mmcblk0), otherwise the
-# efibootmgr call fails because of a wrong disk device name.
-# See also https://github.com/rear/rear/issues/2103
-if [[ $Disk = *'/mmcblk'+([0-9])p ]] ; then
- Disk=${Disk%p}
-fi
+# Mount point inside the target system,
+# accounting for possible trailing slashes in TARGET_FS_ROOT
+esp_mountpoint_inside="${esp_mountpoint#${TARGET_FS_ROOT%%*(/)}}"
-# For NVMe devices the trailing 'p' in the Disk value
-# (as in /dev/nvme0n1p that is derived from /dev/nvme0n1p1)
-# needs to be stripped (to get /dev/nvme0n1), otherwise the
-# efibootmgr call fails because of a wrong disk device name.
-# See also https://github.com/rear/rear/issues/1564
-if [[ $Disk = *'/nvme'+([0-9])n+([0-9])p ]] ; then
- Disk=${Disk%p}
+boot_efi_parts=$( find_partition "fs:$esp_mountpoint_inside" fs )
+if ! test "$boot_efi_parts" ; then
+ LogPrint "Unable to find ESP $esp_mountpoint_inside in layout"
+ LogPrint "Trying to determine device currently mounted at $esp_mountpoint as fallback"
+ boot_efi_dev="$( mount | grep "$esp_mountpoint" | awk '{print $1}' )"
+ if ! test "$boot_efi_dev" ; then
+ LogPrintError "Cannot create EFI Boot Manager entry (unable to find ESP $esp_mountpoint among mounted devices)"
+ return 1
+ fi
+ if test $(get_component_type "$boot_efi_dev") = part ; then
+ boot_efi_parts="$boot_efi_dev"
+ else
+ boot_efi_parts=$( find_partition "$boot_efi_dev" )
+ fi
+ if ! test "$boot_efi_parts" ; then
+ LogPrintError "Cannot create EFI Boot Manager entry (unable to find partition for $boot_efi_dev)"
+ return 1
+ fi
+ LogPrint "Using fallback EFI boot partition(s) $boot_efi_parts (unable to find ESP $esp_mountpoint_inside in layout)"
fi
+local bootloader partition_block_device partition_number disk efipart
+
# EFI\fedora\shim.efi
-BootLoader=$( echo $UEFI_BOOTLOADER | cut -d"/" -f4- | sed -e 's;/;\\;g' )
-LogPrint "Creating EFI Boot Manager entry '$OS_VENDOR $OS_VERSION' for '$BootLoader' (UEFI_BOOTLOADER='$UEFI_BOOTLOADER')"
-Log efibootmgr --create --gpt --disk ${Disk} --part ${ParNr} --write-signature --label \"${OS_VENDOR} ${OS_VERSION}\" --loader \"\\${BootLoader}\"
-if efibootmgr --create --gpt --disk ${Disk} --part ${ParNr} --write-signature --label "${OS_VENDOR} ${OS_VERSION}" --loader "\\${BootLoader}" ; then
- # ok, boot loader has been set-up - tell rear we are done using following var.
- NOBOOTLOADER=''
- return
-fi
+bootloader=$( echo $UEFI_BOOTLOADER | cut -d"/" -f4- | sed -e 's;/;\\;g' )
+
+for efipart in $boot_efi_parts ; do
+ # /dev/sda1 or /dev/mapper/vol34_part2 or /dev/mapper/mpath99p4
+ partition_block_device=$( get_device_name $efipart )
+ # 1 or 2 or 4 for the examples above
+ partition_number=$( get_partition_number $partition_block_device )
+ if ! disk=$( get_device_from_partition $partition_block_device $partition_number ) ; then
+ LogPrintError "Cannot create EFI Boot Manager entry for ESP $partition_block_device (unable to find the underlying disk)"
+ # do not error out - we may be able to locate other disks if there are more of them
+ continue
+ fi
+ LogPrint "Creating EFI Boot Manager entry '$OS_VENDOR $OS_VERSION' for '$bootloader' (UEFI_BOOTLOADER='$UEFI_BOOTLOADER') "
+ Log efibootmgr --create --gpt --disk $disk --part $partition_number --write-signature --label \"${OS_VENDOR} ${OS_VERSION}\" --loader \"\\${bootloader}\"
+ if efibootmgr --create --gpt --disk $disk --part $partition_number --write-signature --label "${OS_VENDOR} ${OS_VERSION}" --loader "\\${bootloader}" ; then
+ # ok, boot loader has been set-up - continue with other disks (ESP can be on RAID)
+ NOBOOTLOADER=''
+ else
+ LogPrintError "efibootmgr failed to create EFI Boot Manager entry on $disk partition $partition_number (ESP $partition_block_device )"
+ fi
+done
-LogPrintError "efibootmgr failed to create EFI Boot Manager entry for '$BootLoader' (UEFI_BOOTLOADER='$UEFI_BOOTLOADER')"
+is_true $NOBOOTLOADER || return 0
+LogPrintError "efibootmgr failed to create EFI Boot Manager entry for '$bootloader' (UEFI_BOOTLOADER='$UEFI_BOOTLOADER')"
+return 1
diff --git a/usr/share/rear/lib/layout-functions.sh b/usr/share/rear/lib/layout-functions.sh
index 54ddb50f..cdd81a14 100644
--- a/usr/share/rear/lib/layout-functions.sh
+++ b/usr/share/rear/lib/layout-functions.sh
@@ -302,12 +302,20 @@ get_child_components() {
done
}
-# Return all ancestors of component $1 [ of type $2 ]
+# Return all ancestors of component $1 [ of type $2 [ skipping types $3 during resolution ] ]
get_parent_components() {
- declare -a ancestors devlist
- declare current child parent
+ declare -a ancestors devlist ignoretypes
+ declare current child parent parenttype
devlist=( "$1" )
+ if [[ "$3" ]] ; then
+ # third argument should, if present, be a space-separated list
+ # of types to ignore when walking up the dependency tree.
+ # Convert it to array
+ ignoretypes=( $3 )
+ else
+ ignoretypes=()
+ fi
while (( ${#devlist[@]} )) ; do
current=${devlist[0]}
@@ -318,6 +326,13 @@ get_parent_components() {
if IsInArray "$parent" "${ancestors[@]}" ; then
continue
fi
+ ### ...test if parent is of a correct type if requested...
+ if [[ ${#ignoretypes[@]} -gt 0 ]] ; then
+ parenttype=$(get_component_type "$parent")
+ if IsInArray "$parenttype" "${ignoretypes[@]}" ; then
+ continue
+ fi
+ fi
### ...and add them to the list
devlist+=( "$parent" )
ancestors+=( "$parent" )
@@ -345,22 +360,24 @@ get_parent_components() {
}
# find_devices <other>
+# ${2+"$2"} in the following functions ensures that $2 gets passed down quoted if present
+# and ignored if not present
# Find the disk device(s) component $1 resides on.
find_disk() {
- get_parent_components "$1" "disk"
+ get_parent_components "$1" "disk" ${2+"$2"}
}
find_multipath() {
- get_parent_components "$1" "multipath"
+ get_parent_components "$1" "multipath" ${2+"$2"}
}
find_disk_and_multipath() {
- find_disk "$1"
- is_true "$AUTOEXCLUDE_MULTIPATH" || find_multipath "$1"
+ find_disk "$1" ${2+"$2"}
+ is_true "$AUTOEXCLUDE_MULTIPATH" || find_multipath "$1" ${2+"$2"}
}
find_partition() {
- get_parent_components "$1" "part"
+ get_parent_components "$1" "part" ${2+"$2"}
}
# The get_partition_number function
@@ -413,6 +430,54 @@ get_partition_number() {
echo $partition_number
}
+# Extract the underlying device name from the full partition device name.
+# Underlying device may be a disk, a multipath device or other devices that can be partitioned.
+# Should we use the information in $LAYOUT_DEPS, like get_parent_component does,
+# instead of string munging?
+function get_device_from_partition() {
+ local partition_block_device
+ local device
+ local partition_number
+
+ partition_block_device=$1
+ test -b "$partition_block_device" || BugError "get_device_from_partition called with '$partition_block_device' that is no block device"
+ partition_number=${2-$(get_partition_number $partition_block_device )}
+ # /dev/sda or /dev/mapper/vol34_part or /dev/mapper/mpath99p or /dev/mmcblk0p
+ device=${partition_block_device%$partition_number}
+
+ # Strip trailing partition remainders like '_part' or '-part' or 'p'
+ # if we have 'mapper' in disk device name:
+ if [[ ${partition_block_device/mapper//} != $partition_block_device ]] ; then
+ # we only expect mpath_partX or mpathpX or mpath-partX
+ case $device in
+ (*p) device=${device%p} ;;
+ (*-part) device=${device%-part} ;;
+ (*_part) device=${device%_part} ;;
+ (*) Log "Unsupported kpartx partition delimiter for $partition_block_device"
+ esac
+ fi
+
+ # For eMMC devices the trailing 'p' in the $device value
+ # (as in /dev/mmcblk0p that is derived from /dev/mmcblk0p1)
+ # needs to be stripped (to get /dev/mmcblk0), otherwise the
+ # efibootmgr call fails because of a wrong disk device name.
+ # See also https://github.com/rear/rear/issues/2103
+ if [[ $device = *'/mmcblk'+([0-9])p ]] ; then
+ device=${device%p}
+ fi
+
+ # For NVMe devices the trailing 'p' in the $device value
+ # (as in /dev/nvme0n1p that is derived from /dev/nvme0n1p1)
+ # needs to be stripped (to get /dev/nvme0n1), otherwise the
+ # efibootmgr call fails because of a wrong disk device name.
+ # See also https://github.com/rear/rear/issues/1564
+ if [[ $device = *'/nvme'+([0-9])n+([0-9])p ]] ; then
+ device=${device%p}
+ fi
+
+ test -b "$device" && echo $device
+}
+
# Returns partition start block or 'unknown'
# sda/sda1 or
# dm-XX

2040
SOURCES/rear-bz1958247.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
diff --git a/usr/share/rear/conf/Linux-ppc64.conf b/usr/share/rear/conf/Linux-ppc64.conf
index 7e20ddc7..d7774062 100644
--- a/usr/share/rear/conf/Linux-ppc64.conf
+++ b/usr/share/rear/conf/Linux-ppc64.conf
@@ -1,18 +1,26 @@
-REQUIRED_PROGS+=( sfdisk )
+REQUIRED_PROGS+=( sfdisk ofpathname )
PROGS+=(
mkofboot
ofpath
ybin
yabootconfig
-bootlist
pseries_platform
nvram
-ofpathname
bc
agetty
)
+if grep -q "emulated by qemu" /proc/cpuinfo ; then
+ # Qemu/KVM virtual machines don't need bootlist - don't complain if
+ # it is missing
+ PROGS+=( bootlist )
+else
+ # PowerVM environment, we need to run bootlist, otherwise
+ # we can't make the system bpotable. Be strict about requiring it
+ REQUIRED_PROGS+=( bootlist )
+fi
+
COPY_AS_IS+=(
/usr/lib/yaboot/yaboot
/usr/lib/yaboot/ofboot
diff --git a/usr/share/rear/conf/Linux-ppc64le.conf b/usr/share/rear/conf/Linux-ppc64le.conf
index d00154a2..df8066ea 100644
--- a/usr/share/rear/conf/Linux-ppc64le.conf
+++ b/usr/share/rear/conf/Linux-ppc64le.conf
@@ -1,10 +1,8 @@
REQUIRED_PROGS+=( sfdisk )
PROGS+=(
-bootlist
pseries_platform
nvram
-ofpathname
bc
agetty
)
@@ -17,4 +15,18 @@ agetty
if [[ $(awk '/platform/ {print $NF}' < /proc/cpuinfo) != PowerNV ]] ; then
# No firmware files when ppc64le Linux is not run in BareMetal Mode (PowerNV):
test "${FIRMWARE_FILES[*]}" || FIRMWARE_FILES=( 'no' )
+ # grub2-install for powerpc-ieee1275 calls ofpathname, so without it,
+ # the rescue system can't make the recovered system bootable
+ REQUIRED_PROGS+=( ofpathname )
+ if grep -q "emulated by qemu" /proc/cpuinfo ; then
+ # Qemu/KVM virtual machines don't need bootlist - don't complain if
+ # it is missing
+ PROGS+=( bootlist )
+ else
+ # PowerVM environment, we need to run bootlist, otherwise
+ # we can't make the system bpotable. Be strict about requiring it
+ REQUIRED_PROGS+=( bootlist )
+ fi
+else
+ PROGS+=( ofpathname bootlist )
fi

View File

@ -0,0 +1,34 @@
From 4233fe30b315737ac8c4d857e2b04e021c2e2886 Mon Sep 17 00:00:00 2001
From: Pavel Cahyna <pcahyna@redhat.com>
Date: Mon, 16 Aug 2021 10:10:38 +0300
Subject: [PATCH] Revert the main part of PR #2299
multipath -l is very slow with many multipath devices. As it will be
called for every multipath device, it leads to quadratic time complexity
in the number of multipath devices. For thousands of devices, ReaR can
take hours to scan and exclude them. We therefore have to comment
multipath -l out, as it is a huge performance regression, and find
another solution to bug #2298.
---
usr/share/rear/lib/layout-functions.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/usr/share/rear/lib/layout-functions.sh b/usr/share/rear/lib/layout-functions.sh
index cdd81a14..8c8be74b 100644
--- a/usr/share/rear/lib/layout-functions.sh
+++ b/usr/share/rear/lib/layout-functions.sh
@@ -771,7 +771,10 @@ function is_multipath_path {
# so that no "multipath -l" output could clutter the log (the "multipath -l" output is irrelevant here)
# in contrast to e.g. test "$( multipath -l )" that would falsely succeed with blank output
# and the output would appear in the log in 'set -x' debugscript mode:
- multipath -l | grep -q '[[:alnum:]]' || return 1
+ #
+ # Unfortunately, multipat -l is quite slow with many multipath devices
+ # and becomes a performance bottleneck, so we must comment it out for now.
+ #multipath -l | grep -q '[[:alnum:]]' || return 1
# Check if a block device should be a path in a multipath device:
multipath -c /dev/$1 &>/dev/null
}
--
2.26.3

View File

@ -1,85 +0,0 @@
diff --git a/usr/share/rear/conf/GNU/Linux.conf b/usr/share/rear/conf/GNU/Linux.conf
index 5b9343b9..f0c44381 100644
--- a/usr/share/rear/conf/GNU/Linux.conf
+++ b/usr/share/rear/conf/GNU/Linux.conf
@@ -184,6 +184,8 @@ env
w
dosfslabel
sysctl
+blockdev
+lsblk
)
# the lib* serves to cover both 32bit and 64bit libraries!
diff --git a/usr/share/rear/lib/layout-functions.sh b/usr/share/rear/lib/layout-functions.sh
index eb45115b..af1069ea 100644
--- a/usr/share/rear/lib/layout-functions.sh
+++ b/usr/share/rear/lib/layout-functions.sh
@@ -365,7 +365,9 @@ get_partition_start() {
local disk_name=$1
local start_block start
- local block_size=$(get_block_size ${disk_name%/*})
+ # When reading /sys/block/.../start or "dmsetup table", output is always in
+ # 512 bytes blocks
+ local block_size=512
if [[ -r /sys/block/$disk_name/start ]] ; then
start_block=$(< $path/start)
@@ -548,11 +550,32 @@ get_device_mapping() {
}
# Get the size in bytes of a disk/partition.
+# For disks, use "sda" as argument.
# For partitions, use "sda/sda1" as argument.
get_disk_size() {
local disk_name=$1
+ # When a partition is specified (e.g. sda/sda1)
+ # then it has to read /sys/block/sda/sda1/size in the old code below.
+ # In contrast the get_block_size() function below is different
+ # because it is non-sense asking for block size of a partition,
+ # so that the get_block_size() function below is stripping everything
+ # in front of the blockdev basename (e.g. /some/path/sda -> sda)
+ # cf. https://github.com/rear/rear/pull/1885#discussion_r207900308
+
+ # Preferably use blockdev, see https://github.com/rear/rear/issues/1884
+ if has_binary blockdev; then
+ # ${disk_name##*/} translates 'sda/sda1' into 'sda1' and 'sda' into 'sda'
+ blockdev --getsize64 /dev/${disk_name##*/} && return
+ # If blockdev fails do not error out but fall through to the old code below
+ # because blockdev fails e.g. for a CDROM device when no DVD or ISO is attached to
+ # cf. https://github.com/rear/rear/pull/1885#issuecomment-410676283
+ # and https://github.com/rear/rear/pull/1885#issuecomment-410697398
+ fi
- local block_size=$(get_block_size ${disk_name%/*})
+ # Linux always considers sectors to be 512 bytes long. See the note in the
+ # kernel source, specifically, include/linux/types.h regarding the sector_t
+ # type for details.
+ local block_size=512
retry_command test -r /sys/block/$disk_name/size || Error "Could not determine size of disk $disk_name"
@@ -565,9 +588,20 @@ get_disk_size() {
# Get the block size of a disk.
get_block_size() {
+ local disk_name="${1##*/}" # /some/path/sda -> sda
+
+ # Preferably use blockdev, see https://github.com/rear/rear/issues/1884
+ if has_binary blockdev; then
+ blockdev --getss /dev/$disk_name && return
+ # If blockdev fails do not error out but fall through to the old code below
+ # because blockdev fails e.g. for a CDROM device when no DVD or ISO is attached to
+ # cf. https://github.com/rear/rear/pull/1885#issuecomment-410676283
+ # and https://github.com/rear/rear/pull/1885#issuecomment-410697398
+ fi
+
# Only newer kernels have an interface to get the block size
- if [ -r /sys/block/$1/queue/logical_block_size ] ; then
- echo $( < /sys/block/$1/queue/logical_block_size)
+ if [ -r /sys/block/$disk_name/queue/logical_block_size ] ; then
+ echo $( < /sys/block/$disk_name/queue/logical_block_size)
else
echo "512"
fi

View File

@ -1,50 +0,0 @@
diff --git a/usr/share/rear/finalize/Linux-ppc64le/680_install_PPC_bootlist.sh b/usr/share/rear/finalize/Linux-ppc64le/680_install_PPC_bootlist.sh
index bf1db404..3a07580a 100644
--- a/usr/share/rear/finalize/Linux-ppc64le/680_install_PPC_bootlist.sh
+++ b/usr/share/rear/finalize/Linux-ppc64le/680_install_PPC_bootlist.sh
@@ -9,9 +9,12 @@ if grep -q "PowerNV" /proc/cpuinfo || grep -q "emulated by qemu" /proc/cpuinfo ;
fi
# Look for the PPC PReP Boot Partition.
-part=$( awk -F ' ' '/^part / {if ($6 ~ /prep/) {print $7}}' $LAYOUT_FILE )
+part_list=$( awk -F ' ' '/^part / {if ($6 ~ /prep/) {print $7}}' $LAYOUT_FILE )
-if [ -n "$part" ]; then
+# All the possible boot devices
+boot_list=()
+
+for part in $part_list ; do
LogPrint "PPC PReP Boot partition found: $part"
# Using $LAYOUT_DEPS file to find the disk device containing the partition.
@@ -29,14 +32,23 @@ if [ -n "$part" ]; then
# If yes, get the list of path which are part of the multipath device.
# Limit to the first 5 PATH (see #876)
if dmsetup ls --target multipath | grep -w ${bootdev#/dev/mapper/} >/dev/null 2>&1; then
- LogPrint "Limiting bootlist to 5 entries..."
- bootlist_path=$(dmsetup deps $bootdev -o devname | awk -F: '{gsub (" ",""); gsub("\\(","/dev/",$2) ; gsub("\\)"," ",$2) ; print $2}' | cut -d" " -f-5)
- LogPrint "Set LPAR bootlist to $bootlist_path"
- bootlist -m normal $bootlist_path
+ LogPrint "Limiting bootlist to 5 entries as a maximum..."
+ boot_list+=( $(dmsetup deps $bootdev -o devname | awk -F: '{gsub (" ",""); gsub("\\(","/dev/",$2) ; gsub("\\)"," ",$2) ; print $2}' | cut -d" " -f-5) )
else
# Single Path device found
- LogPrint "Set LPAR bootlist to $bootdev"
- bootlist -m normal $bootdev
+ boot_list+=( $bootdev )
fi
- LogIfError "Unable to set bootlist. You will have to start in SMS to set it up manually."
+done
+
+if [[ ${#boot_list[@]} -gt 5 ]]; then
+ LogPrint "Too many entries for bootlist command, limiting to first 5 entries..."
+ boot_list=( ${boot_list[@]:0:5} )
fi
+
+if [[ ${#boot_list[@]} -gt 0 ]]; then
+ LogPrint "Set LPAR bootlist to '${boot_list[*]}'"
+ bootlist -m normal "${boot_list[@]}"
+ LogPrintIfError "Unable to set bootlist. You will have to start in SMS to set it up manually."
+fi
+
+# vim: set et ts=4 sw=4:

View File

@ -1,17 +0,0 @@
diff -up rear-2.4/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh.sfdc02343208 rear-2.4/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh
--- rear-2.4/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh.sfdc02343208 2019-04-09 09:14:05.000000000 +0200
+++ rear-2.4/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh 2019-04-09 09:14:53.000000000 +0200
@@ -65,6 +65,7 @@ WITH_INITRD_MODULES=$( printf '%s\n' ${I
mount -t proc none $TARGET_FS_ROOT/proc
mount -t sysfs none $TARGET_FS_ROOT/sys
+mount -o bind /run $TARGET_FS_ROOT/run
# Recreate any initrd or initramfs image under $TARGET_FS_ROOT/boot/ with new drivers
# Images ignored:
@@ -109,4 +110,4 @@ and decide yourself, whether the system
fi
done
-umount $TARGET_FS_ROOT/proc $TARGET_FS_ROOT/sys
+umount $TARGET_FS_ROOT/proc $TARGET_FS_ROOT/sys $TARGET_FS_ROOT/run

View File

@ -1,16 +1,16 @@
diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf
index 264f2217..313f4118 100644
index 9ada92c3..455aa3ce 100644
--- a/usr/share/rear/conf/default.conf
+++ b/usr/share/rear/conf/default.conf
@@ -1489,7 +1489,7 @@ OBDR_BLOCKSIZE=2048
@@ -1813,7 +1813,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 )
+COPY_AS_IS_NBU=( /usr/openv/bin/vnetd /usr/openv/bin/vopied /usr/openv/lib /usr/openv/netbackup /usr/openv/var/auth/[mn]*.txt /opt/VRTSpbx /etc/vx/VxICS /etc/vx/vrtslog.conf )
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/shared/vddk /usr/openv/netbackup/baremetal )
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/shared/vddk /usr/openv/netbackup/baremetal )
# 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/"
PROGS_NBU=( )
diff --git a/usr/share/rear/rescue/NBU/default/450_prepare_netbackup.sh b/usr/share/rear/rescue/NBU/default/450_prepare_netbackup.sh
index cd48b8d9..ae5a3ccc 100644
--- a/usr/share/rear/rescue/NBU/default/450_prepare_netbackup.sh

View File

@ -2,42 +2,23 @@
Summary: Relax-and-Recover is a Linux disaster recovery and system migration tool
Name: rear
Version: 2.4
Release: 18%{?dist}
Version: 2.6
Release: 3%{?dist}
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
Patch4: rear-bz1492177-warning.patch
Patch6: rear-rhbz1610638.patch
Patch7: rear-rhbz1610647.patch
Patch8: rear-bz1652828-bz1652853.patch
Patch9: rear-bz1631183.patch
Patch10: rear-bz1639705.patch
Patch11: rear-bz1653214.patch
Patch12: rear-bz1659137.patch
patch13: rear-bz1663515.patch
Patch14: rear-bz1672938.patch
Patch15: rear-bz1685166.patch
Patch16: rear-bz1655956.patch
Patch17: rear-bz1732328.patch
Patch18: rear-bz1726982.patch
Patch19: rear-bz1693608.patch
Patch20: rear-bz1700807.patch
Patch21: rear-bz1711123.patch
Patch22: rear-bz1692575.patch
Patch23: rear-sfdc02343208.patch
Patch24: rear-bz1737042.patch
Patch25: rear-bz1743303-rubrik.patch
Patch26: rear-bz1729502-ppc64-iso-level.patch
Patch27: rear-bz1843809-skip-longhorn.patch
Patch28: rear-bz1882060.patch
Patch29: rear-bz1832394.patch
Patch30: rear-sfdc02772301.patch
ExcludeArch: s390x
ExcludeArch: s390
Patch31: rear-bz1945869.patch
Patch32: rear-bz1958247.patch
Patch33: rear-bz1930662.patch
Patch34: rear-asciidoc.patch
Patch35: rear-bz1983013.patch
Patch36: rear-bz1993296.patch
Patch37: rear-bz1747468.patch
### Dependencies on all distributions
BuildRequires: asciidoc
@ -51,6 +32,8 @@ Requires: openssl
Requires: gawk
Requires: attr
Requires: bc
Requires: file
Requires: dhcp-client
### If you require NFS, you may need the below packages
#Requires: nfsclient portmap rpcbind
@ -75,6 +58,13 @@ Requires: syslinux
Requires: yaboot
%endif
%ifarch ppc ppc64 ppc64le
# Called by grub2-install (except on PowerNV)
Requires: /usr/sbin/ofpathname
# Needed to make PowerVM LPARs bootable
Requires: /usr/sbin/bootlist
%endif
Requires: crontabs
Requires: iproute
#Requires: mkisofs
@ -121,31 +111,15 @@ fi
%prep
%setup
%patch4 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
echo "30 1 * * * root test -f /var/lib/rear/layout/disklayout.conf && /usr/sbin/rear checklayout || /usr/sbin/rear mkrescue" >rear.cron
@ -179,6 +153,39 @@ TZ=UTC %{__make} -C doc
%{_sbindir}/rear
%changelog
* 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
by vgcfgrestore
Resolves: rhbz1747468
* Mon Aug 16 2021 Pavel Cahyna <pcahyna@redhat.com> - 2.6-2
- Fix multipath performance regression in 2.6, introduced by upstream PR #2299.
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
conditionally (bootlist only if running under PowerVM, ofpathname
always except on PowerNV) - upstream PR2665, add them to package
dependencies
Resolves: rhbz1983013
* Tue May 11 2021 Pavel Cahyna <pcahyna@redhat.com> - 2.4-19
- Backport PR2608:
Fix setting boot path in case of UEFI partition (ESP) on MD RAID
Resolves: rhbz1945869
- Backport PR2625
Prevents accidental backup removal in case of errors
Resolves: rhbz1958247
- Fix rsync error and option handling
Fixes metadata storage when rsync user is not root
Resolves: rhbz1930662
* Mon Jan 11 2021 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.4-18
- Fix typo in default.conf
Resolves: #1882060