Update menus dialog

This commit is contained in:
MacRimi 2025-05-04 23:49:44 +02:00
parent 56ccbd8596
commit e8c60e887a
4 changed files with 305 additions and 152 deletions

View File

@ -6,8 +6,8 @@
# Author : MacRimi
# Copyright : (c) 2024 MacRimi
# License : MIT (https://raw.githubusercontent.com/MacRimi/ProxMenux/main/LICENSE)
# Version : 1.1
# Last Updated: 06/02/2025
# Version : 1.2
# Last Updated: 04/04/2025
# ==========================================================
# Description:
# This script installs and configures ProxMenux, a menu-driven
@ -117,7 +117,7 @@ install_proxmenu() {
fi
DEPS=("whiptail" "curl" "python3" "python3-venv" "python3-pip")
DEPS=("whiptail" "dialog" "curl" "python3" "python3-venv" "python3-pip")
for pkg in "${DEPS[@]}"; do
if ! dpkg -l | grep -qw "$pkg"; then
msg_info "Installing $pkg..."

View File

@ -72,11 +72,19 @@ show_system_commands() {
echo -e "19) ${GREEN}w${NC} - $(translate 'User activity and uptime')"
echo -e "20) ${GREEN}cut -d: -f1,3,4 /etc/passwd${NC} - $(translate 'All users with UID and GID')"
echo -e "21) ${GREEN}getent passwd | column -t -s :${NC} - $(translate 'Readable user table (UID, shell, etc.)')"
echo -e " ${DEF}0)$(translate ' Back to previous menu')${CL}"
echo -e " ${DEF}0) $(translate ' Back to previous menu or Esc + Enter')"
echo
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command.: ') ${CL}"
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command: ') ${CL}"
read -r user_input
# Check for Esc key press
if [[ "$user_input" == $'\x1b' ]]; then
break
fi
case "$user_input" in
0) break ;;
[1-9]|1[0-9]|2[0-1])
case "$user_input" in
1) cmd="pveversion" ;;
2) cmd="pveversion -v" ;;
@ -99,15 +107,23 @@ show_system_commands() {
19) cmd="w" ;;
20) cmd="cut -d: -f1,3,4 /etc/passwd" ;;
21) cmd="getent passwd | column -t -s :" ;;
0) break ;;
*) cmd="$user_input" ;;
esac
echo -e "\n${GREEN}> $cmd${NC}\n"
bash -c "$cmd"
echo
msg_success "$(translate 'Press ENTER to continue...')"
read -r tmp
;;
*)
if [[ -n "$user_input" ]]; then
echo -e "\n${GREEN}> $user_input${NC}\n"
bash -c "$user_input"
echo
msg_success "$(translate 'Press ENTER to continue...')"
read -r tmp
fi
;;
esac
done
}
@ -133,11 +149,16 @@ show_vm_ct_commands() {
echo -e "11) ${GN}[Only with menu] Show CT users for permission mapping${NC} - $(translate 'root and real users only')"
echo -e "12) ${GREEN}pct exec <ctid> -- getent passwd | column -t -s :${NC} - $(translate 'Show CT users in table format')"
echo -e "13) ${GREEN}pct exec <ctid> -- ps aux --sort=-%mem | head${NC} - $(translate 'Top memory processes in CT')"
echo -e " ${DEF}0)$(translate ' Back to previous menu')${CL}"
echo -e " ${DEF}0) $(translate ' Back to previous menu or Esc + Enter')"
echo
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command.: ') ${CL}"
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command: ') ${CL}"
read -r user_input
# Check for Esc key press
if [[ "$user_input" == $'\x1b' ]]; then
break
fi
case "$user_input" in
1) cmd="qm list" ;;
2) cmd="pct list" ;;
@ -199,6 +220,7 @@ show_vm_ct_commands() {
}
# ===============================================================
# 03 Storage and Disks Commands
# ===============================================================
@ -214,11 +236,21 @@ show_storage_commands() {
echo -e " 5) ${GREEN}vgdisplay${NC} - $(translate 'Display volume groups (LVM)')"
echo -e " 6) ${GREEN}lvdisplay${NC} - $(translate 'Display logical volumes (LVM)')"
echo -e " 7) ${GREEN}cat /etc/pve/storage.cfg${NC} - $(translate 'Show Proxmox storage configuration')"
echo -e " ${DEF}0)$(translate ' Back to previous menu')${CL}"
echo -e " 8) ${GREEN}blkid${NC} - $(translate 'Show UUID and filesystem type of block devices')"
echo -e " 9) ${GREEN}ls -lh /dev/disk/by-id/${NC} - $(translate 'List disk persistent identifiers')"
echo -e "10) ${GREEN}parted -l${NC} - $(translate 'Detailed partition layout with GPT info')"
echo -e "11) ${GREEN}mount | grep ^/dev${NC} - $(translate 'Show mounted storage devices')"
echo -e "12) ${GREEN}cat /proc/mounts${NC} - $(translate 'Show all active mounts from the kernel')"
echo -e " ${DEF}0) $(translate ' Back to previous menu or Esc + Enter')"
echo
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command.: ') ${CL}"
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command: ') ${CL}"
read -r user_input
# Check for Esc key press
if [[ "$user_input" == $'\x1b' ]]; then
break
fi
case "$user_input" in
1) cmd="lsblk" ;;
2) cmd="fdisk -l" ;;
@ -227,6 +259,11 @@ show_storage_commands() {
5) cmd="vgdisplay" ;;
6) cmd="lvdisplay" ;;
7) cmd="cat /etc/pve/storage.cfg" ;;
8) cmd="blkid" ;;
9) cmd="ls -lh /dev/disk/by-id/" ;;
10) cmd="parted -l" ;;
11) cmd="mount | grep ^/dev" ;;
12) cmd="cat /proc/mounts" ;;
0) break ;;
*) cmd="$user_input" ;;
esac
@ -240,6 +277,7 @@ show_storage_commands() {
}
# ===============================================================
# 04 Network Commands
# ===============================================================
@ -254,11 +292,25 @@ show_network_commands() {
echo -e " 4) ${GREEN}brctl show${NC} - $(translate 'Show configured network bridges')"
echo -e " 5) ${GREEN}ifreload -a${NC} - $(translate 'Reload network configuration (ifupdown2)')"
echo -e " 6) ${GREEN}cat /etc/network/interfaces${NC} - $(translate 'Show raw network configuration')"
echo -e " ${DEF}0)$(translate ' Back to previous menu')${CL}"
echo -e " 7) ${GREEN}ip -s link${NC} - $(translate 'Show traffic statistics per interface')"
echo -e " 8) ${GREEN}ethtool <iface>${NC} - $(translate 'Show Ethernet device info')"
echo -e " 9) ${GREEN}resolvectl status${NC} - $(translate 'Show DNS resolution status')"
echo -e "10) ${GREEN}dig <domain>${NC} - $(translate 'DNS lookup for a domain')"
echo -e "11) ${GREEN}ss -tuln${NC} - $(translate 'Show listening ports (TCP/UDP)')"
echo -e "12) ${GREEN}iptables -L -n -v${NC} - $(translate 'Show active firewall rules (iptables)')"
echo -e "13) ${GREEN}nft list ruleset${NC} - $(translate 'Show nftables rules')"
echo -e "14) ${GREEN}pve-firewall status${NC} - $(translate 'Check Proxmox firewall status')"
echo -e "15) ${GREEN}pve-firewall compile${NC} - $(translate 'Compile firewall rules for all nodes')"
echo -e "16) ${GREEN}pve-firewall reload${NC} - $(translate 'Reload Proxmox firewall rules')"
echo -e " ${DEF}0) $(translate ' Back to previous menu or Esc + Enter')"
echo
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command.: ') ${CL}"
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command: ') ${CL}"
read -r user_input
if [[ "$user_input" == $'\x1b' ]]; then
break
fi
case "$user_input" in
1) cmd="ip a" ;;
2) cmd="ip r" ;;
@ -270,6 +322,28 @@ show_network_commands() {
4) cmd="brctl show" ;;
5) cmd="ifreload -a" ;;
6) cmd="cat /etc/network/interfaces" ;;
7) cmd="ip -s link" ;;
8)
echo -e "\n${YELLOW}$(translate 'Available network interfaces:')${NC}"
ip -o link show | awk -F': ' '{print " - " $2}' | grep -v '^ - lo' | sort
echo
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter interface name (e.g. eth0): ')${CL}"
read -r iface
cmd="ethtool $iface"
;;
9) cmd="resolvectl status" ;;
10)
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter domain name: ')${CL}"
read -r domain
cmd="dig $domain"
;;
11) cmd="ss -tuln" ;;
12) cmd="iptables -L -n -v" ;;
13) cmd="nft list ruleset" ;;
14) cmd="pve-firewall status" ;;
15) cmd="pve-firewall compile" ;;
16) cmd="pve-firewall reload" ;;
0) break ;;
*) cmd="$user_input" ;;
esac
@ -284,6 +358,7 @@ show_network_commands() {
# ===============================================================
# 05 Updates and Packages Commands
# ===============================================================
@ -297,11 +372,16 @@ show_update_commands() {
echo -e " 3) ${GREEN}pveupdate${NC} - $(translate 'Update Proxmox package lists')"
echo -e " 4) ${GREEN}pveupgrade${NC} - $(translate 'Show available Proxmox upgrades')"
echo -e " 5) ${GREEN}apt autoremove --purge${NC} - $(translate 'Remove unused packages and their config')"
echo -e " ${DEF}0)$(translate ' Back to previous menu')${CL}"
echo -e " ${DEF}0) $(translate ' Back to previous menu or Esc + Enter')"
echo
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command.: ') ${CL}"
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command: ') ${CL}"
read -r user_input
# Check for Esc key press
if [[ "$user_input" == $'\x1b' ]]; then
break
fi
case "$user_input" in
1) cmd="apt update && apt upgrade -y" ;;
2) cmd="apt dist-upgrade -y" ;;
@ -336,11 +416,16 @@ show_gpu_commands() {
echo -e " 5) ${GREEN}update-initramfs -u${NC} - $(translate 'Apply initramfs changes (VFIO)')"
echo -e " 6) ${GREEN}cat /etc/default/grub${NC} - $(translate 'Review GRUB options for IOMMU')"
echo -e " 7) ${GREEN}update-grub${NC} - $(translate 'Apply GRUB changes')"
echo -e " ${DEF}0)$(translate ' Back to previous menu')${CL}"
echo -e " ${DEF}0) $(translate ' Back to previous menu or Esc + Enter')"
echo
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command.: ') ${CL}"
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command: ') ${CL}"
read -r user_input
# Check for Esc key press
if [[ "$user_input" == $'\x1b' ]]; then
break
fi
case "$user_input" in
1) cmd="lspci -nn | grep -i nvidia" ;;
2) cmd="lspci -nn | grep -i vga" ;;
@ -377,11 +462,24 @@ show_zfs_commands() {
echo -e " 4) ${GREEN}zpool scrub <pool>${NC} - $(translate 'Start scrub for a ZFS pool')"
echo -e " 5) ${GREEN}zfs create <pool>/dataset${NC} - $(translate 'Create a new dataset in a ZFS pool')"
echo -e " 6) ${GREEN}zfs destroy <pool>/dataset${NC} - $(translate 'Destroy a ZFS dataset (irreversible)')"
echo -e " ${DEF}0)$(translate ' Back to previous menu')${CL}"
echo -e " 7) ${GREEN}zpool import${NC} - $(translate 'List importable ZFS pools')"
echo -e " 8) ${GREEN}zpool import <pool>${NC} - $(translate 'Import a ZFS pool')"
echo -e " 9) ${GREEN}zpool export <pool>${NC} - $(translate 'Export a ZFS pool')"
echo -e "10) ${GREEN}zfs mount -a${NC} - $(translate 'Mount all datasets')"
echo -e "11) ${GREEN}zfs mount <pool/dataset>${NC} - $(translate 'Mount specific dataset')"
echo -e "12) ${GREEN}zpool status -v${NC} - $(translate 'Verbose pool status')"
echo -e "13) ${GREEN}zpool history${NC} - $(translate 'ZFS command history')"
echo -e "14) ${GREEN}zpool clear <pool>${NC} - $(translate 'Clear pool error state')"
echo -e " ${DEF}0) $(translate ' Back to previous menu or Esc + Enter')"
echo
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command.: ') ${CL}"
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command: ') ${CL}"
read -r user_input
# Detect ESC
if [[ "$user_input" == $'\x1b' ]]; then
break
fi
case "$user_input" in
1) cmd="zpool status" ;;
2) cmd="zpool list" ;;
@ -401,6 +499,30 @@ show_zfs_commands() {
read -r dataset
cmd="zfs destroy $dataset"
;;
7) cmd="zpool import" ;;
8)
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter pool name to import: ')${CL}"
read -r pool
cmd="zpool import $pool"
;;
9)
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter pool name to export: ')${CL}"
read -r pool
cmd="zpool export $pool"
;;
10) cmd="zfs mount -a" ;;
11)
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter pool/dataset to mount: ')${CL}"
read -r dataset
cmd="zfs mount $dataset"
;;
12) cmd="zpool status -v" ;;
13) cmd="zpool history" ;;
14)
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter pool name to clear errors: ')${CL}"
read -r pool
cmd="zpool clear $pool"
;;
0) break ;;
*) cmd="$user_input" ;;
esac
@ -415,6 +537,7 @@ show_zfs_commands() {
# ===============================================================
# 08 Backup and Restore Commands
# ===============================================================
@ -428,11 +551,21 @@ show_backup_commands() {
echo -e " 3) ${GREEN}vzdump --all${NC} - $(translate 'Backup all VMs and CTs')"
echo -e " 4) ${GREEN}qmrestore /path/backup.vma.zst <vmid>${NC} - $(translate 'Restore a VM from backup')"
echo -e " 5) ${GREEN}pct restore <vmid> /path/backup.tar.zst${NC} - $(translate 'Restore a CT from backup')"
echo -e " ${DEF}0)$(translate ' Back to previous menu')${CL}"
echo -e " 6) ${GREEN}ls /var/lib/vz/dump${NC} - $(translate 'List local backups')"
echo -e " 7) ${GREEN}pvesm list <storage>${NC} - $(translate 'List backups in a specific storage')"
echo -e " 8) ${GREEN}cat /etc/vzdump.conf${NC} - $(translate 'Show vzdump backup configuration')"
echo -e " 9) ${GREEN}zstd -d <backup>.zst${NC} - $(translate 'Decompress backup manually')"
echo -e "10) ${GREEN}vzdump --stdexcludes${NC} - $(translate 'Show standard exclude patterns')"
echo -e " ${DEF}0) $(translate ' Back to previous menu or Esc + Enter')"
echo
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command.: ') ${CL}"
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command: ') ${CL}"
read -r user_input
# Check for Esc key press
if [[ "$user_input" == $'\x1b' ]]; then
break
fi
case "$user_input" in
1)
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter VM/CT ID: ')${CL}"
@ -461,6 +594,19 @@ show_backup_commands() {
read -r id
cmd="pct restore $id $backup"
;;
6) cmd="ls /var/lib/vz/dump" ;;
7)
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter storage name: ')${CL}"
read -r storage
cmd="pvesm list $storage"
;;
8) cmd="cat /etc/vzdump.conf" ;;
9)
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter backup file (.zst): ')${CL}"
read -r file
cmd="zstd -d $file"
;;
10) cmd="vzdump --stdexcludes" ;;
0) break ;;
*) cmd="$user_input" ;;
esac
@ -475,6 +621,7 @@ show_backup_commands() {
# ===============================================================
# 09 System CLI Tools Commands
# ===============================================================
@ -494,11 +641,16 @@ show_tools_commands() {
echo -e " 9) ${GREEN}net-tools${NC} - $(translate 'Legacy network tools (e.g., ifconfig)')"
echo -e "10) ${GREEN}whois${NC} - $(translate 'Lookup domain registration info')"
echo -e "11) ${GREEN}libguestfs-tools${NC} - $(translate 'Manage and inspect VM disk images')"
echo -e " ${DEF}0)$(translate ' Back to previous menu')${CL}"
echo -e " ${DEF}0) $(translate ' Back to previous menu or Esc + Enter')"
echo
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command.: ') ${CL}"
echo -en "${TAB}${BOLD}${YW}${HOLD}$(translate 'Enter a number, or write or paste a command: ') ${CL}"
read -r user_input
# Check for Esc key press
if [[ "$user_input" == $'\x1b' ]]; then
break
fi
case "$user_input" in
1) cmd="htop" ;;
2) cmd="btop" ;;
@ -572,7 +724,7 @@ show_tools_commands() {
while true; do
OPTION=$(dialog --stdout \
--title "$(translate 'Help and Info')" \
--menu "$(translate 'Select a category of useful commands:')" 20 70 12 \
--menu "\n$(translate 'Select a category of useful commands:')" 20 70 9 \
1 "$(translate 'Useful System Commands')" \
2 "$(translate 'VM and CT Management Commands')" \
3 "$(translate 'Storage and Disks Commands')" \
@ -583,41 +735,28 @@ OPTION=$(dialog --stdout \
8 "$(translate 'Backup and Restore Commands')" \
9 "$(translate 'System CLI Tools')" \
0 "$(translate 'Exit')")
case $OPTION in
1)
show_system_commands
;;
2)
show_vm_ct_commands
;;
3)
show_storage_commands
;;
4)
show_network_commands
;;
5)
show_update_commands
;;
6)
show_gpu_commands
;;
7)
show_zfs_commands
;;
8)
show_backup_commands
;;
9)
show_tools_commands
;;
0) clear
break
;;
if [[ -z "$OPTION" ]]; then
clear
break
fi
case $OPTION in
1) show_system_commands ;;
2) show_vm_ct_commands ;;
3) show_storage_commands ;;
4) show_network_commands ;;
5) show_update_commands ;;
6) show_gpu_commands ;;
7) show_zfs_commands ;;
8) show_backup_commands ;;
9) show_tools_commands ;;
0) clear; break ;;
*)
msg_info2 "$(translate 'Invalid option, please try again.')"
read -r
;;
esac
done

View File

@ -6,11 +6,10 @@
# Author : MacRimi
# Copyright : (c) 2024 MacRimi
# License : MIT (https://raw.githubusercontent.com/MacRimi/ProxMenux/main/LICENSE)
# Version : 1.0
# Last Updated: 28/01/2025
# Version : 2.0
# Last Updated: 04/04/2025
# ==========================================================
# Configuration ============================================
REPO_URL="https://raw.githubusercontent.com/MacRimi/ProxMenux/main"
BASE_DIR="/usr/local/share/proxmenux"
@ -25,37 +24,52 @@ load_language
initialize_cache
# ==========================================================
show_menu() {
local TEMP_FILE
TEMP_FILE=$(mktemp)
while true; do
OPTION=$(whiptail --title "$(translate "Main ProxMenux")" --menu "$(translate "Select an option:")" 18 70 10 \
"1" "$(translate "Settings post-install Proxmox")" \
"2" "$(translate "Hardware: GPUs and Coral-TPU")" \
"3" "$(translate "Create VM from template or script")" \
"4" "$(translate "Disk and Storage Manager")" \
"5" "$(translate "Essential Proxmox VE Helper-Scripts")" \
"6" "$(translate "Network")" \
"7" "$(translate "Settings")" \
"8" "$(translate "Exit")" 3>&1 1>&2 2>&3)
while true; do
dialog --clear \
--backtitle "ProxMenux" \
--title "$(translate "Main ProxMenux")" \
--menu "$(translate "Select an option:")" 18 70 10 \
1 "$(translate "Settings post-install Proxmox")" \
2 "$(translate "Help and Info Commands")" \
3 "$(translate "Hardware: GPUs and Coral-TPU")" \
4 "$(translate "Create VM from template or script")" \
5 "$(translate "Disk and Storage Manager")" \
6 "$(translate "Essential Proxmox VE Helper-Scripts")" \
7 "$(translate "Network")" \
8 "$(translate "Settings")" \
9 "$(translate "Exit")" 2>"$TEMP_FILE"
local EXIT_STATUS=$?
if [[ $EXIT_STATUS -ne 0 ]]; then
# ESC pressed or Cancel
clear
msg_ok "$(translate "Thank you for using ProxMenu. Goodbye!")"
rm -f "$TEMP_FILE"
exit 0
fi
OPTION=$(<"$TEMP_FILE")
case $OPTION in
1) exec bash <(curl -s "$REPO_URL/scripts/menus/menu_post_install.sh") ;;
2) exec bash <(curl -s "$REPO_URL/scripts/menus/hw_grafics_menu.sh") ;;
3) exec bash <(curl -s "$REPO_URL/scripts/menus/create_vm_menu.sh") ;;
4) exec bash <(curl -s "$REPO_URL/scripts/menus/storage_menu.sh") ;;
5) exec bash <(curl -s "$REPO_URL/scripts/menus/menu_Helper_Scripts.sh") ;;
6) exec bash <(curl -s "$REPO_URL/scripts/repair_network.sh") ;;
7) exec bash <(curl -s "$REPO_URL/scripts/menus/config_menu.sh") ;;
8) clear; msg_ok "$(translate "Thank you for using ProxMenu. Goodbye!")"; exit 0 ;;
2) exec bash <(curl -s "$REPO_URL/scripts/help_info_menu.sh") ;;
3) exec bash <(curl -s "$REPO_URL/scripts/menus/hw_grafics_menu.sh") ;;
4) exec bash <(curl -s "$REPO_URL/scripts/menus/create_vm_menu.sh") ;;
5) exec bash <(curl -s "$REPO_URL/scripts/menus/storage_menu.sh") ;;
6) exec bash <(curl -s "$REPO_URL/scripts/menus/menu_Helper_Scripts.sh") ;;
7) exec bash <(curl -s "$REPO_URL/scripts/repair_network.sh") ;;
8) exec bash <(curl -s "$REPO_URL/scripts/menus/config_menu.sh") ;;
9) clear; msg_ok "$(translate "Thank you for using ProxMenu. Goodbye!")"; rm -f "$TEMP_FILE"; exit 0 ;;
*) msg_warn "$(translate "Invalid option")"; sleep 2 ;;
esac
done
done
}
show_proxmenux_logo
show_menu

View File

@ -1 +1 @@
1.1.1
1.1.2