From a4f5cc5ce8c0fe2b2adc52aa1b74556b9fd60220 Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Wed, 18 Feb 2026 00:39:16 -0800 Subject: [PATCH] New Functionality Initial code to support automatic script updates via AMTM. --- README.md | 4 ++-- YazFi.sh | 43 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0c31722..f056848 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # YazFi - enhanced AsusWRT-Merlin Guest WiFi Networks -## v4.4.9 -### Updated on 2025-Nov-08 +## v4.4.10 +### Updated on 2026-Feb-18 ## About Feature expansion of guest WiFi networks on AsusWRT-Merlin, including, but not limited to: diff --git a/YazFi.sh b/YazFi.sh index 19ada98..d91f71d 100644 --- a/YazFi.sh +++ b/YazFi.sh @@ -17,7 +17,7 @@ ## Guest Network DHCP script and for ## ## AsusWRT-Merlin firmware ## ################################################### -# Last Modified: 2025-Nov-04 +# Last Modified: 2026-Feb-18 #-------------------------------------------------- ###### Shellcheck directives ###### @@ -41,9 +41,9 @@ ### Start of script variables ### readonly SCRIPT_NAME="YazFi" readonly SCRIPT_CONF="/jffs/addons/$SCRIPT_NAME.d/config" -readonly YAZFI_VERSION="v4.4.9" -readonly SCRIPT_VERSION="v4.4.9" -readonly SCRIPT_VERSTAG="25110423" +readonly YAZFI_VERSION="v4.4.10" +readonly SCRIPT_VERSION="v4.4.10" +readonly SCRIPT_VERSTAG="26021800" SCRIPT_BRANCH="develop" SCRIPT_REPO="https://raw.githubusercontent.com/AMTM-OSR/$SCRIPT_NAME/$SCRIPT_BRANCH" readonly SCRIPT_DIR="/jffs/addons/$SCRIPT_NAME.d" @@ -94,6 +94,9 @@ readonly branchxStr_TAG="[Branch: $SCRIPT_BRANCH]" readonly versionDev_TAG="${SCRIPT_VERSION}_${SCRIPT_VERSTAG}" readonly versionMod_TAG="$SCRIPT_VERSION on $ROUTER_MODEL" +# To support automatic script updates from AMTM # +doScriptUpdateFromAMTM=true + ##-------------------------------------## ## Added by Martinski W. [2025-Mar-16] ## ##-------------------------------------## @@ -884,9 +887,11 @@ Update_Version() localver="$(echo "$updatecheckresult" | cut -f2 -d',')" serverver="$(echo "$updatecheckresult" | cut -f3 -d',')" - if [ "$isupdate" = "version" ]; then + if [ "$isupdate" = "version" ] + then Print_Output true "New version of $SCRIPT_NAME available - $serverver" "$PASS" - elif [ "$isupdate" = "md5" ]; then + elif [ "$isupdate" = "md5" ] + then Print_Output true "MD5 hash of $SCRIPT_NAME does not match - hotfix available - $serverver" "$PASS" fi @@ -973,6 +978,23 @@ Update_Version() fi } +##-------------------------------------## +## Added by Martinski W. [2026-Feb-18] ## +##-------------------------------------## +ScriptUpdateFromAMTM() +{ + if ! "$doScriptUpdateFromAMTM" + then + printf "Automatic script updates via AMTM are currently disabled.\n\n" + return 1 + fi + if [ $# -gt 0 ] && [ "$1" = "check" ] + then return 0 + fi + Update_Version force unattended + return "$?" +} + ##----------------------------------------## ## Modified by Martinski W. [2025-Mar-16] ## ##----------------------------------------## @@ -4002,7 +4024,7 @@ then fi ##----------------------------------------## -## Modified by Martinski W. [2025-Jun-18] ## +## Modified by Martinski W. [2026-Feb-18] ## ##----------------------------------------## case "$1" in install) @@ -4180,13 +4202,18 @@ case "$1" in exit 0 ;; update) - Update_Version unattended + Update_Version exit 0 ;; forceupdate) Update_Version force unattended exit 0 ;; + amtmupdate) + shift + ScriptUpdateFromAMTM "$@" + exit "$?" + ;; setversion) Set_Version_Custom_Settings local "$SCRIPT_VERSION" Set_Version_Custom_Settings server "$SCRIPT_VERSION"