mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-11-18 19:46:18 +00:00
Update menu
This commit is contained in:
19
menu
19
menu
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user