Update menu

This commit is contained in:
MacRimi
2025-11-14 21:37:55 +01:00
parent acdb0d2838
commit 232e872c0d

19
menu
View File

@@ -49,48 +49,41 @@ check_updates() {
local VERSION_URL="$REPO_URL/version.txt"
local INSTALL_URL="$REPO_URL/install_proxmenux.sh"
local CURL_OPTS=(
-fsSL
--connect-timeout 3
--max-time 5
)
local REMOTE_VERSION
REMOTE_VERSION="$(curl "${CURL_OPTS[@]}" "$VERSION_URL" 2>/dev/null | head -n 1 || true)"
if [ -z "$REMOTE_VERSION" ]; then
return 0
fi
local LOCAL_VERSION=""
if [ -f "$LOCAL_VERSION_FILE" ]; then
LOCAL_VERSION="$(head -n 1 "$LOCAL_VERSION_FILE" 2>/dev/null || true)"
fi
[ "$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?")" \
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...")"
msg_warn "$(translate 'Starting ProxMenux update...')"
if curl "${CURL_OPTS[@]}" "$INSTALL_URL" -o "$INSTALL_SCRIPT"; then
chmod +x "$INSTALL_SCRIPT"
# Aquí sigues usando source, como tenías
source "$INSTALL_SCRIPT"
else
msg_warn "$(translate "Unable to download the installer. Please try again later.")"
msg_warn "$(translate 'Unable to download the installer. Please try again later.')"
fi
else
msg_warn "$(translate "Update postponed. You can update later from the menu.")"
msg_warn "$(translate 'Update postponed. You can update later from the menu.')"
fi
}