From 1f5c4261733881ea36a181d7ca4a92b0b3070fa0 Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Wed, 18 Feb 2026 00:36:44 -0800 Subject: [PATCH] New Functionality Initial code to support automatic script updates via AMTM. --- README.md | 4 ++-- YazDHCP.sh | 37 +++++++++++++++++++++++++++++++------ 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index cf1abe2..79c2178 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # YazDHCP -## v1.2.4 +## v1.2.5 -### Updated on 2025-Nov-20 +### Updated on 2026-Feb-18 ## About diff --git a/YazDHCP.sh b/YazDHCP.sh index 7aae4af..cd2da0d 100644 --- a/YazDHCP.sh +++ b/YazDHCP.sh @@ -13,7 +13,7 @@ ## Forked from https://github.com/jackyaz/YazDHCP ## ## ## ########################################################## -# Last Modified: 2025-Nov-20 +# Last Modified: 2026-Feb-18 #--------------------------------------------------------- ############################################# @@ -29,9 +29,9 @@ ### Start of script variables ### readonly SCRIPT_NAME="YazDHCP" -readonly SCRIPT_VERSION="v1.2.4" -readonly SCRIPT_VERSTAG="25112022" -SCRIPT_BRANCH="master" +readonly SCRIPT_VERSION="v1.2.5" +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" readonly SCRIPT_CONF="$SCRIPT_DIR/DHCP_clients" @@ -74,6 +74,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 + # Give higher priority to built-in binaries # export PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH" @@ -964,6 +967,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-Sep-05] ## ##----------------------------------------## @@ -4891,7 +4911,7 @@ else SCRIPT_VERS_INFO="[$versionDev_TAG]" fi ##----------------------------------------## -## Modified by Martinski W. [2025-Sep-05] ## +## Modified by Martinski W. [2026-Feb-18] ## ##----------------------------------------## if [ $# -eq 0 ] || [ -z "$1" ] then @@ -5014,11 +5034,16 @@ case "$1" in Update_Version force unattended exit 0 ;; + amtmupdate) + shift + ScriptUpdateFromAMTM "$@" + exit "$?" + ;; setversion) Set_Version_Custom_Settings local Set_Version_Custom_Settings server "$SCRIPT_VERSION" if [ $# -lt 2 ] || [ -z "$2" ] - then + then exec "$0" fi exit 0