Update menu

This commit is contained in:
MacRimi
2025-11-16 00:13:52 +01:00
parent 5edc27297f
commit 7913b673a3

26
menu
View File

@@ -62,16 +62,18 @@ check_updates() {
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
local TITLE MESSAGE local TITLE MESSAGE
@@ -82,16 +84,32 @@ check_updates() {
--yesno "$MESSAGE" \ --yesno "$MESSAGE" \
10 60 --defaultno; then 10 60 --defaultno; then
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"
source "$INSTALL_SCRIPT"
if ! bash -n "$INSTALL_SCRIPT" >/tmp/proxmenux-install-syntax.log 2>&1; then
return 0
fi fi
if bash "$INSTALL_SCRIPT" --update >/tmp/proxmenux-install.log 2>&1; then
exec "$0"
else
msg_error "$(translate 'Installer finished with errors. See log:') /tmp/proxmenux-install.log"
return 0
fi
else
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.')"
fi fi
} }
main_menu() { main_menu() {
local MAIN_MENU="$LOCAL_SCRIPTS/menus/main_menu.sh" local MAIN_MENU="$LOCAL_SCRIPTS/menus/main_menu.sh"