44#
55# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
66# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
7- # Last Modified: 2024-Nov-16
7+ # Last Modified: 2024-Nov-17
88# ##################################################################
99set -u
1010
@@ -311,7 +311,7 @@ then #Special Case#
311311fi
312312
313313# #----------------------------------------##
314- # # Modified by Martinski W. [2024-Nov-15 ] ##
314+ # # Modified by Martinski W. [2024-Nov-17 ] ##
315315# #----------------------------------------##
316316_AcquireLock_ ()
317317{
@@ -351,7 +351,7 @@ _AcquireLock_()
351351 break
352352 elif [ " $waitTimeoutSecs " -le " $LockWaitTimeoutSecs " ]
353353 then
354- if [ " $waitTimeoutSecs " -eq 0 ] || [ " $ (( waitTimeoutSecs % 10 )) " -eq 0 ]
354+ if [ " $(( waitTimeoutSecs % 10 )) " -eq 0 ]
355355 then
356356 Say " Lock Found [Age: $ageOfLockSecs secs.] Waiting for script [PID=$oldPID ] to exit [Timer: $waitTimeoutSecs secs.]"
357357 fi
@@ -5340,18 +5340,19 @@ _GetOfflineFirmwareVersion_()
53405340 local zip_file=" $1 "
53415341 local extract_version_regex=' [0-9]+_[0-9]+\.[0-9]+_[0-9a-zA-Z]+'
53425342 local validate_version_regex=' [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(_[0-9a-zA-Z]+)?'
5343- local fwVersionFormat
5344- local firmware_version
5345- local formatted_version
5343+ local fwVersionFormat firmware_version formatted_version
53465344
53475345 # Extract the version number using regex #
53485346 firmware_version=" $( echo " $zip_file " | grep -oE " $extract_version_regex " ) "
53495347
5350- if [ -n " $firmware_version " ]; then
5351- if echo " $firmware_version " | grep -qE ' ^([0-9]+)_([0-9]+)\.([0-9]+)_([0-9]+)$' ; then
5348+ if [ -n " $firmware_version " ]
5349+ then
5350+ if echo " $firmware_version " | grep -qE ' ^([0-9]+)_([0-9]+)\.([0-9]+)_([0-9]+)$'
5351+ then
53525352 # Numeric patch version
53535353 formatted_version=" $( echo " $firmware_version " | sed -E ' s/^([0-9]+)_([0-9]+)\.([0-9]+)_([0-9]+)/\1.\2.\3.\4/' ) "
5354- elif echo " $firmware_version " | grep -qE ' ^([0-9]+)_([0-9]+)\.([0-9]+)_([0-9a-zA-Z]+)$' ; then
5354+ elif echo " $firmware_version " | grep -qE ' ^([0-9]+)_([0-9]+)\.([0-9]+)_([0-9a-zA-Z]+)$'
5355+ then
53555356 # Alphanumeric suffix
53565357 formatted_version=" $( echo " $firmware_version " | sed -E ' s/^([0-9]+)_([0-9]+)\.([0-9]+)_([0-9a-zA-Z]+)/\1.\2.\3.0_\4/' ) "
53575358 else
@@ -5370,7 +5371,8 @@ _GetOfflineFirmwareVersion_()
53705371 fi
53715372 fi
53725373
5373- if [ -z " $firmware_version " ]; then
5374+ if [ -z " $firmware_version " ]
5375+ then
53745376 fwVersionFormat=" ${BLUEct} BASE${WHITEct} .${CYANct} MAJOR${WHITEct} .${MAGENTAct} MINOR${WHITEct} .${YLWct} PATCH${NOct} "
53755377 # Prompt user for the firmware version if extraction fails #
53765378 printf " \n${REDct} **WARNING**${NOct} \n"
@@ -6402,9 +6404,9 @@ Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or
64026404 " $inMenuMode " && _WaitForEnterKey_ " $theMenuReturnPromptMsg "
64036405}
64046406
6405- # #------------------------------------------ ##
6406- # # Modified by ExtremeFiretop [2024-Nov-16 ] ##
6407- # #------------------------------------------ ##
6407+ # #----------------------------------------##
6408+ # # Modified by Martinski W. [2024-Nov-17 ] ##
6409+ # #----------------------------------------##
64086410_PostUpdateEmailNotification_ ()
64096411{
64106412 _DelPostUpdateEmailNotifyScriptHook_
@@ -6414,7 +6416,7 @@ _PostUpdateEmailNotification_()
64146416 local maxWaitDelaySecs=600 # 10 minutes#
64156417 local curWaitDelaySecs=0
64166418 local logMsg=" Post-Reboot Update Email Notification Wait Timeout"
6417- _UserTraceLog_ " START of $logMsg .. ."
6419+ Say " START of ${ logMsg} ."
64186420
64196421 # --------------------------------------------------------------
64206422 # Wait until all services are started, including WAN & NTP
@@ -6427,7 +6429,10 @@ _PostUpdateEmailNotification_()
64276429 [ " $( nvram get success_start_service) " -eq 1 ]
64286430 then break ; fi
64296431
6430- echo " Waiting for all services to be started and for WAN connection [$theWaitDelaySecs secs.]..."
6432+ if [ " $curWaitDelaySecs " -gt 0 ] && \
6433+ [ " $(( curWaitDelaySecs % 60 )) " -eq 0 ]
6434+ then Say " $logMsg [$curWaitDelaySecs secs.]..." ; fi
6435+
64316436 sleep $theWaitDelaySecs
64326437 curWaitDelaySecs=" $(( curWaitDelaySecs + theWaitDelaySecs)) "
64336438 done
@@ -6437,13 +6442,13 @@ _PostUpdateEmailNotification_()
64376442 else Say " $logMsg [$maxWaitDelaySecs sec.] expired."
64386443 fi
64396444
6440- _UserTraceLog_ " END of $logMsg [$$ curWaitDelaySecs sec.]"
6445+ Say " END of $logMsg [$$ curWaitDelaySecs sec.]"
64416446 sleep 20 # # Let's wait a bit & proceed ##
64426447 _SendEMailNotification_ POST_REBOOT_FW_UPDATE_STATUS
64436448}
64446449
64456450# #----------------------------------------##
6446- # # Modified by Martinski W. [2024-Nov-16 ] ##
6451+ # # Modified by Martinski W. [2024-Nov-17 ] ##
64476452# #----------------------------------------##
64486453_PostRebootRunNow_ ()
64496454{
@@ -6453,7 +6458,7 @@ _PostRebootRunNow_()
64536458 local maxWaitDelaySecs=600 # 10 minutes#
64546459 local curWaitDelaySecs=0
64556460 local logMsg=" Post-Reboot F/W Update Run Wait Timeout"
6456- _UserTraceLog_ " START of $logMsg .. ."
6461+ Say " START of ${ logMsg} ."
64576462
64586463 # --------------------------------------------------------------
64596464 # Wait until all services are started, including WAN & NTP
@@ -6462,14 +6467,16 @@ _PostRebootRunNow_()
64626467 # --------------------------------------------------------------
64636468 while [ " $curWaitDelaySecs " -lt " $maxWaitDelaySecs " ]
64646469 do
6465- if _WAN_IsConnected_ && \
6466- [ -d " $FW_ZIP_BASE_DIR " ] && \
6470+ if [ -d " $FW_ZIP_BASE_DIR " ] && \
64676471 [ " $( nvram get ntp_ready) " -eq 1 ] && \
64686472 [ " $( nvram get start_service_ready) " -eq 1 ] && \
64696473 [ " $( nvram get success_start_service) " -eq 1 ]
64706474 then break ; fi
64716475
6472- echo " Waiting for all services to be started and for WAN connection [$theWaitDelaySecs secs.]..."
6476+ if [ " $curWaitDelaySecs " -gt 0 ] && \
6477+ [ " $(( curWaitDelaySecs % 60 )) " -eq 0 ]
6478+ then Say " $logMsg [$curWaitDelaySecs secs.]..." ; fi
6479+
64736480 sleep $theWaitDelaySecs
64746481 curWaitDelaySecs=" $(( curWaitDelaySecs + theWaitDelaySecs)) "
64756482 done
@@ -6479,7 +6486,7 @@ _PostRebootRunNow_()
64796486 else Say " $logMsg [$maxWaitDelaySecs sec.] expired."
64806487 fi
64816488
6482- _UserTraceLog_ " END of $logMsg [$$ curWaitDelaySecs sec.]"
6489+ Say " END of $logMsg [$$ curWaitDelaySecs sec.]"
64836490 sleep 30 # # Let's wait a bit & proceed ##
64846491 _RunFirmwareUpdateNow_
64856492}
0 commit comments