ProxMenux/menu

91 lines
2.8 KiB
Plaintext
Raw Normal View History

2024-12-20 19:03:49 +01:00
#!/bin/bash
2025-02-02 22:59:06 +01:00
# ==========================================================
# ProxMenu - A menu-driven script for Proxmox VE management
# ==========================================================
# Author : MacRimi
# Copyright : (c) 2024 MacRimi
# License : MIT (https://raw.githubusercontent.com/MacRimi/ProxMenux/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.
#
# - Displays the ProxMenu logo on startup.
# - 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:
# - Ensures ProxMenu is always up-to-date by fetching the latest version.
# - 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.
# ==========================================================
2025-07-04 19:40:38 +02:00
2025-02-02 22:59:06 +01:00
# Configuration ============================================
2024-12-20 19:03:49 +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-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
source "$UTILS_FILE"
fi
2024-12-20 19:03:49 +01:00
2025-07-04 19:40:38 +02:00
# =========================================================
2025-01-12 17:24:04 +01:00
2025-01-09 21:06:51 +01:00
check_updates() {
2025-07-04 19:40:38 +02:00
local INSTALL_SCRIPT="$BASE_DIR/install_proxmenux.sh"
2025-02-02 22:59:06 +01:00
local REMOTE_VERSION
REMOTE_VERSION=$(curl -fsSL "$REPO_URL/version.txt" | head -n 1)
2025-07-04 19:40:38 +02:00
2025-02-02 22:59:06 +01:00
2025-01-12 17:06:16 +01:00
if [ -z "$REMOTE_VERSION" ]; then
2025-02-02 22:59:06 +01:00
return 0
2025-01-12 17:06:16 +01:00
fi
2025-07-04 19:40:38 +02:00
2025-01-12 17:06:16 +01:00
2025-02-02 22:59:06 +01:00
local LOCAL_VERSION
LOCAL_VERSION=$(head -n 1 "$LOCAL_VERSION_FILE")
2025-07-04 19:40:38 +02:00
2025-01-12 16:26:53 +01:00
2025-02-02 22:59:06 +01:00
[ "$LOCAL_VERSION" = "$REMOTE_VERSION" ] && return 0
2025-07-04 19:40:38 +02:00
2024-12-20 19:03:49 +01:00
2025-02-02 22:59:06 +01:00
if whiptail --title "$(translate "Update Available")" \
--yesno "$(translate "New version available") ($REMOTE_VERSION)\n\n$(translate "Do you want to update now?")" \
10 60 --defaultno; then
msg_warn "$(translate "Starting ProxMenu update...")"
2025-01-12 15:30:17 +01:00
2025-02-02 22:59:06 +01:00
if wget -qO "$INSTALL_SCRIPT" "$REPO_URL/install_proxmenux.sh"; then
chmod +x "$INSTALL_SCRIPT"
2025-01-12 16:19:46 +01:00
2025-02-02 22:59:06 +01:00
source "$INSTALL_SCRIPT"
fi
else
msg_warn "$(translate "Update postponed. You can update later from the menu.")"
fi
2025-01-12 18:10:37 +01:00
}
2025-02-02 22:59:06 +01:00
main_menu() {
exec bash <(curl -fsSL "$REPO_URL/scripts/menus/main_menu.sh")
2024-12-20 20:26:52 +01:00
}
2025-01-09 21:06:51 +01:00
2025-01-09 21:50:31 +01:00
load_language
2025-02-02 22:59:06 +01:00
initialize_cache
2025-01-09 21:06:51 +01:00
check_updates
2025-02-02 22:59:06 +01:00
main_menu