From c03ae662bf4a94ef793df3aac2a4c1bdbe824edc Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Wed, 18 Feb 2026 01:02:22 -0800 Subject: [PATCH] New Functionality Initial code to support automatic script updates via AMTM. --- README.md | 4 ++-- ntpmerlin.sh | 33 +++++++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 647bd24..e2789a7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # ntpMerlin -## v3.4.13 -### Updated on 2025-Dec-21 +## v3.4.14 +### Updated on 2026-Feb-18 ## About ntpMerlin implements an NTP time server for AsusWRT Merlin with charts for daily, weekly and monthly summaries of performance. A choice between ntpd and chrony is available. diff --git a/ntpmerlin.sh b/ntpmerlin.sh index 9a3de9a..8f0b7bb 100644 --- a/ntpmerlin.sh +++ b/ntpmerlin.sh @@ -14,7 +14,7 @@ ## Forked from https://github.com/jackyaz/ntpMerlin ## ## ## ############################################################## -# Last Modified: 2025-Dec-21 +# Last Modified: 2026-Feb-18 #------------------------------------------------------------- ############### Shellcheck directives ############# @@ -36,8 +36,8 @@ ### Start of script variables ### readonly SCRIPT_NAME="ntpMerlin" readonly SCRIPT_NAME_LOWER="$(echo "$SCRIPT_NAME" | tr 'A-Z' 'a-z' | sed 's/d//')" -readonly SCRIPT_VERSION="v3.4.13" -readonly SCRIPT_VERSTAG="25122100" +readonly SCRIPT_VERSION="v3.4.14" +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_LOWER.d" @@ -66,6 +66,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 + # For daily CRON job to trim database # readonly defTrimDB_Hour=3 readonly defTrimDB_Mins=7 @@ -365,6 +368,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-Jul-30] ## ##----------------------------------------## @@ -3434,7 +3454,7 @@ then fi ##----------------------------------------## -## Modified by Martinski W. [2025-Jul-30] ## +## Modified by Martinski W. [2026-Feb-18] ## ##----------------------------------------## case "$1" in install) @@ -3513,6 +3533,11 @@ case "$1" in Update_Version force exit 0 ;; + amtmupdate) + shift + ScriptUpdateFromAMTM "$@" + exit "$?" + ;; postupdate) Create_Dirs Conf_Exists