diff --git a/CHANGELOG.md b/CHANGELOG.md index fb5a584..c94b907 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v3.0.11 +Updated on 2026-Feb-18 +* NEW: Added code to support automatic add-on updates from AMTM. + ## v3.0.10 Updated on 2025-Dec-21 * FIXED: Bug fix in a CLI shell script function to get the full value of notification parameters from the configuration file. diff --git a/README.md b/README.md index 6c06ef3..8d1ee44 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # connmon -## v3.0.10 -### Updated on 2025-Dec-21 +## v3.0.11 +### Updated on 2026-Feb-18 ## About connmon is an internet connection monitoring tool for AsusWRT Merlin with charts for daily, weekly and monthly summaries. diff --git a/connmon.sh b/connmon.sh index 96aefd5..07ad7e5 100644 --- a/connmon.sh +++ b/connmon.sh @@ -11,7 +11,7 @@ ## Forked from https://github.com/jackyaz/connmon ## ## ## ############################################################## -# Last Modified: 2025-Dec-16 +# Last Modified: 2026-Feb-18 #------------------------------------------------------------- ############## Shellcheck directives ############# @@ -36,9 +36,9 @@ ### Start of script variables ### readonly SCRIPT_NAME="connmon" -readonly SCRIPT_VERSION="v3.0.10" -readonly SCRIPT_VERSTAG="25121620" -SCRIPT_BRANCH="master" +readonly SCRIPT_VERSION="v3.0.11" +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_WEBPAGE_DIR="$(readlink -f /www/user)" @@ -75,6 +75,9 @@ readonly curlOutLogFile="/tmp/var/tmp/temp_${SCRIPT_NAME}_curl_OUT.LOG" readonly curlErrLogFile="/tmp/var/tmp/temp_${SCRIPT_NAME}_curl_ERR.LOG" readonly tmpCurlSEPstr="-------------------------------------------------------" +# To support automatic script updates from AMTM # +doScriptUpdateFromAMTM=true + # For daily CRON job to trim database # readonly defTrimDB_Hour=3 readonly defTrimDB_Mins=3 @@ -300,7 +303,8 @@ Update_Version() Print_Output true "New version of $SCRIPT_NAME available - $serverver" "$PASS" changelog="$(curl -fsL --retry 4 --retry-delay 5 "$SCRIPT_REPO/CHANGELOG.md" | sed -n "/$serverver"'/,/##/p' | head -n -1 | sed 's/## //')" printf "${BOLD}${UNDERLINE}Changelog\\n${CLEARFORMAT}%s\\n\\n" "$changelog" - elif [ "$isupdate" = "md5" ]; then + elif [ "$isupdate" = "md5" ] + then Print_Output true "MD5 hash of $SCRIPT_NAME does not match - hotfix available - $serverver" "$PASS" fi @@ -365,6 +369,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-Feb-09] ## ##----------------------------------------## @@ -6352,7 +6373,7 @@ then fi ##----------------------------------------## -## Modified by Martinski W. [2025-Dec-11] ## +## Modified by Martinski W. [2026-Feb-18] ## ##----------------------------------------## case "$1" in install) @@ -6579,6 +6600,11 @@ case "$1" in Update_Version force exit 0 ;; + amtmupdate) + shift + ScriptUpdateFromAMTM "$@" + exit "$?" + ;; postupdate) Create_Dirs Conf_Exists