mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-01 18:32:13 +00:00
The main menu opens with a search that finds an option of ProxMenux, an application of the OCI catalog or a Helper-Script by its name or by related words, in that order, and by category after the names. Every result opens what its name says and nothing is run by the search itself: a script starts at its first screen, an application opens its page, an option of the post-install or a system utility opens its list with it marked, and an option that lives inside a menu is opened by that menu, which stays behind it. The menus take the option to open as an argument and behave as before without one. The Helper-Scripts catalog is kept on the host and refreshed once a day. The main menu, the lists of OCI manager and the Helper-Scripts menu share the same height.
131 lines
4.7 KiB
Bash
131 lines
4.7 KiB
Bash
#!/bin/bash
|
|
|
|
# ==========================================================
|
|
# ProxMenux - A menu-driven script for Proxmox VE management
|
|
# ==========================================================
|
|
# Author : MacRimi
|
|
# Copyright : (c) 2024 MacRimi
|
|
# License : (GPL-3.0) (https://github.com/MacRimi/ProxMenux/blob/main/LICENSE)
|
|
# Version : 2.0
|
|
# Last Updated: 04/04/2025
|
|
# ==========================================================
|
|
|
|
# Configuration ============================================
|
|
LOCAL_SCRIPTS="/usr/local/share/proxmenux/scripts"
|
|
BASE_DIR="/usr/local/share/proxmenux"
|
|
UTILS_FILE="$BASE_DIR/utils.sh"
|
|
|
|
|
|
if ! command -v dialog &>/dev/null; then
|
|
apt update -qq >/dev/null 2>&1
|
|
apt install -y dialog >/dev/null 2>&1
|
|
fi
|
|
|
|
|
|
# ==========================================================
|
|
# The legacy "PVE9 + googletrans incompatible" gate that used to live
|
|
# here has been removed along with the googletrans runtime. Translations
|
|
# are now a static lookup against $BASE_DIR/lang/<lang>.json — there is
|
|
# no runtime venv to be incompatible with any PVE version.
|
|
|
|
if [[ -f "$UTILS_FILE" ]]; then
|
|
source "$UTILS_FILE"
|
|
fi
|
|
|
|
|
|
if [[ "$PROXMENUX_PVE9_WARNING_SHOWN" = "1" ]]; then
|
|
|
|
if ! load_language 2>/dev/null; then
|
|
LANGUAGE="en"
|
|
fi
|
|
|
|
else
|
|
load_language
|
|
initialize_cache
|
|
fi
|
|
|
|
# ==========================================================
|
|
|
|
show_menu() {
|
|
local TEMP_FILE
|
|
TEMP_FILE=$(mktemp)
|
|
|
|
while true; do
|
|
|
|
local menu_title="Main menu"
|
|
|
|
# As tall as its options need, cut to the terminal.
|
|
local height=24 limit=$(( $(tput lines 2>/dev/null || echo 24) - 2 ))
|
|
(( height > limit )) && height=$limit
|
|
local rows=$(( height - 8 ))
|
|
(( rows < 3 )) && rows=3
|
|
|
|
dialog --clear \
|
|
--backtitle "ProxMenux" \
|
|
--title "$(translate "$menu_title")" \
|
|
--menu "$(translate "Select an option:")" "$height" 75 "$rows" \
|
|
search "$(translate "Search options and applications")" \
|
|
"" "" \
|
|
1 "$(translate "Settings post-install Proxmox")" \
|
|
2 "$(translate "Hardware: GPUs and Coral-TPU")" \
|
|
3 "$(translate "Create VM from template or script")" \
|
|
4 "$(translate "Disk Manager")" \
|
|
5 "$(translate "Storage & Share Manager")" \
|
|
6 "$(translate "Proxmox VE Helper Scripts")" \
|
|
o "$(translate "OCI manager Apps (beta)")" \
|
|
7 "$(translate "Network Management")" \
|
|
8 "$(translate "Security")" \
|
|
9 "$(translate "Utilities and Tools")" \
|
|
b "$(translate "Host Backup & Restore")" \
|
|
h "$(translate "Help and Info Commands")" \
|
|
s "$(translate "Settings")" \
|
|
0 "$(translate "Exit")" 2>"$TEMP_FILE"
|
|
|
|
local EXIT_STATUS=$?
|
|
|
|
if [[ $EXIT_STATUS -ne 0 ]]; then
|
|
clear
|
|
msg_ok "$(translate "Thank you for using ProxMenux. Goodbye!")"
|
|
rm -f "$TEMP_FILE"
|
|
exit 0
|
|
fi
|
|
|
|
OPTION=$(<"$TEMP_FILE")
|
|
|
|
case $OPTION in
|
|
search)
|
|
# A result that is a sub-menu comes back as its path: it is
|
|
# opened from here, as the options below are.
|
|
local handoff
|
|
local -a target=()
|
|
handoff=$(mktemp)
|
|
python3 "$LOCAL_SCRIPTS/menus/search_menu.py" --handoff "$handoff"
|
|
mapfile -t target < "$handoff"
|
|
rm -f "$handoff"
|
|
if [[ "${target[0]:-}" == "$LOCAL_SCRIPTS"/* && -f "${target[0]}" ]]; then
|
|
rm -f "$TEMP_FILE"
|
|
exec bash "${target[@]}"
|
|
fi
|
|
;;
|
|
"") ;;
|
|
1) exec bash "$LOCAL_SCRIPTS/menus/menu_post_install.sh" ;;
|
|
2) exec bash "$LOCAL_SCRIPTS/menus/hw_grafics_menu.sh" ;;
|
|
3) exec bash "$LOCAL_SCRIPTS/menus/create_vm_menu.sh" ;;
|
|
4) exec bash "$LOCAL_SCRIPTS/menus/storage_menu.sh" ;;
|
|
5) exec bash "$LOCAL_SCRIPTS/menus/share_menu.sh" ;;
|
|
6) exec bash "$LOCAL_SCRIPTS/menus/menu_Helper_Scripts.sh" ;;
|
|
o) exec bash "$LOCAL_SCRIPTS/oci/oci_manager_apps.sh" ;;
|
|
7) exec bash "$LOCAL_SCRIPTS/menus/network_menu.sh" ;;
|
|
8) exec bash "$LOCAL_SCRIPTS/menus/security_menu.sh" ;;
|
|
9) exec bash "$LOCAL_SCRIPTS/menus/utilities_menu.sh" ;;
|
|
b) bash "$LOCAL_SCRIPTS/backup_restore/backup_host.sh" ;;
|
|
h) bash "$LOCAL_SCRIPTS/help_info_menu.sh" ;;
|
|
s) exec bash "$LOCAL_SCRIPTS/menus/config_menu.sh" ;;
|
|
0) clear; msg_ok "$(translate "Thank you for using ProxMenux. Goodbye!")"; rm -f "$TEMP_FILE"; exit 0 ;;
|
|
*) msg_warn "$(translate "Invalid option")"; sleep 2 ;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
show_menu
|