scale-catalog/functions/menu.sh

97 lines
2.5 KiB
Bash
Raw Normal View History

2022-07-26 19:08:33 +00:00
#!/bin/bash
2022-08-26 04:39:26 +00:00
2022-07-26 19:08:33 +00:00
menu(){
2022-07-27 01:04:27 +00:00
clear -x
title
2022-09-02 23:24:37 +00:00
echo "Available Utilities"
echo "-------------------"
2022-07-27 01:04:27 +00:00
echo "1) Help"
echo "2) List DNS Names"
echo "3) Mount and Unmount PVC storage"
2022-09-02 23:15:28 +00:00
echo "4) Backup Options"
echo "5) Update HeavyScript"
echo "6) Update Applications"
echo "7) Command to Container"
2022-12-18 20:26:56 +00:00
echo "8) Patch 22.12.0"
2022-12-26 21:36:35 +00:00
echo "9) Patch 22.12.0 (2)"
2022-07-27 01:04:27 +00:00
echo
echo "0) Exit"
read -rt 120 -p "Please select an option by number: " selection || { echo -e "\nFailed to make a selection in time" ; exit; }
2022-07-27 00:21:45 +00:00
2022-07-27 01:04:27 +00:00
case $selection in
2022-07-27 00:21:45 +00:00
0)
2022-09-02 23:15:28 +00:00
echo "Exiting.."
2022-07-27 00:21:45 +00:00
exit
;;
1)
2022-08-09 04:17:15 +00:00
help
2022-07-27 00:21:45 +00:00
;;
2)
2022-12-27 11:02:56 +00:00
dns
2022-07-27 00:21:45 +00:00
;;
3)
2022-08-09 04:17:15 +00:00
mount
2022-07-27 00:21:45 +00:00
;;
4)
2022-09-02 23:15:28 +00:00
while [[ $backup_selection != true ]]
do
clear -x
title
echo "Backup Menu"
2022-09-02 23:24:37 +00:00
echo "-----------"
2022-09-02 23:15:28 +00:00
echo "1) Create Backup"
echo "2) Delete Backup"
echo "3) Restore Backup"
echo
echo "0) Exit"
read -rt 120 -p "Please select an option by number: " backup_selection || { echo -e "\nFailed to make a selection in time" ; exit; }
case $backup_selection in
0)
echo "Exiting.."
exit
;;
1)
read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups || { echo -e "\nFailed to make a selection in time" ; exit; }
! [[ $number_of_backups =~ ^[0-9]+$ ]] && echo -e "Error: The input must be 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
backup_selection=true
;;
2)
backup_selection=true
deleteBackup
;;
3)
backup_selection=true
restore
;;
*)
echo "\"$selection\" was not an option, please try agian" && sleep 3 && continue
;;
esac
done
2022-07-27 04:45:12 +00:00
;;
2022-12-27 11:02:56 +00:00
2022-07-27 00:21:45 +00:00
5)
2022-08-09 04:17:15 +00:00
self_update
2022-07-27 00:21:45 +00:00
;;
2022-09-02 23:15:28 +00:00
6)
2022-08-09 04:17:15 +00:00
script_create
2022-07-27 00:21:45 +00:00
;;
2022-09-02 23:15:28 +00:00
7)
2022-08-09 04:17:15 +00:00
cmd_to_container
2022-08-09 02:12:09 +00:00
;;
2022-12-18 20:26:56 +00:00
8)
patch_2212_backups
;;
2022-12-27 11:02:56 +00:00
9)
2022-12-26 21:36:35 +00:00
patch_2212_backups2
;;
2022-07-27 00:21:45 +00:00
*)
2022-07-29 22:13:01 +00:00
echo "\"$selection\" was not an option, please try agian" && sleep 3 && menu
2022-07-27 00:21:45 +00:00
;;
2022-07-27 01:04:27 +00:00
esac
echo
2022-07-26 19:08:33 +00:00
}
2022-12-27 11:02:56 +00:00
export -f menu