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 VERSION_URL="$REPO_URL/version.txt"
local INSTALL_URL="$REPO_URL/install_proxmenux.sh" local INSTALL_URL="$REPO_URL/install_proxmenux.sh"
local CURL_OPTS=( local CURL_OPTS=(
-fsSL -fsSL
--connect-timeout 3 --connect-timeout 3
--max-time 5 --max-time 5
) )
local REMOTE_VERSION local REMOTE_VERSION
REMOTE_VERSION="$(curl "${CURL_OPTS[@]}" "$VERSION_URL" 2>/dev/null | head -n 1 || true)" REMOTE_VERSION="$(curl "${CURL_OPTS[@]}" "$VERSION_URL" 2>/dev/null | head -n 1 || true)"
if [ -z "$REMOTE_VERSION" ]; then if [ -z "$REMOTE_VERSION" ]; then
return 0 return 0
fi fi
local LOCAL_VERSION="" local LOCAL_VERSION=""
if [ -f "$LOCAL_VERSION_FILE" ]; then if [ -f "$LOCAL_VERSION_FILE" ]; then
LOCAL_VERSION="$(head -n 1 "$LOCAL_VERSION_FILE" 2>/dev/null || true)" LOCAL_VERSION="$(head -n 1 "$LOCAL_VERSION_FILE" 2>/dev/null || true)"
fi fi
[ "$LOCAL_VERSION" = "$REMOTE_VERSION" ] && return 0 [ "$LOCAL_VERSION" = "$REMOTE_VERSION" ] && return 0
if whiptail --title "$(translate 'Update Available')" \
if whiptail --title "$(translate "Update Available")" \ --yesno "$(translate 'New version available') ($REMOTE_VERSION)\n\n$(translate 'Do you want to update now?')" \
--yesno "$(translate "New version available") ($REMOTE_VERSION)\n\n$(translate "Do you want to update now?")" \
10 60 --defaultno; then 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 if curl "${CURL_OPTS[@]}" "$INSTALL_URL" -o "$INSTALL_SCRIPT"; then
chmod +x "$INSTALL_SCRIPT" chmod +x "$INSTALL_SCRIPT"
# Aquí sigues usando source, como tenías
source "$INSTALL_SCRIPT" source "$INSTALL_SCRIPT"
else 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 fi
else 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 fi
} }