From 78bc6ff8b989bee38f2db8fb0f2891871bc810e4 Mon Sep 17 00:00:00 2001 From: James Barnett Date: Fri, 11 Nov 2016 15:05:12 -0600 Subject: [PATCH] If backupdir key is missing, use root dir to mounted disk The user can hit enter when creating a new directory (no directory is created). In doing so "backupdir" is set to nothing. Snapper does not keep that key. Upon a search of the latest incremental backup we didn't check for backupdir, we just had taken the first key (which ended up being the UUID ). We now check for the backupdir key, and if it is missing that means use the root directory on the mounted disk. Fixes #13. --- bin/snap-sync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/snap-sync b/bin/snap-sync index f5b5609..05586e3 100755 --- a/bin/snap-sync +++ b/bin/snap-sync @@ -146,7 +146,7 @@ for x in $selected_configs; do BACKUPDIR="$selected_mnt/$mybackupdir" mkdir -p "$BACKUPDIR" else - mybackupdir=$(snapper -c root list -t single | awk -F"|" '/'"$selected_uuid"'/ {print $5}' | awk -F "," '{print $1}' | awk -F"=" '{print $2}') + mybackupdir=$(snapper -c root list -t single | awk -F"|" '/'"$selected_uuid"'/ {print $5}' | awk -F "," '/backupdir/ {print $1}' | awk -F"=" '{print $2}') BACKUPDIR="$selected_mnt/$mybackupdir" if [[ ! -d $BACKUPDIR ]]; then printf "ERROR: %s is not a directory on %s.\n" "$BACKUPDIR" "$selected_uuid"