diff options
author | Simon L <szaimen@e.mail.de> | 2022-11-02 07:41:36 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-02 07:41:36 +0300 |
commit | fd3810b7c941e6aecdb39af0792413431b984d34 (patch) | |
tree | ebb638559ceee9e5f4725ac4e330523625f913d5 | |
parent | 4e2276d3660b0e58da8906fd141aa9d939665354 (diff) |
make the system restore script more resilient against failures (#2411)
* make the system restore script more resilient against failures
Signed-off-by: szaimen <szaimen@e.mail.de>
* add hint about bitwarden and co
Signed-off-by: szaimen <szaimen@e.mail.de>
Signed-off-by: szaimen <szaimen@e.mail.de>
-rw-r--r-- | not-supported/restore-backup.sh | 2 | ||||
-rw-r--r-- | not-supported/system-restore.sh | 22 |
2 files changed, 17 insertions, 7 deletions
diff --git a/not-supported/restore-backup.sh b/not-supported/restore-backup.sh index d7799f6a..8b244f40 100644 --- a/not-supported/restore-backup.sh +++ b/not-supported/restore-backup.sh @@ -488,7 +488,7 @@ done # Restore files # Rsync include/exclude patterns: https://stackoverflow.com/a/48010623 -if ! rsync --archive --delete --human-readable --one-file-system -vv --stats \ +if ! rsync --archive --delete --human-readable --one-file-system -vv \ "${EXCLUDE_DIRS[@]}" "${INCLUDE_DIRS[@]}" "${INCLUDE_FILES[@]}" --exclude='*' "$SYSTEM_DIR/" / then msg_box "An issue was reported while restoring all needed files." diff --git a/not-supported/system-restore.sh b/not-supported/system-restore.sh index 716c9fa4..4392a74b 100644 --- a/not-supported/system-restore.sh +++ b/not-supported/system-restore.sh @@ -453,6 +453,7 @@ done # Inform user if ! yesno_box_no "Are you sure that you want to restore your system to the selected state? +Please note that this will also restore the Bitwarden RS/Vaultwarden/Bitwarden database so newly created passwords that were created in the meantime since this backup will get deleted. If you select 'Yes', we will start the restore process!" then umount /tmp/borgsystem @@ -483,10 +484,20 @@ systemctl stop postgresql # Restore the system partition print_text_in_color "$ICyan" "Restoring the files..." -if ! rsync --stats --archive --human-readable --delete --one-file-system \ +if ! rsync --archive --human-readable --delete --one-file-system \ -vv "${EXCLUDE_DIRS[@]}" /tmp/borgsystem/system/ / then - msg_box "Something failed while restoring the system partition." + SYSTEM_RESTORE_FAILED=1 +fi + +# Restore the boot partition +if ! rsync --archive --human-readable -vv --delete /tmp/borgboot/boot/ /boot +then + if [ "$SYSTEM_RESTORE_FAILED" = 1 ] + then + msg_box "Something failed while restoring the system partition." + fi + msg_box "Something failed while restoring the boot partition." umount /tmp/borgsystem umount /tmp/borgboot umount /tmp/borgncdata &>/dev/null @@ -494,10 +505,9 @@ then exit 1 fi -# Restore the boot partition -if ! rsync --stats --archive --human-readable -vv --delete /tmp/borgboot/boot/ /boot +if [ "$SYSTEM_RESTORE_FAILED" = 1 ] then - msg_box "Something failed while restoring the boot partition." + msg_box "Something failed while restoring the system partition." umount /tmp/borgsystem umount /tmp/borgboot umount /tmp/borgncdata &>/dev/null @@ -508,7 +518,7 @@ fi # Restore the ncdata partition if [ -n "$NCDATA_ARCHIVE_EXISTS" ] then - if ! rsync --stats --archive --human-readable --delete --one-file-system \ + if ! rsync --archive --human-readable --delete --one-file-system \ -vv "${PREVIEW_EXCLUDED[*]}" /tmp/borgncdata/ncdata/ /mnt/ncdata then msg_box "Something failed while restoring the ncdata partition." |