From 89f912299ce70f906be97fbad821a25dc30113b9 Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Sat, 14 May 2022 12:12:31 +0200 Subject: [PATCH] made backup script more resilient to failure --- backup.fish | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backup.fish b/backup.fish index 1c16503..81b63f0 100755 --- a/backup.fish +++ b/backup.fish @@ -26,6 +26,7 @@ end mkdir $LUKS_MOUNT sudo cryptsetup open --type luks $LUKS_DEVICE $LUKS_NAME sudo mount /dev/mapper/$LUKS_NAME $LUKS_MOUNT +echo "$LUKS_NAME" > .luks-device " if test "$argv" = '--browse' @@ -40,7 +41,7 @@ else echo "Syncing filesystem..." set_color normal - rsync --exclude-from=$RSYNC_IGNORE_FILE -rlptgozE ~ $USER@$REMOTE:$REMOTE_PATH #TODO find more applicable options + rsync --exclude-from=$RSYNC_IGNORE_FILE -rlptgozEv --delete ~ $USER@$REMOTE:$REMOTE_PATH #TODO find more applicable options end @@ -48,8 +49,10 @@ end set_color -o green echo "Syncing complete - unmounting luks container..." set_color normal +read -P "Continue? Just press enter to start unmounting! " ssh -t -i $KEY $USER@$REMOTE " sudo umount $LUKS_MOUNT -sudo cryptsetup close --type luks $LUKS_NAME +sudo cryptsetup close --type luks (cat .luks-device) rmdir $LUKS_MOUNT -" \ No newline at end of file +rm .luks-device +"