Exclude source subvolumes
Find out parent mountpoint of /etc/conf.d/snapper, get UUID, and exclude it from list of targets. If no external btrfs subvolumes found, exit. Fixes #28.
This commit is contained in:
@@ -141,8 +141,9 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TARGETS="$($ssh findmnt -n -v -t btrfs -o TARGET --list)"
|
EXCLUDE_UUID=$(findmnt -n -v -t btrfs --target /etc/conf.d/snapper -o UUID)
|
||||||
UUIDS="$($ssh findmnt -n -v -t btrfs -o UUID --list)"
|
TARGETS=$($ssh findmnt -n -v -t btrfs -o UUID,TARGET --list | grep -v $EXCLUDE_UUID | awk '{print $2}')
|
||||||
|
UUIDS=$($ssh findmnt -n -v -t btrfs -o UUID,TARGET --list | grep -v $EXCLUDE_UUID | awk '{print $1}')
|
||||||
|
|
||||||
declare -a TARGETS_ARRAY
|
declare -a TARGETS_ARRAY
|
||||||
declare -a UUIDS_ARRAY
|
declare -a UUIDS_ARRAY
|
||||||
@@ -165,6 +166,10 @@ for x in $TARGETS; do
|
|||||||
i=$((i+1))
|
i=$((i+1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ "${#UUIDS_ARRAY[$@]}" -eq 0 ]]; then
|
||||||
|
die "No external btrfs subvolumes found to backup to."
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$disk_count" > 1 ]]; then
|
if [[ "$disk_count" > 1 ]]; then
|
||||||
printf "Multiple mount points were found with UUID $uuid_cmdline.\n"
|
printf "Multiple mount points were found with UUID $uuid_cmdline.\n"
|
||||||
disk="-1"
|
disk="-1"
|
||||||
|
|||||||
Reference in New Issue
Block a user