test new while loop for mount

This commit is contained in:
Heavybullets8 2022-07-28 22:36:14 -06:00
parent 6e5a0480d9
commit 436599e7a9

View File

@ -76,10 +76,12 @@ read -rt 120 -p "Unmount All Please type a number: " selection
case $selection in
0)
echo "Exitting.."
echo "Exiting.."
exit
;;
1)
while true
do
list=$(k3s kubectl get pvc -A | sort -u | awk '{print NR-1, "\t" $1 "\t" $2 "\t" $4}' | column -t | sed "s/^0/ /")
echo "$list"
read -rt 120 -p "Please type a number: " selection
@ -110,8 +112,27 @@ case $selection in
echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name"
zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app"
echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n"
while [[ $yesno != 0 ]]
do
echo "Would you like to mount anything else?"
echo "1 Yes"
echo "2 No"
read -rt 120 -p "Unmount All Please type a number: " yesno
case $yesno in
1)
continue
;;
2)
exit
;;
*)
echo "Invalid selection \"$yesno\" was not an option" sleep 3
continue
;;
esac
done
done
;;
2)
mapfile -t unmount_array < <(basename -a /mnt/heavyscript/* | sed "s/*//")
[[ -z ${unmount_array[*]} ]] && echo "Theres nothing to unmount" && exit