Files
ProxMenux/menu

105 lines
3.1 KiB
Plaintext
Raw Normal View History

2024-12-20 19:03:49 +01:00
#!/bin/bash
2025-02-02 22:59:06 +01:00
# ==========================================================
2025-09-10 18:47:55 +02:00
# ProxMenux - A menu-driven script for Proxmox VE management
2025-02-02 22:59:06 +01:00
# ==========================================================
# Author : MacRimi
# Copyright : (c) 2024 MacRimi
2025-11-01 00:10:46 +01:00
# License : (CC BY-NC 4.0) (https://github.com/MacRimi/ProxMenux/blob/main/LICENSE)
2025-07-04 19:40:38 +02:00
# Version : 1.1
# Last Updated: 04/07/2025
2025-02-02 22:59:06 +01:00
# ==========================================================
# Description:
# This script serves as the main entry point for ProxMenux,
# a menu-driven tool designed for Proxmox VE management.
2025-09-10 18:47:55 +02:00
# - Displays the ProxMenux logo on startup.
2025-02-02 22:59:06 +01:00
# - Loads necessary configurations and language settings.
# - Checks for available updates and installs them if confirmed.
# - Downloads and executes the latest main menu script.
#
# Key Features:
2025-09-10 18:47:55 +02:00
# - Ensures ProxMenux is always up-to-date by fetching the latest version.
2025-02-02 22:59:06 +01:00
# - Uses whiptail for interactive menus and language selection.
# - Loads utility functions and translation support.
# - Maintains a cache system to improve performance.
# - Executes the ProxMenux main menu dynamically from the repository.
#
# This script ensures a streamlined and automated experience
# for managing Proxmox VE using ProxMenux.
# ==========================================================
# Configuration ============================================
2025-11-14 20:38:07 +01:00
REPO_URL="https://raw.githubusercontent.com/MacRimi/ProxMenux/main"
2024-12-20 21:44:51 +01:00
BASE_DIR="/usr/local/share/proxmenux"
2025-11-15 23:58:26 +01:00
LOCAL_SCRIPTS="$BASE_DIR/scripts"
2025-02-02 22:59:06 +01:00
CONFIG_FILE="$BASE_DIR/config.json"
CACHE_FILE="$BASE_DIR/cache.json"
UTILS_FILE="$BASE_DIR/utils.sh"
2024-12-20 21:44:51 +01:00
LOCAL_VERSION_FILE="$BASE_DIR/version.txt"
2025-02-02 22:59:06 +01:00
VENV_PATH="/opt/googletrans-env"
2024-12-20 20:41:25 +01:00
2025-02-02 22:59:06 +01:00
if [[ -f "$UTILS_FILE" ]]; then
2025-11-16 01:04:16 +01:00
2025-02-02 22:59:06 +01:00
source "$UTILS_FILE"
fi
2025-11-15 23:58:26 +01:00
: "${LOCAL_SCRIPTS:=/usr/local/share/proxmenux/scripts}"
2024-12-20 19:03:49 +01:00
# =========================================================
2025-11-14 20:38:07 +01:00
2025-01-09 21:06:51 +01:00
check_updates() {
2025-11-16 00:23:14 +01:00
local VERSION_URL INSTALL_URL INSTALL_SCRIPT
local REMOTE_VERSION LOCAL_VERSION
2025-11-14 21:30:58 +01:00
2025-11-16 00:23:14 +01:00
VERSION_URL="$REPO_URL/version.txt"
INSTALL_URL="$REPO_URL/install_proxmenux.sh"
INSTALL_SCRIPT="$BASE_DIR/install_proxmenux.sh"
2025-11-14 21:30:58 +01:00
2025-11-16 01:04:16 +01:00
2025-11-16 00:23:14 +01:00
[[ ! -f "$LOCAL_VERSION_FILE" ]] && return 0
2025-11-16 00:13:52 +01:00
2025-11-16 00:23:14 +01:00
REMOTE_VERSION="$(curl -fsSL "$VERSION_URL" 2>/dev/null | head -n 1)"
[[ -z "$REMOTE_VERSION" ]] && return 0
2025-01-12 17:06:16 +01:00
2025-11-16 01:04:16 +01:00
2025-11-16 00:23:14 +01:00
LOCAL_VERSION="$(head -n 1 "$LOCAL_VERSION_FILE" 2>/dev/null)"
[[ -z "$LOCAL_VERSION" ]] && return 0
2025-11-15 23:58:26 +01:00
2025-11-16 01:07:25 +01:00
2025-11-16 00:23:14 +01:00
[[ "$LOCAL_VERSION" = "$REMOTE_VERSION" ]] && return 0
2025-11-16 01:04:16 +01:00
2025-11-16 00:23:14 +01:00
if whiptail --title "$(translate 'Update Available')" \
--yesno "$(translate 'New version available') ($REMOTE_VERSION)\n\n$(translate 'Do you want to update now?')" \
2025-02-02 22:59:06 +01:00
10 60 --defaultno; then
2025-11-14 21:30:58 +01:00
2025-11-16 00:23:14 +01:00
msg_warn "$(translate 'Starting ProxMenux update...')"
2025-11-16 00:17:22 +01:00
2025-11-16 01:07:25 +01:00
2025-11-16 00:51:12 +01:00
if curl -fsSL "$INSTALL_URL" -o "$INSTALL_SCRIPT"; then
chmod +x "$INSTALL_SCRIPT"
2025-11-16 00:02:52 +01:00
2025-11-16 01:04:16 +01:00
2025-11-16 01:07:25 +01:00
"$INSTALL_SCRIPT" --update
2025-11-16 01:17:54 +01:00
"$LOCAL_SCRIPTS/menus/main_menu.sh"
2025-11-16 00:13:52 +01:00
fi
2025-11-16 00:33:26 +01:00
2025-02-02 22:59:06 +01:00
fi
2025-01-12 18:10:37 +01:00
}
2025-11-16 00:02:52 +01:00
2025-11-16 00:13:52 +01:00
2025-11-16 01:04:16 +01:00
2025-11-16 01:07:25 +01:00
2025-02-02 22:59:06 +01:00
main_menu() {
2025-11-15 23:58:26 +01:00
local MAIN_MENU="$LOCAL_SCRIPTS/menus/main_menu.sh"
exec bash "$MAIN_MENU"
2024-12-20 20:26:52 +01:00
}
2025-01-09 21:50:31 +01:00
load_language
2025-02-02 22:59:06 +01:00
initialize_cache
2025-11-14 20:38:07 +01:00
check_updates
2025-11-14 20:48:38 +01:00
main_menu