mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-11-17 19:16:25 +00:00
- Changed script loading from remote URL to local directory path for offline usage - Updated REPO_URL to LOCAL_SCRIPTS path (/usr/local/share/proxmenux/scripts) - Disabled check_updates function since it's not applicable for local version - Added comments explaining update functionality will be handled via .deb package in future
96 lines
3.0 KiB
Bash
96 lines
3.0 KiB
Bash
#!/bin/bash
|
|
|
|
# ==========================================================
|
|
# ProxMenux - A menu-driven script for Proxmox VE management
|
|
# ==========================================================
|
|
# Author : MacRimi
|
|
# Copyright : (c) 2024 MacRimi
|
|
# License : (CC BY-NC 4.0) (https://github.com/MacRimi/ProxMenux/blob/main/LICENSE)
|
|
# Version : 1.1
|
|
# Last Updated: 04/07/2025
|
|
# ==========================================================
|
|
# Description:
|
|
# This script serves as the main entry point for ProxMenux,
|
|
# a menu-driven tool designed for Proxmox VE management.
|
|
#
|
|
# - Displays the ProxMenux 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 ProxMenux 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.
|
|
# ==========================================================
|
|
|
|
|
|
# Configuration ============================================
|
|
LOCAL_SCRIPTS="/usr/local/share/proxmenux/scripts"
|
|
BASE_DIR="/usr/local/share/proxmenux"
|
|
CONFIG_FILE="$BASE_DIR/config.json"
|
|
CACHE_FILE="$BASE_DIR/cache.json"
|
|
UTILS_FILE="$BASE_DIR/utils.sh"
|
|
LOCAL_VERSION_FILE="$BASE_DIR/version.txt"
|
|
VENV_PATH="/opt/googletrans-env"
|
|
|
|
if [[ -f "$UTILS_FILE" ]]; then
|
|
source "$UTILS_FILE"
|
|
fi
|
|
|
|
# =========================================================
|
|
# For now, update is not available in the local version.
|
|
# Take in mind that in future versions, updates must be
|
|
# a warning to update the .deb package
|
|
# =========================================================
|
|
check_updates() {
|
|
local INSTALL_SCRIPT="$BASE_DIR/install_proxmenux.sh"
|
|
|
|
local REMOTE_VERSION
|
|
REMOTE_VERSION=$(curl -fsSL "$REPO_URL/version.txt" | head -n 1)
|
|
|
|
|
|
if [ -z "$REMOTE_VERSION" ]; then
|
|
return 0
|
|
fi
|
|
|
|
|
|
local LOCAL_VERSION
|
|
LOCAL_VERSION=$(head -n 1 "$LOCAL_VERSION_FILE")
|
|
|
|
|
|
[ "$LOCAL_VERSION" = "$REMOTE_VERSION" ] && return 0
|
|
|
|
|
|
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 ProxMenux update...")"
|
|
|
|
if wget -qO "$INSTALL_SCRIPT" "$REPO_URL/install_proxmenux.sh"; then
|
|
chmod +x "$INSTALL_SCRIPT"
|
|
|
|
source "$INSTALL_SCRIPT"
|
|
fi
|
|
else
|
|
msg_warn "$(translate "Update postponed. You can update later from the menu.")"
|
|
fi
|
|
}
|
|
|
|
|
|
main_menu() {
|
|
exec bash "$LOCAL_SCRIPTS/menus/main_menu.sh"
|
|
}
|
|
|
|
|
|
load_language
|
|
initialize_cache
|
|
# Check updates doesn't make sense in offline mode
|
|
# check_updates
|
|
main_menu
|