diff --git a/functions/menu.sh b/functions/menu.sh index ec3a860b..8800dd6c 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -113,14 +113,17 @@ case $selection in do clear -x title - echo "Choose Your Update Options" - echo "--------------------------" - echo "1) -b | Back-up your ix-applications dataset, specify a number after -b" + echo "Update Options" + echo "--------------" + 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 "3) -r | Roll-back applications if they fail to update" - echo "4) -S | Shutdown applications prior to updating" - echo "5) -v | verbose output" - 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 "3) -S | Shutdown applications prior to updating" + echo "4) -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 + echo "Additional Options" + echo "------------------" + echo "6) -b | Back-up your ix-applications dataset, specify a number after -b" echo "7) -s | sync catalog" echo "8) -p | Prune unused/old docker images" 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[@]}" exit ;; - 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 - 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") + 1 | -r) + 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") ;; 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; } ! [[ $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") ;; - 3 | -r) - 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) + 3 | -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 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 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 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; } ! [[ $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") ;; + 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) 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") diff --git a/functions/misc.sh b/functions/misc.sh index f4018c5b..44ec0bec 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -43,36 +43,40 @@ echo "---------------------------" echo "(Just dont send any other argument)" echo "bash heavy_script.sh" echo -echo "Basic Utilities" -echo "---------------" +echo "Utilities" +echo "---------" 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 "--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 -echo "Update Options" +echo "Update Types" echo "--------------" echo "-U | Update all applications, ignores versions" 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 5 | Same as above, but updates 5 applications at one time" echo -echo "Additional Update Options" -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 "Update Options" +echo "--------------" 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 "-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 +echo "Additional Options" +echo "------------------" +echo "-b 14 | Back-up your ix-applications dataset, specify a number after -b" echo "-s | sync catalog" echo "-p | Prune unused/old docker images" +echo "--self-update | Updates HeavyScript prior to running any other commands" echo echo "Examples" echo "--------" 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 -vrsp -U 10" +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 --self-update" echo "bash /mnt/tank/scripts/heavy_script.sh -t 150 --mount" echo "bash /mnt/tank/scripts/heavy_script.sh --dns" echo "bash heavy_script.sh --restore"