change user input
This commit is contained in:
parent
ebb472dae7
commit
0e60f84c22
@ -46,7 +46,7 @@ do
|
|||||||
echo "$list_backups"
|
echo "$list_backups"
|
||||||
echo
|
echo
|
||||||
echo "0) Exit"
|
echo "0) Exit"
|
||||||
read -rt 120 -p "Please type a number: " selection
|
read -rt 240 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}')
|
restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}')
|
||||||
if [[ $selection == 0 ]]; then
|
if [[ $selection == 0 ]]; then
|
||||||
echo "Exiting.."
|
echo "Exiting.."
|
||||||
@ -67,16 +67,16 @@ do
|
|||||||
clear -x
|
clear -x
|
||||||
echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point"
|
echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point"
|
||||||
echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?"
|
echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?"
|
||||||
echo -e "1) Yes\n2) Exit\n"
|
echo -e "Y) Yes\nN) No\n"
|
||||||
read -rt 120 -p "Please type a number: " yesno
|
read -rt 120 -p "Please type a number: " yesno || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
case $yesno in
|
case $yesno in
|
||||||
1)
|
[Yy])
|
||||||
echo -e "\nDeleting $restore_point"
|
echo -e "\nDeleting $restore_point"
|
||||||
cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null || { echo "Failed to delete backup.."; exit; }
|
cli -c 'app kubernetes delete_backup backup_name=''"'"$restore_point"'"' &>/dev/null || { echo "Failed to delete backup.."; exit; }
|
||||||
echo "Sucessfully deleted"
|
echo "Sucessfully deleted"
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
2)
|
[Nn])
|
||||||
echo "Exiting"
|
echo "Exiting"
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
@ -90,14 +90,14 @@ do
|
|||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
echo "Delete more?"
|
echo "Delete more?"
|
||||||
echo "1) Yes"
|
echo "Y) Yes"
|
||||||
echo "2) No"
|
echo "N) No"
|
||||||
read -rt 120 -p "Please type a number: " yesno
|
read -rt 120 -p "Please type a number: " yesno || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
case $yesno in
|
case $yesno in
|
||||||
1)
|
[Yy])
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
2)
|
[Nn])
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@ -131,7 +131,7 @@ do
|
|||||||
echo "$list_backups"
|
echo "$list_backups"
|
||||||
echo
|
echo
|
||||||
echo "0) Exit"
|
echo "0) Exit"
|
||||||
read -rt 120 -p "Please type a number: " selection
|
read -rt 240 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}')
|
restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}')
|
||||||
if [[ $selection == 0 ]]; then
|
if [[ $selection == 0 ]]; then
|
||||||
echo "Exiting.."
|
echo "Exiting.."
|
||||||
@ -152,15 +152,15 @@ do
|
|||||||
clear -x
|
clear -x
|
||||||
echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible"
|
echo -e "\nWARNING:\nThis is NOT guranteed to work\nThis is ONLY supposed to be used as a LAST RESORT\nConsider rolling back your applications instead if possible"
|
||||||
echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?"
|
echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?"
|
||||||
echo -e "1) Yes\n2) Exit\n"
|
echo -e "Y) Yes\nN) No\n"
|
||||||
read -rt 120 -p "Please type a number: " yesno
|
read -rt 120 -p "Please type a number: " yesno || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
case $yesno in
|
case $yesno in
|
||||||
1)
|
[Yy])
|
||||||
echo -e "\nStarting Backup, this will take a LONG time."
|
echo -e "\nStarting Backup, this will take a LONG time."
|
||||||
cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || { echo "Failed to delete backup.."; exit; }
|
cli -c 'app kubernetes restore_backup backup_name=''"'"$restore_point"'"' || { echo "Failed to delete backup.."; exit; }
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
2)
|
[Nn])
|
||||||
echo "Exiting"
|
echo "Exiting"
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
|
@ -29,7 +29,7 @@ case $selection in
|
|||||||
mount="true"
|
mount="true"
|
||||||
;;
|
;;
|
||||||
4)
|
4)
|
||||||
read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups
|
read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups || echo "Failed to make a selection"
|
||||||
backup="true"
|
backup="true"
|
||||||
;;
|
;;
|
||||||
5)
|
5)
|
||||||
@ -53,12 +53,17 @@ case $selection in
|
|||||||
echo
|
echo
|
||||||
echo "0) Exit"
|
echo "0) Exit"
|
||||||
echo
|
echo
|
||||||
read -rt 120 -p "Please type the number associated with the flag above: " current_selection
|
read -rt 120 -p "Type the Number or Flag: " current_selection || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
if [[ $current_selection == 1 ]]; then
|
case $current_selection in
|
||||||
|
0 | [Ee][Xx][Ii][Tt])
|
||||||
|
echo "Exiting.."
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
1 | -U)
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
echo -e "\nHow many applications do you want updating at the same time?"
|
echo -e "\nHow many applications do you want updating at the same time?"
|
||||||
read -rt 120 -p "Please type an integer greater than 0: " up_async
|
read -rt 120 -p "Please type an integer greater than 0: " up_async || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
if [[ $up_async == 0 ]]; then
|
if [[ $up_async == 0 ]]; then
|
||||||
echo "Error: \"$up_async\" is less than 1"
|
echo "Error: \"$up_async\" is less than 1"
|
||||||
echo "NOT adding it to the list"
|
echo "NOT adding it to the list"
|
||||||
@ -75,11 +80,12 @@ case $selection in
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
break
|
break
|
||||||
elif [[ $current_selection == 2 ]]; then
|
;;
|
||||||
|
2 | -u)
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
echo -e "\nHow many applications do you want updating at the same time?"
|
echo -e "\nHow many applications do you want updating at the same time?"
|
||||||
read -rt 120 -p "Please type an integer greater than 0: " up_async
|
read -rt 120 -p "Please type an integer greater than 0: " up_async || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
if [[ $up_async == 0 ]]; then
|
if [[ $up_async == 0 ]]; then
|
||||||
echo "Error: \"$up_async\" is less than 1"
|
echo "Error: \"$up_async\" is less than 1"
|
||||||
echo "NOT adding it to the list"
|
echo "NOT adding it to the list"
|
||||||
@ -96,13 +102,12 @@ case $selection in
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
break
|
break
|
||||||
elif [[ $current_selection == 0 ]]; then
|
;;
|
||||||
echo "Exiting.."
|
*)
|
||||||
exit
|
|
||||||
else
|
|
||||||
echo "$current_selection was not an option, try again" && sleep 3
|
echo "$current_selection was not an option, try again" && sleep 3
|
||||||
continue
|
continue
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
@ -129,9 +134,9 @@ case $selection in
|
|||||||
echo "---------------"
|
echo "---------------"
|
||||||
echo "bash heavy_script.sh ${update_selection[*]}"
|
echo "bash heavy_script.sh ${update_selection[*]}"
|
||||||
echo
|
echo
|
||||||
read -rt 120 -p "Type the Number OR Flag: " current_selection
|
read -rt 600 -p "Type the Number or Flag: " current_selection || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
case $current_selection in
|
case $current_selection in
|
||||||
0)
|
0 | [Ee][Xx][Ii][Tt])
|
||||||
echo "Exiting.."
|
echo "Exiting.."
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
@ -145,13 +150,13 @@ case $selection in
|
|||||||
1 | -b)
|
1 | -b)
|
||||||
printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it
|
printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it
|
||||||
echo "Up to how many backups should we keep?"
|
echo "Up to how many backups should we keep?"
|
||||||
read -rt 120 -p "Please type an integer: " up_backups
|
read -rt 120 -p "Please type an integer: " up_backups || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue
|
! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue
|
||||||
[[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 3 && continue
|
[[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 3 && continue
|
||||||
update_selection+=("-b" "$up_backups")
|
update_selection+=("-b" "$up_backups")
|
||||||
;;
|
;;
|
||||||
2 | -i)
|
2 | -i)
|
||||||
read -rt 120 -p "What is the name of the application we should ignore?: " up_ignore
|
read -rt 120 -p "What is the name of the application we should ignore?: " up_ignore || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is not a possible option for an application name" && sleep 3 && continue
|
! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is not a possible option for an application name" && sleep 3 && continue
|
||||||
update_selection+=("-i" "$up_ignore")
|
update_selection+=("-i" "$up_ignore")
|
||||||
;;
|
;;
|
||||||
@ -171,7 +176,7 @@ case $selection in
|
|||||||
6 | -t)
|
6 | -t)
|
||||||
printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-t" && echo -e "\"-t\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it
|
printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-t" && echo -e "\"-t\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it
|
||||||
echo "What do you want your timeout to be?"
|
echo "What do you want your timeout to be?"
|
||||||
read -rt 120 -p "Please type an integer: " up_timeout
|
read -rt 120 -p "Please type an integer: " up_timeout || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue
|
! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue
|
||||||
update_selection+=("-t" "$up_timeout")
|
update_selection+=("-t" "$up_timeout")
|
||||||
;;
|
;;
|
||||||
|
@ -9,7 +9,7 @@ do
|
|||||||
echo "2) Unmount All"
|
echo "2) Unmount All"
|
||||||
echo
|
echo
|
||||||
echo "0) Exit"
|
echo "0) Exit"
|
||||||
read -rt 120 -p "Unmount All Please type a number: " selection
|
read -rt 120 -p "Unmount All Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
case $selection in
|
case $selection in
|
||||||
0)
|
0)
|
||||||
echo "Exiting.."
|
echo "Exiting.."
|
||||||
@ -27,7 +27,7 @@ do
|
|||||||
echo "$list"
|
echo "$list"
|
||||||
echo
|
echo
|
||||||
echo "0) Exit"
|
echo "0) Exit"
|
||||||
read -rt 120 -p "Please type a number: " selection
|
read -rt 120 -p "Please type a number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
[[ $selection == 0 ]] && echo "Exiting.." && exit
|
[[ $selection == 0 ]] && echo "Exiting.." && exit
|
||||||
app=$(echo -e "$list" | grep ^"$selection)" | awk '{print $2}' | cut -c 4- )
|
app=$(echo -e "$list" | grep ^"$selection)" | awk '{print $2}' | cut -c 4- )
|
||||||
[[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && continue #Check for valid selection. If none, contiue
|
[[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && continue #Check for valid selection. If none, contiue
|
||||||
@ -59,16 +59,16 @@ do
|
|||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
echo -e "\nWould you like to mount anything else?"
|
echo -e "\nWould you like to mount anything else?"
|
||||||
echo "1) Yes"
|
echo "Y) Yes"
|
||||||
echo "2) No"
|
echo "N) No"
|
||||||
read -rt 120 -p "Please type a number: " yesno
|
read -rt 120 -p "Please type a number: " yesno || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
case $yesno in
|
case $yesno in
|
||||||
1)
|
[Yy])
|
||||||
clear -x
|
clear -x
|
||||||
title
|
title
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
2)
|
[Nn])
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
Loading…
Reference in New Issue
Block a user