44#
55# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
66# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
7- # Last Modified: 2025-Feb-12
7+ # Last Modified: 2025-Feb-15
88# ##################################################################
99set -u
1010
@@ -284,15 +284,16 @@ _UserLogMsg_()
284284}
285285
286286# #----------------------------------------##
287- # # Modified by Martinski W. [2025-Jan-05 ] ##
287+ # # Modified by Martinski W. [2025-Feb-15 ] ##
288288# #----------------------------------------##
289289Say ()
290290{
291+ local logMsg
291292 " $isInteractive " && printf " ${1} \n"
292293 # Remove all "color escape sequences" from the system log file entries #
293- local logMsg=" $( echo " $1 " | sed ' s/\\\e\[[0-1]m//g ; s/\\\e\[[0-1];[3-4][0-9]m//g' ) "
294+ logMsg=" $( echo " $1 " | sed ' s/\\\e\[[0-1]m//g ; s/\\\e\[[0-1];[3-4][0-9]m//g' ) "
294295 _UserLogMsg_ " $logMsg "
295- printf " $logMsg " | logger -t " [$( basename " $0 " ) ] $$ "
296+ printf " $logMsg " | logger -t " [${SCRIPT_NAME} ] $$ "
296297}
297298
298299# #----------------------------------------------##
@@ -1573,7 +1574,7 @@ _Set_FW_UpdateZIP_DirectoryPath_()
15731574}
15741575
15751576# #----------------------------------------##
1576- # # Modified by Martinski W. [2025-Jan-05 ] ##
1577+ # # Modified by Martinski W. [2025-Feb-15 ] ##
15771578# #----------------------------------------##
15781579# # Function to migrate specific settings from old values to new standardized values.
15791580# # This function is meant to be only TEMPORARY.
@@ -1601,7 +1602,7 @@ _Migrate_Settings_()
16011602 then
16021603 if Update_Custom_Settings ROGBuild " $New_ROGBuild_Value "
16031604 then
1604- Say " ROGBuild setting successfully migrated to '$New_ROGBuild_Value '."
1605+ Say " ROGBuild setting was successfully migrated to '$New_ROGBuild_Value '."
16051606 else
16061607 Say " Error occurred while migrating ROGBuild setting to '$New_ROGBuild_Value '."
16071608 fi
@@ -1625,7 +1626,7 @@ _Migrate_Settings_()
16251626 then
16261627 if Update_Custom_Settings TUFBuild " $New_TUFBuild_Value "
16271628 then
1628- Say " TUFBuild setting successfully migrated to '$New_TUFBuild_Value '."
1629+ Say " TUFBuild setting was successfully migrated to '$New_TUFBuild_Value '."
16291630 else
16301631 Say " Error occurred while migrating TUFBuild setting to '$New_TUFBuild_Value '."
16311632 fi
@@ -1647,11 +1648,12 @@ _Migrate_Settings_()
16471648 esac
16481649 if [ -n " $New_EMailNotif_Value " ]
16491650 then
1651+ sed -i ' /^FW_New_Update_EMail_Notification .*/d' " $CONFIG_FILE "
16501652 sed -i " s/^FW_New_Update_EMail_Notification=.*/FW_New_Update_EMail_Notification $New_EMailNotif_Value /" " $CONFIG_FILE "
16511653 if [ $? -eq 0 ]
16521654 then
16531655 sendEMailNotificationsFlag=" $New_EMailNotif_Value "
1654- Say " EMail_Notification setting successfully migrated to $New_EMailNotif_Value ."
1656+ Say " EMail_Notification setting was successfully migrated to $New_EMailNotif_Value ."
16551657 else
16561658 Say " Error occurred while migrating EMail_Notification setting to $New_EMailNotif_Value ."
16571659 fi
@@ -2428,33 +2430,33 @@ _DownloadScriptFiles_()
24282430}
24292431
24302432# #----------------------------------------##
2431- # # Modified by Martinski W. [2025-Jan-11 ] ##
2433+ # # Modified by Martinski W. [2025-Feb-15 ] ##
24322434# #----------------------------------------##
24332435_SCRIPT_UPDATE_ ()
24342436{
2435- local urlScriptVers theScriptVers extraParam=" "
2437+ local extraParam=" "
24362438
24372439 if [ $# -gt 0 ] && [ " $1 " = " force" ]
24382440 then
24392441 printf " \n${CYANct} Force downloading latest script version...${NOct} \n"
2440- theScriptVers=" $SCRIPT_VERSION "
2441- [ -s " $SCRIPT_VERPATH " ] && theScriptVers=" $( cat " $SCRIPT_VERPATH " ) "
2442- urlScriptVers=" $( /usr/sbin/curl -LSs --retry 4 --retry-delay 5 " ${SCRIPT_URL_REPO} /version.txt" ) "
2443- printf " ${CYANct} Downloading latest version ($urlScriptVers ) of ${SCRIPT_NAME}${NOct} \n"
2442+ if ! _CheckForNewScriptUpdates_ -quietcheck
2443+ then
2444+ DLRepoVersion=" $( /usr/sbin/curl -LSs --retry 4 --retry-delay 5 " ${SCRIPT_URL_REPO} /version.txt" ) "
2445+ fi
2446+ if _CheckForNewGUIVersionUpdate_ " $SCRIPT_VERSION " " $DLRepoVersion "
2447+ then extraParam=" install"
2448+ fi
2449+ printf " ${CYANct} Downloading latest version [$DLRepoVersion ] of ${SCRIPT_NAME}${NOct} \n"
24442450
24452451 if _DownloadScriptFiles_ update
24462452 then
24472453 printf " ${CYANct} $SCRIPT_NAME files were successfully updated.${NOct} \n\n"
2448- [ -s " $SCRIPT_VERPATH " ] && urlScriptVers=" $( cat " $SCRIPT_VERPATH " ) "
24492454 if " $inRouterSWmode "
24502455 then
2451- _SetVersionSharedSettings_ local " $urlScriptVers "
2452- _SetVersionSharedSettings_ server " $urlScriptVers "
2456+ _SetVersionSharedSettings_ local " $DLRepoVersion "
2457+ _SetVersionSharedSettings_ server " $DLRepoVersion "
24532458 fi
24542459 sleep 1
2455- if [ $# -gt 1 ] && [ " $2 " = " newgui" ] && \
2456- _CheckForNewGUIVersionUpdate_ " $theScriptVers " " $urlScriptVers "
2457- then extraParam=" install" ; fi
24582460 _ReleaseLock_
24592461 exec " $ScriptFilePath " $extraParam
24602462 exit 0
@@ -2527,12 +2529,10 @@ _SCRIPT_UPDATE_()
25272529}
25282530
25292531# #----------------------------------------##
2530- # # Modified by Martinski W. [2025-Jan-11 ] ##
2532+ # # Modified by Martinski W. [2025-Feb-15 ] ##
25312533# #----------------------------------------##
25322534_CheckForNewScriptUpdates_ ()
25332535{
2534- local extraParam=" "
2535-
25362536 echo
25372537 DLRepoVersion=" $SCRIPT_VERSION "
25382538 [ -s " $SCRIPT_VERPATH " ] && DLRepoVersion=" $( cat " $SCRIPT_VERPATH " ) "
@@ -2560,11 +2560,14 @@ _CheckForNewScriptUpdates_()
25602560 then
25612561 scriptUpdateNotify=" New script update available.
25622562${REDct} v${SCRIPT_VERSION}${NOct} --> ${GRNct} v${DLRepoVersion}${NOct} "
2563+
2564+ if [ $# -gt 0 ] && [ " $1 " = " -quietcheck" ]
2565+ then return 0
2566+ fi
25632567 Say " $myLAN_HostName - A new script version update (v$DLRepoVersion ) is available to download."
25642568 if [ " $ScriptAutoUpdateSetting " = " ENABLED" ]
25652569 then
2566- _CheckForNewGUIVersionUpdate_ && extraParam=" newgui"
2567- _SCRIPT_UPDATE_ force $extraParam
2570+ _SCRIPT_UPDATE_ force
25682571 fi
25692572 else
25702573 scriptUpdateNotify=0
@@ -7822,7 +7825,7 @@ _RunBackupmon_()
78227825}
78237826
78247827# #----------------------------------------##
7825- # # Modified by Martinski W. [2025-Jan-05 ] ##
7828+ # # Modified by Martinski W. [2025-Feb-15 ] ##
78267829# #----------------------------------------##
78277830_RunOfflineUpdateNow_ ()
78287831{
@@ -7947,7 +7950,7 @@ _RunOfflineUpdateNow_()
79477950 fi
79487951 _ClearOfflineUpdateState_
79497952 else
7950- Say " ${REDct} **ERROR**${NOct} : No firmware release URL was found for [$PRODUCT_ID ] router model."
7953+ Say " ${REDct} **ERROR**${NOct} : No firmware release URL was found for [$MODEL_ID ] router model."
79517954 _ClearOfflineUpdateState_ 1
79527955 return 1
79537956 fi
@@ -7962,7 +7965,7 @@ _RunOfflineUpdateNow_()
79627965}
79637966
79647967# #----------------------------------------##
7965- # # Modified by Martinski W. [2025-Jan -15] ##
7968+ # # Modified by Martinski W. [2025-Feb -15] ##
79667969# #----------------------------------------##
79677970_RunFirmwareUpdateNow_ ()
79687971{
@@ -8081,7 +8084,7 @@ Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or
80818084 if ! release_version=" $( _GetLatestFWUpdateVersionFromRouter_) " || \
80828085 ! _CheckNewUpdateFirmwareNotification_ " $current_version " " $release_version "
80838086 then
8084- Say " No new firmware version update is found for [$PRODUCT_ID ] router model."
8087+ Say " No new firmware version update is found for [$MODEL_ID ] router model."
80858088 " $inMenuMode " && _WaitForEnterKey_ " $mainMenuReturnPromptStr "
80868089 return 1
80878090 fi
@@ -8106,7 +8109,7 @@ Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or
81068109 release_version=" $1 "
81078110 release_link=" $2 "
81088111 else
8109- Say " ${REDct} **ERROR**${NOct} : No firmware release URL was found for [$PRODUCT_ID ] router model."
8112+ Say " ${REDct} **ERROR**${NOct} : No firmware release URL was found for [$MODEL_ID ] router model."
81108113 " $inMenuMode " && _WaitForEnterKey_ " $mainMenuReturnPromptStr "
81118114 return 1
81128115 fi
@@ -9641,7 +9644,7 @@ _InvalidMenuSelection_()
96419644}
96429645
96439646# #----------------------------------------##
9644- # # Modified by Martinski W. [2025-Jan-20 ] ##
9647+ # # Modified by Martinski W. [2025-Feb-15 ] ##
96459648# #----------------------------------------##
96469649_ShowMainMenuOptions_ ()
96479650{
@@ -9664,29 +9667,34 @@ _ShowMainMenuOptions_()
96649667 printf " ${YLWct} ============ By ExtremeFiretop & Martinski W. ============${NOct} \n\n"
96659668
96669669 # New Script Update Notification #
9667- if [ " $scriptUpdateNotify " != " 0" ]; then
9668- Say " ${REDct} *WARNING*:${NOct} ${scriptUpdateNotify} \n"
9670+ if [ " $scriptUpdateNotify " != " 0" ]
9671+ then
9672+ Say " ${InvREDct} *NOTICE*:${NOct} ${scriptUpdateNotify} "
9673+ echo
96699674 fi
96709675
96719676 # Unsupported Model Check #
96729677 if " $routerModelCheckFailed "
96739678 then
96749679 Say " ${REDct} *WARNING*:${NOct} The current router model is not supported by this script.
9675- Please uninstall.\n"
9680+ Please uninstall."
9681+ echo
96769682 fi
96779683 if " $MinFirmwareVerCheckFailed "
96789684 then
96799685 Say " ${REDct} *WARNING*:${NOct} The current firmware version is below the minimum supported.
9680- Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or higher to use this script.\n"
9686+ Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or higher to use this script."
9687+ echo
96819688 fi
96829689
96839690 if ! _HasRouterMoreThan256MBtotalRAM_ && ! _ValidateUSBMountPoint_ " $FW_ZIP_BASE_DIR "
96849691 then
96859692 Say " ${REDct} *WARNING*:${NOct} Limited RAM detected (256MB).
9686- A USB drive is required for F/W updates.\n"
9693+ A USB drive is required for F/W updates."
9694+ echo
96879695 fi
96889696
9689- arrowStr=" ${InvREDct} <<--- ${NOct} "
9697+ arrowStr=" ${InvREDct} <<<< ${NOct} "
96909698
96919699 _Calculate_NextRunTime_
96929700
@@ -9731,7 +9739,7 @@ _ShowMainMenuOptions_()
97319739 printf " \n${padStr} [Currently ${InvREDct} DISABLED ${NOct} ]"
97329740 else
97339741 printf " \n ${GRNct} 3${NOct} . Toggle Automatic F/W Update Checks"
9734- printf " \n${padStr} [Currently ${GRNct} ENABLED${NOct} ]"
9742+ printf " \n${padStr} [Currently ${InvGRNct} ENABLED ${NOct} ]"
97359743 fi
97369744 printf " \n${padStr} [Last Notification Date: $notificationStr ]\n"
97379745
@@ -9764,7 +9772,7 @@ _ShowMainMenuOptions_()
97649772 if [ " $scriptUpdateNotify " != " 0" ]
97659773 then
97669774 printf " \n ${GRNct} up${NOct} . Update $SCRIPT_NAME Script"
9767- printf " \n${padStr} [Version ${GRNct} ${DLRepoVersion}${NOct} Available for Download]\n"
9775+ printf " \n${padStr} [Version ${InvGRNct} ${DLRepoVersion} ${NOct} Available for Download]\n"
97689776 else
97699777 printf " \n ${GRNct} up${NOct} . Force Update $SCRIPT_NAME Script"
97709778 printf " \n${padStr} [No Update Available]\n"
@@ -10309,7 +10317,7 @@ then
1030910317fi
1031010318
1031110319# #----------------------------------------##
10312- # # Modified by Martinski W. [2024-Jan-22 ] ##
10320+ # # Modified by Martinski W. [2025-Feb-15 ] ##
1031310321# #----------------------------------------##
1031410322if [ $# -gt 0 ]
1031510323then
@@ -10352,7 +10360,7 @@ then
1035210360 forceupdate)
1035310361 if _AcquireLock_ cliFileLock
1035410362 then
10355- _SCRIPT_UPDATE_ force " $( [ $# -gt 1 ] && echo " $2 " || echo ) "
10363+ _SCRIPT_UPDATE_ force
1035610364 _ReleaseLock_ cliFileLock
1035710365 fi
1035810366 ;;
0 commit comments