scale-catalog/truetool/includes/no_args.sh

73 lines
1.8 KiB
Bash
Raw Normal View History

2022-06-14 08:36:45 +00:00
#!/bin/bash
# shellcheck disable=SC2034
2022-06-14 08:36:45 +00:00
no_args(){
echo "0 Show Help"
echo "1 List Internal Service DNS Names"
echo "2 Mount and Unmount PVC storage for easy access"
echo "3 List Backups"
echo "4 Create a Backup"
echo "5 Restore a Backup"
echo "6 Delete a Backup"
echo "7 Enable Helm Commands"
echo "8 Enable Apt and Apt-Get Commands"
echo "9 Update All Apps"
echo "10 Enable external access to Kuberntes API port"
2022-06-14 08:36:45 +00:00
read -rt 600 -p "Please select an option by number: " selection
case $selection in
2022-06-14 20:14:50 +00:00
0)
2022-06-14 08:36:45 +00:00
help="true"
;;
2022-06-14 20:14:50 +00:00
1)
2022-06-14 08:36:45 +00:00
dns="true"
;;
2022-06-14 20:14:50 +00:00
2)
2022-06-14 08:36:45 +00:00
mountPVC="true"
;;
2022-06-14 20:14:50 +00:00
3)
2022-06-14 08:36:45 +00:00
listBackups="true"
;;
2022-06-14 20:14:50 +00:00
4)
2022-06-14 08:36:45 +00:00
read -rt 600 -p "Please type the max number of backups to keep: " backups
re='^[0-9]+$'
number_of_backups=$backups
! [[ $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-06-14 20:14:50 +00:00
5)
2022-06-14 08:36:45 +00:00
restore="true"
;;
2022-06-14 20:14:50 +00:00
6)
2022-06-14 08:36:45 +00:00
deleteBackup="true"
;;
2022-06-14 20:14:50 +00:00
7)
2022-06-14 08:36:45 +00:00
helmEnable="true"
;;
2022-06-14 20:14:50 +00:00
8)
2022-06-14 08:36:45 +00:00
aptEnable="true"
;;
2022-06-14 20:14:50 +00:00
9)
2022-06-14 08:36:45 +00:00
echo ""
echo "1 Update Apps Excluding likely breaking major changes"
echo "2 Update Apps Including likely breaking major changes"
read -rt 600 -p "Please select an option by number: " updateType
if [[ "$updateType" == "1" ]]; then
update_apps="true"
elif [[ "$updateType" == "2" ]]; then
update_all_apps="true"
else
echo "INVALID ENTRY" && exit 1
fi
;;
10)
kubeapiEnable="true"
;;
2022-06-14 08:36:45 +00:00
*)
echo "Unknown option" && exit 1
;;
esac
echo ""
}
export -f no_args