fix --noconfirm and uuid selection

This commit is contained in:
James Barnett
2016-11-07 19:19:42 -06:00
parent b70b9b80ea
commit 3a0e472f4f

View File

@@ -100,10 +100,11 @@ if [[ "$disk" == -1 ]]; then
if [[ $disk == 0 ]]; then if [[ $disk == 0 ]]; then
exit 0 exit 0
fi fi
disk=$(($disk-1))
fi fi
selected_uuid="${UUIDS_ARRAY[$((disk-1))]}" selected_uuid="${UUIDS_ARRAY[$((disk))]}"
selected_mnt="${TARGETS_ARRAY[$((disk-1))]}" selected_mnt="${TARGETS_ARRAY[$((disk))]}"
printf "You selected the disk with UUID %s.\n" "$selected_uuid" printf "You selected the disk with UUID %s.\n" "$selected_uuid"
if [[ -f /etc/conf.d/snapper ]]; then if [[ -f /etc/conf.d/snapper ]]; then
@@ -114,11 +115,10 @@ else
fi fi
selected_configs=${selected_configs:-$SNAPPER_CONFIGS} selected_configs=${selected_configs:-$SNAPPER_CONFIGS}
echo $selected_configs
for x in $selected_configs; do for x in $selected_configs; do
if [[ -d "/etc/snapper/configs/$x" ]]; then if [[ -f "/etc/snapper/configs/$x" ]]; then
source /etc/snapper/configs/$x source /etc/snapper/configs/$x
else else
printf "Error: Selected snapper configuration $x does not exist." printf "Error: Selected snapper configuration $x does not exist."
@@ -152,7 +152,7 @@ for x in $selected_configs; do
backup_location=$BACKUPDIR/$x/$new_number/ backup_location=$BACKUPDIR/$x/$new_number/
printf "Backup location: %s\n" "$backup_location" printf "Backup location: %s\n" "$backup_location"
if [[ ! $noconfirm ]]; then if [[ $noconfirm == "yes" ]]; then
cont_backup="yes" cont_backup="yes"
else else
read -r -p "Continue [Y/n]? " cont_backup read -r -p "Continue [Y/n]? " cont_backup