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 27e348ad..60330007 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 @@ -5,6 +5,6 @@ # for the default values see the standard definition in conf/default.conf file if ! grep -q relative <<< $(echo ${BACKUP_RSYNC_OPTIONS[@]}); then - BACKUP_RSYNC_OPTIONS=( ${BACKUP_RSYNC_OPTIONS[@]} --relative ) + 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 002bfa96..ed6097d3 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 @@ -37,7 +37,7 @@ ProgressStart "Running archive operation" ;; (*) - # no other backup programs foreseen then rsync so far + # no other backup programs foreseen than rsync so far : ;; @@ -117,13 +117,12 @@ _rc="$(cat $TMP_DIR/retval)" sleep 1 # everyone should see this warning, even if not verbose -test "$_rc" -gt 0 && VERBOSE=1 LogPrint "WARNING ! +test "$_rc" -gt 0 && Error " There was an error (${rsync_err_msg[$_rc]}) during archive creation. Please check the archive 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. " diff --git a/usr/share/rear/conf/default.conf b/usr/share/rear/conf/default.conf index 6e98b427..0c9bf37d 100644 --- a/usr/share/rear/conf/default.conf +++ b/usr/share/rear/conf/default.conf @@ -922,7 +922,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/900_copy_result_files.sh b/usr/share/rear/output/RSYNC/default/900_copy_result_files.sh index a3731fd9..f2a5782c 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 @@ -37,4 +37,4 @@ 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}/" +LogIfError "Could not cleanup temporary rsync space: ${TMP_DIR}/rsync/${RSYNC_PREFIX}/" 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 1a2ffb8f..1e23eea2 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 @@ -30,7 +30,7 @@ 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 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..3c2ea9b1 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 @@ -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,15 +74,21 @@ 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. +_rc="$(cat $TMP_DIR/retval)" sleep 1 -test "$_rc" -gt 0 && LogPrint "WARNING ! +if test "$_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[$_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. " + 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)" @@ -89,3 +97,5 @@ if [ $_rc -eq 0 -a "$_message" ] ; then 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..336163fb 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 @@ -4,7 +4,7 @@ # 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 ) + BACKUP_RSYNC_OPTIONS+=( --xattrs ) fi }