Refactor install menu and add settings submenu
Updated the install menu labels for clarity and dynamic numbering. Introduced a new settings_menu function to manage diagnostic, default, and storage settings, with conditional options based on the presence of app defaults.
This commit is contained in:
parent
b678f8828a
commit
8b34ae346b
@ -1551,18 +1551,21 @@ install_script() {
|
||||
else
|
||||
# Build dynamic menu
|
||||
local menu_items=(
|
||||
"1" "Default Settings"
|
||||
"2" "Default Settings (Verbose)"
|
||||
"3" "Advanced Install"
|
||||
"1" "Default Install"
|
||||
"2" "Default Install (Verbose)"
|
||||
"3" "Advanced Settings"
|
||||
"4" "My Defaults"
|
||||
)
|
||||
|
||||
local next=5
|
||||
if [ -f "$(get_app_defaults_path)" ]; then
|
||||
menu_items+=("5" "App Defaults for ${APP}")
|
||||
menu_items+=("$next" "App Defaults for ${APP}")
|
||||
next=$((next + 1))
|
||||
fi
|
||||
|
||||
menu_items+=(
|
||||
"6" "Diagnostic Settings"
|
||||
"7" "Storage Settings"
|
||||
"8" "Exit"
|
||||
"$next" "Settings"
|
||||
"$((next + 1))" "Exit"
|
||||
)
|
||||
|
||||
TMP_CHOICE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" \
|
||||
@ -1753,6 +1756,44 @@ install_script() {
|
||||
# fi
|
||||
# }
|
||||
|
||||
settings_menu() {
|
||||
while true; do
|
||||
local settings_items=(
|
||||
"1" "Manage API-Diagnostic Setting"
|
||||
"2" "Edit Default.vars"
|
||||
"3" "Edit Default Storage"
|
||||
)
|
||||
if [ -f "$(get_app_defaults_path)" ]; then
|
||||
settings_items+=("4" "Edit App.vars for ${APP}")
|
||||
settings_items+=("5" "Exit")
|
||||
else
|
||||
settings_items+=("4" "Exit")
|
||||
fi
|
||||
|
||||
local choice
|
||||
choice=$(whiptail --backtitle "Proxmox VE Helper Scripts" \
|
||||
--title "SETTINGS MENU" \
|
||||
--ok-button "OK" --cancel-button "Back" \
|
||||
--menu "Choose a settings option:" 20 60 9 \
|
||||
"${settings_items[@]}" \
|
||||
3>&1 1>&2 2>&3) || return 0
|
||||
|
||||
case "$choice" in
|
||||
1) diagnostics_menu ;;
|
||||
2) ${EDITOR:-nano} /usr/local/community-scripts/default.vars ;;
|
||||
3) edit_default_storage ;;
|
||||
4)
|
||||
if [ -f "$(get_app_defaults_path)" ]; then
|
||||
${EDITOR:-nano} "$(get_app_defaults_path)"
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
5) return 0 ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# ===== Unified storage selection & writing to vars files =====
|
||||
_write_storage_to_vars() {
|
||||
# $1 = vars_file, $2 = key (var_container_storage / var_template_storage), $3 = value
|
||||
|
Loading…
x
Reference in New Issue
Block a user