scale-catalog/functions/menu.sh

71 lines
2.3 KiB
Bash
Raw Normal View History

2022-07-26 19:08:33 +00:00
#!/bin/bash
menu(){
2022-07-26 19:16:15 +00:00
clear -x
2022-07-26 19:15:49 +00:00
title
2022-07-26 19:08:33 +00:00
echo "0 Help"
echo "1 List DNS Names"
echo "2 Mount and Unmount PVC storage"
echo "3 Create a Backup"
echo "4 Restore a Backup"
echo "5 Delete a Backup"
echo "6 Update All Apps"
read -rt 600 -p "Please select an option by number: " selection
case $selection in
0)
help="true"
;;
1)
dns="true"
;;
2)
mount="true"
;;
2022-07-26 19:11:14 +00:00
3)
2022-07-26 19:08:33 +00:00
read -rt 600 -p "Please type the max number of backups to keep: " number_of_backups
re='^[0-9]+$'
number_of_backups=$number_of_backups
! [[ $number_of_backups =~ $re ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit
[[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit
2022-07-26 19:12:21 +00:00
echo "Generating backup, please be patient for output.."
2022-07-26 19:08:33 +00:00
backup "$number_of_backups"
;;
2022-07-26 19:11:14 +00:00
4)
2022-07-26 19:08:33 +00:00
restore="true"
;;
2022-07-26 19:11:14 +00:00
5)
2022-07-26 19:08:33 +00:00
deleteBackup="true"
;;
2022-07-26 19:11:14 +00:00
6)
2022-07-26 19:29:30 +00:00
script=$(readlink -f "$0")
script_path=$(dirname "$script")
script_name="heavy_script.sh"
cd "$script_path" || exit
clear -x
2022-07-26 19:35:52 +00:00
echo "Choose your update options "
2022-07-26 19:29:30 +00:00
echo
echo "-U | Update all applications, ignores versions"
echo "-u | Update all applications, does not update Major releases"
echo "-b | 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 "-S | Shutdown applications prior to updating"
echo "-v | verbose output"
echo "-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 "-s | sync catalog"
echo "-p | Prune unused/old docker images"
echo
echo "Example: -u 3 -b 14 -rSvsp -i nextcloud"
read -rt 600 -p "Please type the flags you wish, with options above: " update_selection
2022-07-26 19:33:59 +00:00
exec bash "$script_name" "${update_selection[@]}"
2022-07-26 19:29:30 +00:00
2022-07-26 19:08:33 +00:00
;;
*)
echo "Unknown option" && exit 1
;;
esac
echo ""
}
export -f menu