change order in menu

This commit is contained in:
Heavybullets8 2022-07-31 19:01:16 -06:00
parent f23355ceb9
commit 56094507f9
2 changed files with 37 additions and 31 deletions

View File

@ -113,14 +113,17 @@ case $selection in
do do
clear -x clear -x
title title
echo "Choose Your Update Options" echo "Update Options"
echo "--------------------------" echo "--------------"
echo "1) -b | Back-up your ix-applications dataset, specify a number after -b" echo "1) -r | Roll-back applications if they fail to update"
echo "2) -i | Add application to ignore list, one by one, see example below." echo "2) -i | Add application to ignore list, one by one, see example below."
echo "3) -r | Roll-back applications if they fail to update" echo "3) -S | Shutdown applications prior to updating"
echo "4) -S | Shutdown applications prior to updating" echo "4) -v | verbose output"
echo "5) -v | verbose output" echo "5) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds"
echo "6) -t | Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" echo
echo "Additional Options"
echo "------------------"
echo "6) -b | Back-up your ix-applications dataset, specify a number after -b"
echo "7) -s | sync catalog" echo "7) -s | sync catalog"
echo "8) -p | Prune unused/old docker images" echo "8) -p | Prune unused/old docker images"
echo "9) --self-update | Updates HeavyScript prior to running any other commands" echo "9) --self-update | Updates HeavyScript prior to running any other commands"
@ -147,39 +150,38 @@ case $selection in
exec bash "$script_name" "${update_selection[@]}" exec bash "$script_name" "${update_selection[@]}"
exit exit
;; ;;
1 | -b) 1 | -r)
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 -- "-r" && echo -e "\"-r\" 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?" update_selection+=("-r")
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 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 3 && continue
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 || { echo -e "\nFailed to make a selection in time" ; exit; } 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")
;; ;;
3 | -r) 3 | -S)
printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-r" && echo -e "\"-r\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it
update_selection+=("-r")
;;
4 | -S)
printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-S" && echo -e "\"-S\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-S" && echo -e "\"-S\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it
update_selection+=("-S") update_selection+=("-S")
;; ;;
5 | -v) 4 | -v)
printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-v" && echo -e "\"-v\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-v" && echo -e "\"-v\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it
update_selection+=("-v") update_selection+=("-v")
;; ;;
6 | -t) 5 | -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 || { echo -e "\nFailed to make a selection in time" ; exit; } 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")
;; ;;
6 | -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
echo "Up to how many backups should we keep?"
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 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 3 && continue
update_selection+=("-b" "$up_backups")
;;
7 | -s) 7 | -s)
printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-s" && echo -e "\"-s\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-s" && echo -e "\"-s\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it
update_selection+=("-s") update_selection+=("-s")

View File

@ -43,36 +43,40 @@ echo "---------------------------"
echo "(Just dont send any other argument)" echo "(Just dont send any other argument)"
echo "bash heavy_script.sh" echo "bash heavy_script.sh"
echo echo
echo "Basic Utilities" echo "Utilities"
echo "---------------" echo "---------"
echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data" echo "--mount | Initiates mounting feature, choose between unmounting and mounting PVC data"
echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset" echo "--restore | Opens a menu to restore a \"heavy_script\" backup that was taken on your \"ix-applications\" dataset"
echo "--delete-backup | Opens a menu to delete backups on your system" echo "--delete-backup | Opens a menu to delete backups on your system"
echo "--dns | list all of your applications DNS names and their web ports" echo "--dns | list all of your applications DNS names and their web ports"
echo echo
echo "Update Options" echo "Update Types"
echo "--------------" echo "--------------"
echo "-U | Update all applications, ignores versions" echo "-U | Update all applications, ignores versions"
echo "-U 5 | Same as above, but updates 5 applications at one time" echo "-U 5 | Same as above, but updates 5 applications at one time"
echo "-u | Update all applications, does not update Major releases" echo "-u | Update all applications, does not update Major releases"
echo "-u 5 | Same as above, but updates 5 applications at one time" echo "-u 5 | Same as above, but updates 5 applications at one time"
echo echo
echo "Additional Update Options" echo "Update Options"
echo "-------------------------" echo "--------------"
echo "-b 14 | Back-up your ix-applications dataset, specify a number after -b"
echo "-i | Add application to ignore list, one by one, see example below."
echo "-r | Roll-back applications if they fail to update" echo "-r | Roll-back applications if they fail to update"
echo "-i | Add application to ignore list, one by one, see example below."
echo "-S | Shutdown applications prior to updating" echo "-S | Shutdown applications prior to updating"
echo "-v | verbose output" echo "-v | verbose output"
echo "-t 500| Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds" echo "-t 500| Set a custom timeout in seconds when checking if either an App or Mountpoint correctly Started, Stopped or (un)Mounted. Defaults to 500 seconds"
echo
echo "Additional Options"
echo "------------------"
echo "-b 14 | Back-up your ix-applications dataset, specify a number after -b"
echo "-s | sync catalog" echo "-s | sync catalog"
echo "-p | Prune unused/old docker images" echo "-p | Prune unused/old docker images"
echo "--self-update | Updates HeavyScript prior to running any other commands"
echo echo
echo "Examples" echo "Examples"
echo "--------" echo "--------"
echo "bash heavy_script.sh" echo "bash heavy_script.sh"
echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -t 600 -vrsUp" echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -t 600 -vrsUp --self-update"
echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -t 600 -vrsp -U 10" echo "bash heavy_script.sh -b 14 -i portainer -i arch -i sonarr -t 600 -vrsp -U 10 --self-update"
echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount"
echo "bash /mnt/tank/scripts/heavy_script.sh --dns" echo "bash /mnt/tank/scripts/heavy_script.sh --dns"
echo "bash heavy_script.sh --restore" echo "bash heavy_script.sh --restore"