From b7f577bda36eb538151c60b208e4babdad9c0e46 Mon Sep 17 00:00:00 2001 From: Les De Ridder Date: Mon, 23 May 2016 22:13:24 +0000 Subject: [PATCH] Only include bootstrapped subvolumes in backups --- backup.fish | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/backup.fish b/backup.fish index 2341e9b..49c8f6f 100755 --- a/backup.fish +++ b/backup.fish @@ -18,9 +18,13 @@ for pair in (get-subvol-mounts) set safename (clean-name $subvol) set safepath $subvoldir/$safename - sudo btrfs subvolume snapshot -r $mount $safepath-new + if test -d $safepath + sudo btrfs subvolume snapshot -r $mount $safepath-new - set snapshots $snapshots $safepath + set snapshots $snapshots $safepath + else + echo $mount "is not bootstrapped and will not be included in the backups!" + end end echo "Syncing..." @@ -41,8 +45,10 @@ echo "Renaming subvolumes on target..." for pair in (get-subvol-mounts) set subvol (clean-name (get-subvol $pair)) - rename-target-subvolume $subvol $subvol.(date +%Y-%m-%d) - rename-target-subvolume $subvol-new $subvol + if test -d $subvoldir/$subvol + rename-target-subvolume $subvol $subvol.(date +%Y-%m-%d) + rename-target-subvolume $subvol-new $subvol + end end echo "Done!"