44#
55# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
66# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
7- # Last Modified: 2026-Jan-02
7+ # Last Modified: 2026-Jan-24
88# ##################################################################
99set -u
1010
1111# # Set version for each Production Release ##
1212readonly SCRIPT_VERSION=1.5.9
13- readonly SCRIPT_VERSTAG=" 26012310 "
13+ readonly SCRIPT_VERSTAG=" 26012404 "
1414readonly SCRIPT_NAME=" MerlinAU"
1515# # Set to "master" for Production Releases ##
1616SCRIPT_BRANCH=" dev"
@@ -198,12 +198,13 @@ readonly fwInstalledInnerVers="$(nvram get innerver)"
198198readonly fwInstalledBranchVer=" ${fwInstalledBaseVers} .$( echo " $fwInstalledBuildVers " | awk -F' .' ' {print $1}' ) "
199199
200200# #------------------------------------------##
201- # # Modified by ExtremeFiretop [2025 -Jan-23] ##
201+ # # Modified by ExtremeFiretop [2026 -Jan-23] ##
202202# #------------------------------------------##
203- # For minimum supported firmware version check #
204- # TO NOTE: Due to Gnuton being behind RMerlin #
205- # Only lock out firmware versions that are 5 #
206- # builds behind the current production #
203+ # For minimum supported firmware version check.
204+ # *NOTE*: Due to Gnuton F/W being behind RMerlin
205+ # F/W releases, remove support for F/W versions
206+ # that are 5 builds behind the latest production.
207+ # ------------------------------------------------#
207208MinFirmwareVerCheckFailed=false
208209NewMinSupportedFirmwareVers=" TBD"
209210readonly MinSupportedFW_3004_386_Ver=" 3004.386.13.2"
@@ -2810,13 +2811,13 @@ _DownloadScriptFiles_()
28102811}
28112812
28122813# #---------------------------------------##
2813- # # Added by ExtremeFiretop [2025 -Jan-23] ##
2814+ # # Added by ExtremeFiretop [2026 -Jan-23] ##
28142815# #---------------------------------------##
28152816_GetRemoteMinSupportedFirmwareVers_ ()
28162817{
2817- # Echoes the minimum supported FW version ( string) for the
2818- # currently-installed FW branch (e.g. 3004.388), based on the
2819- # *REMOTE* script content. Returns 0 on success.
2818+ # Returns the minimum supported F/W version string for the #
2819+ # currently-installed F/W branch (e.g. 3004.388), based on #
2820+ # the *REMOTE* script content. Returns code 0 on success. #
28202821 local tmpScript srceScriptUrl current_version branchVer branchKey
28212822 local varName minVers defaultVar
28222823
@@ -2860,24 +2861,25 @@ _GetRemoteMinSupportedFirmwareVers_()
28602861}
28612862
28622863# #---------------------------------------##
2863- # # Added by ExtremeFiretop [2025 -Jan-23] ##
2864+ # # Added by ExtremeFiretop [2026 -Jan-23] ##
28642865# #---------------------------------------##
28652866_CheckNewScriptMinFWBeforeUpdate_ ()
28662867{
2867- # Returns 0 if OK (or unknown), 1 if the NEW script requires newer FW.
2868- # Sets global NewMinSupportedFirmwareVers when known.
2868+ # Returns 0 if OK (or unknown), 1 if the NEW script requires newer FW. #
2869+ # Sets global NewMinSupportedFirmwareVers when known. #
28692870 local current_version numOfFields numCurrentVers numNewMinVers
28702871 local newMinVers
28712872
2872- # If already known, reuse it (do not re-download / re-parse remote script)
2873- if [ -n " $NewMinSupportedFirmwareVers " ] && [ " $NewMinSupportedFirmwareVers " != " TBD" ]
2873+ # If already known, reuse it (do not re-download / re-parse remote script) #
2874+ if [ -n " $NewMinSupportedFirmwareVers " ] && \
2875+ [ " $NewMinSupportedFirmwareVers " != " TBD" ]
28742876 then
28752877 newMinVers=" $NewMinSupportedFirmwareVers "
28762878 else
28772879 newMinVers=" $( _GetRemoteMinSupportedFirmwareVers_) " || return 0
28782880 [ -n " $newMinVers " ] || return 0
28792881
2880- # Cache for future calls
2882+ # Cache for future calls #
28812883 NewMinSupportedFirmwareVers=" $newMinVers "
28822884 fi
28832885
@@ -2892,10 +2894,12 @@ _CheckNewScriptMinFWBeforeUpdate_()
28922894}
28932895
28942896# #-------------------------------------------##
2895- # # Modified by ExtremeFiretop [2025 -Jan-23] ##
2897+ # # Modified by ExtremeFiretop [2026 -Jan-23] ##
28962898# #-------------------------------------------##
28972899_SCRIPT_UPDATE_ ()
28982900{
2901+ local current_version
2902+
28992903 ScriptUpdateDeclined=false
29002904 if [ $# -gt 0 ] && [ " $1 " = " force" ]
29012905 then
@@ -2906,25 +2910,23 @@ _SCRIPT_UPDATE_()
29062910 current_version=" $( _GetCurrentFWInstalledLongVersion_) "
29072911 if ! _CheckNewScriptMinFWBeforeUpdate_
29082912 then
2909- _WriteVarDefToHelperJSFile_ " MinimumScriptFWRequired " " $NewMinSupportedFirmwareVers "
2913+ _WriteVarDefToHelperJSFile_ " minimumScriptFWRequired " " $NewMinSupportedFirmwareVers "
29102914 printf " \n${CRITct} *WARNING*:${NOct} MerlinAU v${DLRepoVersion} "
2911- printf " requires newer router firmware.\n"
2912- printf " \nCurrent F/W version found: ${REDct} %s${NOct} " \
2913- " $current_version "
2914- printf " \nMinimum version required: ${GRNct} %s${NOct} \n" \
2915- " $NewMinSupportedFirmwareVers "
2916- printf " \n${BOLDct} Recommendation:${NOct} Update router firmware first.\n"
2915+ printf " requires a newer router firmware version.\n"
2916+ printf " \nCurrent F/W version found: ${REDct} %s${NOct} " " $current_version "
2917+ printf " \nMinimum version supported: ${GRNct} %s${NOct} \n" " $NewMinSupportedFirmwareVers "
2918+ printf " \n${BOLDct} RECOMMENDATION:${NOct} \nUpdate the router firmware first before updating the MerlinAU script.\n"
29172919 if " $isInteractive "
29182920 then
2919- printf " \n${BOLDct} Continue downloading anyway?${NOct} "
2921+ printf " \n${BOLDct} Continue to download and update the script anyway?${NOct} "
29202922 if ! _WaitForYESorNO_
29212923 then
29222924 ScriptUpdateDeclined=true
29232925 printf " \n${GRNct} Update cancelled.${NOct} \n"
29242926 return 1
29252927 fi
29262928 else
2927- # Non-interactive (auto-update): do NOT brick the script.
2929+ # Non-interactive (auto-update): do NOT brick the script #
29282930 _SendEMailNotification_ FAILED_SCRIPT_UPDATE_MIN_FW_STATUS
29292931 return 1
29302932 fi
@@ -2971,19 +2973,18 @@ _SCRIPT_UPDATE_()
29712973 printf " ${CYANct} Update Version Available Now: ${YLWct}${DLRepoVersion}${NOct} \n\n"
29722974
29732975 if " $mountWebGUI_OK "
2974- then _SetVersionSharedSettings_ server " $DLRepoVersion " ; fi
2976+ then _SetVersionSharedSettings_ server " $DLRepoVersion "
2977+ fi
29752978
29762979 current_version=" $( _GetCurrentFWInstalledLongVersion_) "
29772980 if ! _CheckNewScriptMinFWBeforeUpdate_
29782981 then
2979- _WriteVarDefToHelperJSFile_ " MinimumScriptFWRequired" " $NewMinSupportedFirmwareVers "
2980- printf " \n${CRITct} *WARNING*:${NOct} Updating to MerlinAU v${DLRepoVersion} "
2981- printf " requires newer router firmware.\n"
2982- printf " \nCurrent F/W version found: ${REDct} %s${NOct} " \
2983- " $current_version "
2984- printf " \nMinimum version required: ${GRNct} %s${NOct} \n" \
2985- " $NewMinSupportedFirmwareVers "
2986- printf " \n${BOLDct} Recommendation:${NOct} Update router firmware first.\n"
2982+ _WriteVarDefToHelperJSFile_ " minimumScriptFWRequired" " $NewMinSupportedFirmwareVers "
2983+ printf " \n${CRITct} *WARNING*:${NOct} MerlinAU v${DLRepoVersion} "
2984+ printf " requires a newer router firmware version.\n"
2985+ printf " \nCurrent F/W version found: ${REDct} %s${NOct} " " $current_version "
2986+ printf " \nMinimum version supported: ${GRNct} %s${NOct} \n" " $NewMinSupportedFirmwareVers "
2987+ printf " \n${BOLDct} RECOMMENDATION:${NOct} \nUpdate the router firmware first before updating the MerlinAU script.\n\n"
29872988 fi
29882989
29892990 if [ " $SCRIPT_VERSION " = " $DLRepoVersion " ] && \
@@ -3097,9 +3098,9 @@ _CheckForNewScriptUpdates_()
30973098 then
30983099 if ! _CheckNewScriptMinFWBeforeUpdate_
30993100 then
3100- _WriteVarDefToHelperJSFile_ " MinimumScriptFWRequired " " $NewMinSupportedFirmwareVers "
3101+ _WriteVarDefToHelperJSFile_ " minimumScriptFWRequired " " $NewMinSupportedFirmwareVers "
31013102 else
3102- _WriteVarDefToHelperJSFile_ " MinimumScriptFWRequired " " TBD"
3103+ _WriteVarDefToHelperJSFile_ " minimumScriptFWRequired " " TBD"
31033104 fi
31043105 scriptUpdateNotify=" New script update available.
31053106${REDct} v${SCRIPT_VERSION}${NOct} --> ${GRNct} v${DLRepoVersion}${NOct} "
@@ -3114,7 +3115,7 @@ ${REDct}v${SCRIPT_VERSION}${NOct} --> ${GRNct}v${DLRepoVersion}${NOct}"
31143115 fi
31153116 else
31163117 scriptUpdateNotify=0
3117- _WriteVarDefToHelperJSFile_ " MinimumScriptFWRequired " " TBD"
3118+ _WriteVarDefToHelperJSFile_ " minimumScriptFWRequired " " TBD"
31183119 _WriteVarDefToHelperJSFile_ " isScriptUpdateAvailable" " TBD"
31193120 fi
31203121 return 0
@@ -3142,7 +3143,7 @@ _GetLatestFWUpdateVersionFromRouter_()
31423143}
31433144
31443145# #------------------------------------------##
3145- # # Modified by ExtremeFiretop [2025 -Jan-23] ##
3146+ # # Modified by ExtremeFiretop [2026 -Jan-23] ##
31463147# #------------------------------------------##
31473148_CreateEMailContent_ ()
31483149{
@@ -3243,8 +3244,8 @@ _CreateEMailContent_()
32433244 } > " $tempEMailBodyMsg "
32443245 ;;
32453246 FAILED_SCRIPT_UPDATE_MIN_FW_STATUS)
3246- # best-effort: use already-known minimum requirement if available,
3247- # otherwise attempt to compute it again from remote script
3247+ # Use already-known minimum version requirement if available; #
3248+ # otherwise, attempt to compute it again from remote script #
32483249 minFwRequired=" $NewMinSupportedFirmwareVers "
32493250 if [ -z " $minFwRequired " ]
32503251 then
@@ -3255,11 +3256,11 @@ _CreateEMailContent_()
32553256 emailBodyTitle=" MerlinAU Script Update Blocked (Unsupported Firmware)"
32563257 {
32573258 echo " MerlinAU did NOT install the new Script Update version <b>${DLRepoVersion} </b> on your <b>${MODEL_ID} </b> router."
3258- echo " Reason: Your router firmware is below the minimum supported firmware required by this MerlinAU update."
3259- printf " \nCurrent router firmware version:\n<b>${fwInstalledVersion} </b>\n"
3260- printf " \nMinimum firmware required for MerlinAU v${DLRepoVersion} :\n<b>${minFwRequired} </b>\n"
3259+ echo " Reason: Your router firmware is below the minimum firmware version supported by the new MerlinAU update."
3260+ printf " \nCurrent router firmware version installed :\n<b>${fwInstalledVersion} </b>\n"
3261+ printf " \nMinimum firmware version supported by MerlinAU v${DLRepoVersion} :\n<b>${minFwRequired} </b>\n"
32613262 printf " \nThe installed script version remains: <b>${SCRIPT_VERSION} </b>\n"
3262- printf " \nRecommendation: Update your router firmware first, then retry the MerlinAU update .\n"
3263+ printf " \nRECOMMENDATION:\nUpdate the router firmware first, then try again to update the MerlinAU script .\n"
32633264 } > " $tempEMailBodyMsg "
32643265 ;;
32653266 FAILED_SCRIPT_UPDATE_STATUS)
@@ -10018,7 +10019,7 @@ _CheckForMinimumRequirements_()
1001810019 requirementsCheckOK=false
1001910020 Say " \n${CRITct} *WARNING*:${NOct} The current firmware version is below the minimum supported by this script."
1002010021 printf " \nCurrent F/W version found: ${REDct}${FW_InstalledVersion}${NOct} "
10021- printf " \nMinimum version required : ${GRNct}${MinSupportedFirmwareVers}${NOct} \n"
10022+ printf " \nMinimum version supported : ${GRNct}${MinSupportedFirmwareVers}${NOct} \n"
1002210023 fi
1002310024
1002410025 jffsScriptOK=" $( nvram get jffs2_scripts) "
0 commit comments