44#
55# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
66# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
7- # Last Modified: 2026-Apr-05
7+ # Last Modified: 2026-Apr-06
88# ##################################################################
99set -u
1010
1111# # Set version for each Production Release ##
1212readonly SCRIPT_VERSION=1.6.1
13- readonly SCRIPT_VERSTAG=" 26040512 "
13+ readonly SCRIPT_VERSTAG=" 26040607 "
1414readonly SCRIPT_NAME=" MerlinAU"
1515# # Set to "master" for Production Releases ##
16- SCRIPT_BRANCH=" master "
16+ SCRIPT_BRANCH=" dev "
1717
1818# #----------------------------------------##
1919# # Modified by Martinski W. [2024-Jul-03] ##
@@ -3289,9 +3289,82 @@ _GetLatestFWUpdateVersionFromRouter_()
32893289 echo " $newVersionStr " ; return " $retCode "
32903290}
32913291
3292- # #------------------------------------------##
3293- # # Modified by ExtremeFiretop [2026-Jan-23] ##
3294- # #------------------------------------------##
3292+ # #-------------------------------------##
3293+ # # Added by Martinski W. [2026-Apr-06] ##
3294+ # #-------------------------------------##
3295+ _Check_PostReboot_FWUpdate_Setup_ ()
3296+ {
3297+ local fwInstalledVersion savedInstalledVersion savedNewUpdateVersion
3298+
3299+ if [ ! -s " $saveEMailInfoMsg " ]
3300+ then return 1
3301+ fi
3302+
3303+ if [ " $sendEMailNotificationsFlag " = " ENABLED" ] && \
3304+ _CheckEMailConfigFileFromAMTM_ 0 && \
3305+ grep -qE " $POST_UPDATE_EMAIL_SCRIPT_JOB " " $hookScriptFPath "
3306+ then return 0 # Email is ENABLED#
3307+ fi
3308+
3309+ fwInstalledVersion=" $( _GetCurrentFWInstalledLongVersion_) "
3310+ # -----------------------------------------------------------#
3311+ # Remove "_rog" or "_tuf" or -gHASHVALUES suffix to avoid
3312+ # version comparison failure. Keep 'Beta' & 'Alpha' tags.
3313+ # -----------------------------------------------------------#
3314+ fwInstalledVersion=" $( echo " $fwInstalledVersion " | sed -E ' s/(_(rog|tuf)|-g[0-9a-f]{10})$//' ) "
3315+
3316+ savedInstalledVersion=" $( grep " ^FW_InstalledVersion=" " $saveEMailInfoMsg " | awk -F ' =' ' {print $2}' ) "
3317+ savedNewUpdateVersion=" $( grep " ^FW_NewUpdateVersion=" " $saveEMailInfoMsg " | awk -F ' =' ' {print $2}' ) "
3318+ if [ -n " $savedInstalledVersion " ] && \
3319+ [ -n " $savedNewUpdateVersion " ] && \
3320+ [ " $savedNewUpdateVersion " = " $fwInstalledVersion " ]
3321+ then
3322+ Say " Flashing of new F/W Update version ${fwInstalledVersion} for the ${MODEL_ID} router was successful."
3323+ Update_Custom_Settings FW_New_Update_Notification_Vers TBD
3324+ Update_Custom_Settings FW_New_Update_Expected_Run_Date TBD
3325+ fi
3326+ rm -f " $saveEMailInfoMsg "
3327+
3328+ if [ " $( Get_Custom_Setting CheckChangeLog) " = " ENABLED" ]
3329+ then
3330+ Update_Custom_Settings " FW_New_Update_Changelog_Approval" " TBD"
3331+ fi
3332+ }
3333+
3334+ # #-------------------------------------##
3335+ # # Added by Martinski W. [2026-Apr-06] ##
3336+ # #-------------------------------------##
3337+ _Do_PostReboot_FWUpdate_Setup_ ()
3338+ {
3339+ local fwInstalledVersion fwNewUpdateVersion
3340+
3341+ if ! " $offlineUpdateTrigger "
3342+ then fwNewUpdateVersion=" $( _GetLatestFWUpdateVersionFromRouter_ 1) "
3343+ else fwNewUpdateVersion=" $( Get_Custom_Setting FW_New_Update_Notification_Vers) "
3344+ fi
3345+
3346+ fwInstalledVersion=" $( _GetCurrentFWInstalledLongVersion_) "
3347+ # -----------------------------------------------------------#
3348+ # Remove "_rog" or "_tuf" or -gHASHVALUES suffix to avoid
3349+ # version comparison failure. Keep 'Beta' & 'Alpha' tags.
3350+ # -----------------------------------------------------------#
3351+ fwInstalledVersion=" $( echo " $fwInstalledVersion " | sed -E ' s/(_(rog|tuf)|-g[0-9a-f]{10})$//' ) "
3352+
3353+ {
3354+ echo " FW_InstalledVersion=$fwInstalledVersion "
3355+ echo " FW_NewUpdateVersion=$fwNewUpdateVersion "
3356+ } > " $saveEMailInfoMsg "
3357+
3358+ if [ " $sendEMailNotificationsFlag " != " ENABLED" ] || \
3359+ ! _CheckEMailConfigFileFromAMTM_ 0
3360+ then return 1 # Email is DISABLED#
3361+ fi
3362+ _AddPostUpdateEmailNotifyScriptHook_
3363+ }
3364+
3365+ # #----------------------------------------##
3366+ # # Modified by Martinski W. [2026-Apr-06] ##
3367+ # #----------------------------------------##
32953368_CreateEMailContent_ ()
32963369{
32973370 if [ $# -eq 0 ] || [ -z " $1 " ] ; then return 1 ; fi
@@ -3313,15 +3386,18 @@ _CreateEMailContent_()
33133386 else subjectStr=" $subjectStrTag for $MODEL_ID "
33143387 fi
33153388
3316- fwInstalledVersion=" $( _GetCurrentFWInstalledLongVersion_) "
33173389 if ! " $offlineUpdateTrigger "
33183390 then
33193391 fwNewUpdateVersion=" $( _GetLatestFWUpdateVersionFromRouter_ 1) "
33203392 else
3321- fwNewUpdateVersion=" $( Get_Custom_Setting " FW_New_Update_Notification_Vers" ) "
3393+ fwNewUpdateVersion=" $( Get_Custom_Setting FW_New_Update_Notification_Vers) "
33223394 fi
33233395
3324- # Remove "_rog" or "_tuf" or -gHASHVALUES suffix to avoid version comparison failure, can't remove all for proper beta and alpha comparison #
3396+ fwInstalledVersion=" $( _GetCurrentFWInstalledLongVersion_) "
3397+ # -----------------------------------------------------------#
3398+ # Remove "_rog" or "_tuf" or -gHASHVALUES suffix to avoid
3399+ # version comparison failure. Keep 'Beta' & 'Alpha' tags.
3400+ # -----------------------------------------------------------#
33253401 fwInstalledVersion=" $( echo " $fwInstalledVersion " | sed -E ' s/(_(rog|tuf)|-g[0-9a-f]{10})$//' ) "
33263402
33273403 case " $1 " in
@@ -3487,16 +3563,8 @@ _CreateEMailContent_()
34873563 printf " \nThe F/W version that is currently installed:\n<b>${fwInstalledVersion} </b>\n"
34883564 } > " $tempEMailBodyMsg "
34893565 ;;
3490- POST_REBOOT_FW_UPDATE_SETUP)
3491- {
3492- echo " FW_InstalledVersion=$fwInstalledVersion "
3493- echo " FW_NewUpdateVersion=$fwNewUpdateVersion "
3494- } > " $saveEMailInfoMsg "
3495- _AddPostUpdateEmailNotifyScriptHook_
3496- return 0
3497- ;;
34983566 POST_REBOOT_FW_UPDATE_STATUS)
3499- if [ ! -f " $saveEMailInfoMsg " ]
3567+ if [ ! -s " $saveEMailInfoMsg " ]
35003568 then
35013569 Say " ${REDct} **ERROR**${NOct} : Unable to send post-update email notification [No saved info file]."
35023570 return 1
@@ -3506,10 +3574,13 @@ _CreateEMailContent_()
35063574 if [ -z " $savedInstalledVersion " ] || [ -z " $savedNewUpdateVersion " ]
35073575 then
35083576 Say " ${REDct} **ERROR**${NOct} : Unable to send post-update email notification [Saved info is empty]."
3577+ rm -f " $saveEMailInfoMsg "
35093578 return 1
35103579 fi
35113580 if [ " $savedNewUpdateVersion " = " $fwInstalledVersion " ]
35123581 then
3582+ Update_Custom_Settings FW_New_Update_Notification_Vers TBD
3583+ Update_Custom_Settings FW_New_Update_Expected_Run_Date TBD
35133584 emailBodyTitle=" Successful Firmware Update"
35143585 {
35153586 echo " Flashing of new F/W Update version <b>${fwInstalledVersion} </b> for the <b>${MODEL_ID} </b> router was successful."
@@ -3663,9 +3734,9 @@ _CheckEMailConfigFileFromAMTM_()
36633734 return 0
36643735}
36653736
3666- # #------------------------------------------ ##
3667- # # Modified by ExtremeFiretop [2024-Dec-21 ] ##
3668- # #------------------------------------------ ##
3737+ # #----------------------------------------##
3738+ # # Modified by Martinski W. [2026-Apr-06 ] ##
3739+ # #----------------------------------------##
36693740_SendEMailNotification_ ()
36703741{
36713742 if [ $# -eq 0 ] || [ -z " $1 " ] || \
@@ -3680,8 +3751,6 @@ _SendEMailNotification_()
36803751
36813752 ! _CreateEMailContent_ " $1 " && return 1
36823753
3683- [ " $1 " = " POST_REBOOT_FW_UPDATE_SETUP" ] && return 0
3684-
36853754 if " $isInteractive "
36863755 then
36873756 printf " \nSending email notification [$1 ]."
@@ -5381,7 +5450,7 @@ _GetLatestFWUpdateVersionFromGitHub_()
53815450 then
53825451 routerVersion=" $( _GetLatestFWUpdateVersionFromRouter_ 1) "
53835452 else
5384- routerVersion=" $( Get_Custom_Setting " FW_New_Update_Notification_Vers" ) "
5453+ routerVersion=" $( Get_Custom_Setting FW_New_Update_Notification_Vers) "
53855454 fi
53865455 if [ -z " $routerVersion " ]
53875456 then
@@ -5446,7 +5515,7 @@ GetLatestFirmwareMD5URL()
54465515 then
54475516 routerVersion=" $( _GetLatestFWUpdateVersionFromRouter_ 1) "
54485517 else
5449- routerVersion=" $( Get_Custom_Setting " FW_New_Update_Notification_Vers" ) "
5518+ routerVersion=" $( Get_Custom_Setting FW_New_Update_Notification_Vers) "
54505519 fi
54515520 if [ -z " $routerVersion " ]
54525521 then
@@ -5795,7 +5864,7 @@ _CheckFirmwareMD5_()
57955864# #----------------------------------------##
57965865_toggle_change_log_check_ ()
57975866{
5798- local currentSetting=" $( Get_Custom_Setting " CheckChangeLog" ) "
5867+ local currentSetting=" $( Get_Custom_Setting CheckChangeLog) "
57995868
58005869 if [ " $currentSetting " = " ENABLED" ]
58015870 then
@@ -7973,14 +8042,14 @@ _ChangelogVerificationCheck_()
79738042 local mode=" $1 " # Mode should be 'auto' or 'interactive' #
79748043 local current_version formatted_current_version
79758044 local release_version formatted_release_version
7976- local checkChangeLogSetting=" $( Get_Custom_Setting " CheckChangeLog" ) "
8045+ local checkChangeLogSetting=" $( Get_Custom_Setting CheckChangeLog) "
79778046 local changeLogFName changeLogFPath changeLogTag
79788047 local matchNum1 matchNum2 lineNum1 lineNum2
79798048
79808049 if [ " $checkChangeLogSetting " = " ENABLED" ]
79818050 then
79828051 current_version=" $( _GetCurrentFWInstalledLongVersion_) "
7983- release_version=" $( Get_Custom_Setting " FW_New_Update_Notification_Vers" ) "
8052+ release_version=" $( Get_Custom_Setting FW_New_Update_Notification_Vers) "
79848053
79858054 if " $isGNUtonFW "
79868055 then
@@ -8107,7 +8176,7 @@ _ManageChangelogMerlin_()
81078176 fi
81088177 fi
81098178
8110- release_version=" $( Get_Custom_Setting " FW_New_Update_Notification_Vers" ) "
8179+ release_version=" $( Get_Custom_Setting FW_New_Update_Notification_Vers) "
81118180 # force 3006 changelog if tag is NG but $release_version says 3006 #
81128181 if [ " $changeLogTag " = " NG" ] && \
81138182 echo " $release_version " | grep -qE " ^3006[.]"
@@ -9847,7 +9916,7 @@ Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or
98479916 # Remove cron jobs from 3rd-party Add-Ons #
98489917 _RemoveCronJobsFromAddOns_
98499918
9850- _SendEMailNotification_ POST_REBOOT_FW_UPDATE_SETUP
9919+ _Do_PostReboot_FWUpdate_Setup_
98519920 echo
98529921 Say " Flashing ${GRNct}${firmware_file}${NOct} ...\n${REDct} Please wait for reboot in about 4 minutes or less.${NOct} "
98539922 echo
@@ -9943,13 +10012,11 @@ Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or
994310012}
994410013
994510014# #----------------------------------------##
9946- # # Modified by ExtremeFiretop [2026-Apr-05 ] ##
10015+ # # Modified by Martinski W. [2026-Apr-06 ] ##
994710016# #----------------------------------------##
994810017_PostUpdateEmailNotification_ ()
994910018{
9950- _DelPostUpdateEmailNotifyScriptHook_
9951- currentChangelogValue=" $( Get_Custom_Setting CheckChangeLog) "
9952- if [ " $currentChangelogValue " = " ENABLED" ]
10019+ if [ " $( Get_Custom_Setting CheckChangeLog) " = " ENABLED" ]
995310020 then
995410021 Update_Custom_Settings " FW_New_Update_Changelog_Approval" " TBD"
995510022 fi
@@ -9985,7 +10052,8 @@ _PostUpdateEmailNotification_()
998510052 fi
998610053
998710054 Say " END of $logMsg [$curWaitDelaySecs sec.]"
9988- sleep 20 # # Let's wait a bit & proceed ##
10055+ sleep 25 # # Let's wait a bit & proceed ##
10056+ _DelPostUpdateEmailNotifyScriptHook_
998910057 _SendEMailNotification_ POST_REBOOT_FW_UPDATE_STATUS
999010058}
999110059
@@ -10204,6 +10272,7 @@ _DoStartupInit_()
1020410272 _InitCustomUserSettings_
1020510273 _CreateSymLinks_
1020610274 _InitHelperJSFile_
10275+ _Check_PostReboot_FWUpdate_Setup_
1020710276 _SetVersionSharedSettings_ local " $SCRIPT_VERSION "
1020810277
1020910278 if " $mountWebGUI_OK "
@@ -11238,7 +11307,7 @@ _ShowMainMenuOptions_()
1123811307 printf " \n ${GRNct} 4${NOct} . Set F/W Update Postponement Days"
1123911308 printf " \n${padStr} [Current Days: ${GRNct}${FW_UpdatePostponementDays}${NOct} ]\n"
1124011309
11241- local checkChangeLogSetting=" $( Get_Custom_Setting " CheckChangeLog" ) "
11310+ local checkChangeLogSetting=" $( Get_Custom_Setting CheckChangeLog) "
1124211311 if [ " $checkChangeLogSetting " = " DISABLED" ]
1124311312 then
1124411313 printf " \n ${GRNct} 5${NOct} . Toggle F/W Changelog Check"
0 commit comments