From f0bcdc1c2543ac7c21be92e4f6f375e902b21a8a Mon Sep 17 00:00:00 2001 From: cod378 Date: Wed, 12 Nov 2025 04:22:11 +0000 Subject: [PATCH] refactor: move utils.sh loading to script initialization because this is an installer dependency --- install_proxmenux.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/install_proxmenux.sh b/install_proxmenux.sh index 64f8b1b..ab2b2b2 100755 --- a/install_proxmenux.sh +++ b/install_proxmenux.sh @@ -40,6 +40,7 @@ BASE_DIR="/usr/local/share/proxmenux" CONFIG_FILE="$BASE_DIR/config.json" CACHE_FILE="$BASE_DIR/cache.json" UTILS_FILE="$BASE_DIR/utils.sh" +UTILS_URL="https://github.com/MacRimi/ProxMenux/raw/refs/heads/main/scripts/utils.sh" LOCAL_VERSION_FILE="$BASE_DIR/version.txt" MENU_SCRIPT="menu" VENV_PATH="/opt/googletrans-env" @@ -54,6 +55,15 @@ MONITOR_PORT=8008 REPO_URL="https://github.com/c78-contrib/ProxMenuxOffline.git" TEMP_DIR="/tmp/proxmenux-install-$$" +# Load utils.sh from local repository +if [[ -f "$UTILS_URL" ]]; then + source "$UTILS_URL" +else + msg_error "Failed to load utils dependencies. Please report this issue." + exit 1 +fi + + cleanup_corrupted_files() { if [ -f "$CONFIG_FILE" ] && ! jq empty "$CONFIG_FILE" >/dev/null 2>&1; then echo "Cleaning up corrupted configuration file..." @@ -481,14 +491,6 @@ install_normal_version() { # Change to temporary directory cd "$TEMP_DIR" - # Load utils.sh from local repository - if [[ -f "./scripts/utils.sh" ]]; then - source "./scripts/utils.sh" - else - msg_error "Failed to load utils.sh from local repository. Please report this issue." - exit 1 - fi - # -------------------------------------------------------------------------------------- ((current_step++))