44#
55# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
66# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
7- # Last Modified: 2024-Apr-06
7+ # Last Modified: 2024-Apr-07
88# ##################################################################
99set -u
1010
@@ -75,11 +75,19 @@ then cronListCmd="cru l"
7575else cronListCmd=" crontab -l"
7676fi
7777
78- # #---------------------------------------------- ##
79- # # Added/ Modified by Martinski W. [2024-Jan -06] ##
80- # #---------------------------------------------- ##
78+ # #----------------------------------------##
79+ # # Modified by Martinski W. [2024-Apr -06] ##
80+ # #----------------------------------------##
8181inMenuMode=true
8282isInteractive=false
83+
84+ mainLAN_IPaddr=" $( nvram get lan_ipaddr) "
85+
86+ if [ " $( nvram get sw_mode) " -eq 1 ]
87+ then inRouterSWmode=true
88+ else inRouterSWmode=false
89+ fi
90+
8391mainMenuReturnPromptStr=" Press <Enter> to return to the Main Menu..."
8492advnMenuReturnPromptStr=" Press <Enter> to return to the Advanced Menu..."
8593
@@ -304,7 +312,7 @@ _Reset_LEDs_()
304312}
305313
306314# #----------------------------------------##
307- # # Modified by Martinski W. [2023-Nov-21 ] ##
315+ # # Modified by Martinski W. [2024-Apr-06 ] ##
308316# #----------------------------------------##
309317_GetRouterURL_ ()
310318{
@@ -317,7 +325,7 @@ _GetRouterURL_()
317325
318326 urlDomain=" $( nvram get lan_domain) "
319327 if [ -z " $urlDomain " ]
320- then urlDomain=" $( nvram get lan_ipaddr ) "
328+ then urlDomain=" $mainLAN_IPaddr "
321329 else urlDomain=" $( nvram get lan_hostname) .$urlDomain "
322330 fi
323331
@@ -1221,7 +1229,7 @@ _CreateEMailContent_()
12211229 subjectStr=" F/W Update Status for $MODEL_ID "
12221230 fwInstalledVersion=" $( _GetCurrentFWInstalledLongVersion_) "
12231231 fwNewUpdateVersion=" $( _GetLatestFWUpdateVersionFromRouter_ 1) "
1224- if [ " $( nvram get sw_mode ) " = " 1 " ] && [ -n " $node_list " ]; then
1232+ if " $inRouterSWmode " && [ -n " $node_list " ]; then
12251233 nodefwNewUpdateVersion=" $( _GetLatestFWUpdateVersionFromNode_ 1) "
12261234 fi
12271235
@@ -2212,13 +2220,12 @@ _GetNodeIPv4List_()
22122220 # Get the value of asus_device_list #
22132221 local ip_addresses
22142222 local device_list=" $( nvram get asus_device_list) "
2215- local urlDomain=" $( nvram get lan_ipaddr) "
22162223
22172224 # Check if asus_device_list is not empty #
22182225 if [ -n " $device_list " ]
22192226 then
2220- # Split the device list into records and extract the IP addresses, excluding the lan_ipaddr #
2221- ip_addresses=" $( echo " $device_list " | tr ' <' ' \n' | awk -v exclude=" $urlDomain " -F' >' ' {if (NF>=4 && $3 != exclude) print $3}' ) "
2227+ # Split the device list into records and extract the IP addresses, excluding Main Router LAN IP address #
2228+ ip_addresses=" $( echo " $device_list " | tr ' <' ' \n' | awk -v exclude=" $mainLAN_IPaddr " -F' >' ' {if (NF>=4 && $3 != exclude) print $3}' ) "
22222229
22232230 # Check if IP addresses are not empty #
22242231 if [ -n " $ip_addresses " ]; then
@@ -2242,13 +2249,12 @@ _NodeActiveStatus_()
22422249 # Get the value of cfg_device_list #
22432250 local ip_addresses
22442251 local node_online_status=" $( nvram get cfg_device_list) "
2245- local urlDomain=" $( nvram get lan_ipaddr) "
22462252
22472253 # Check if cfg_device_list is not empty #
22482254 if [ -n " $node_online_status " ]
22492255 then
2250- # Split the device list into records and extract the IP addresses, excluding the lan_ipaddr
2251- ip_addresses=" $( echo " $node_online_status " | tr ' <' ' \n' | awk -v exclude=" $urlDomain " -F' >' ' {if (NF>=3 && $2 != exclude) print $2}' ) "
2256+ # Split the device list into records and extract the IP addresses, excluding Main Router LAN IP address #
2257+ ip_addresses=" $( echo " $node_online_status " | tr ' <' ' \n' | awk -v exclude=" $mainLAN_IPaddr " -F' >' ' {if (NF>=3 && $2 != exclude) print $2}' ) "
22522258
22532259 # Check if IP addresses are not empty #
22542260 if [ -n " $ip_addresses " ]; then
@@ -3374,7 +3380,7 @@ Please manually update to version $minimum_supported_version or higher to use th
33743380 FW_ZIP_FPATH=" ${FW_ZIP_DIR} /${FW_FileName} .zip"
33753381 fi
33763382
3377- _ProcessMeshNodes_ 0
3383+ _ProcessMeshNodes_ 0
33783384
33793385 local credsBase64=" "
33803386 local currentVersionNum=" " releaseVersionNum=" "
@@ -4504,7 +4510,7 @@ _ShowMainMenu_()
45044510 # # Modified by ExtremeFiretop [2024-Mar-27] ##
45054511 # #------------------------------------------##
45064512 printf " ${SEPstr} "
4507- if [ " $HIDE_ROUTER_SECTION " = false ]
4513+ if [ " $HIDE_ROUTER_SECTION " = " false" ]
45084514 then
45094515 if ! FW_NewUpdateVersion=" $( _GetLatestFWUpdateVersionFromRouter_ 1) "
45104516 then FW_NewUpdateVersion=" ${REDct} NONE FOUND${NOct} "
@@ -4543,7 +4549,7 @@ _ShowMainMenu_()
45434549 printf " \n${padStr} [Current Schedule: ${GRNct}${FW_UpdateCronJobSchedule}${NOct} ]\n"
45444550
45454551 # Check for AiMesh Nodes #
4546- if [ " $( nvram get sw_mode ) " = " 1 " ] && [ -n " $node_list " ]; then
4552+ if " $inRouterSWmode " && [ -n " $node_list " ]; then
45474553 printf " \n ${GRNct} mn${NOct} . AiMesh Node(s) Info\n"
45484554 fi
45494555
@@ -4695,7 +4701,7 @@ _ProcessMeshNodes_()
46954701 if ! node_list=" $( _GetNodeIPv4List_) "
46964702 then node_list=" " ; fi
46974703
4698- if [ " $( nvram get sw_mode ) " = " 1 " ]
4704+ if " $inRouterSWmode "
46994705 then
47004706 if [ -n " $node_list " ]
47014707 then
@@ -4789,34 +4795,34 @@ _advanced_options_menu_()
47894795 ;;
47904796 4) _toggle_beta_updates_
47914797 ;;
4792- ab) if [ -f " /jffs/scripts/backupmon.sh" ]
4793- then _Toggle_Auto_Backups_
4794- else _InvalidMenuSelection_
4795- fi
4796- ;;
4797- em) if " $isEMailConfigEnabledInAMTM "
4798- then _Toggle_FW_UpdateEmailNotifications_
4799- else _InvalidMenuSelection_
4800- fi
4801- ;;
4802- ef) if " $isEMailConfigEnabledInAMTM " && \
4803- " $sendEMailNotificationsFlag "
4804- then _SetEMailFormatType_
4805- else _InvalidMenuSelection_
4806- fi
4798+ ab) if [ -f " /jffs/scripts/backupmon.sh" ]
4799+ then _Toggle_Auto_Backups_
4800+ else _InvalidMenuSelection_
4801+ fi
48074802 ;;
4808- se) if " $isEMailConfigEnabledInAMTM " && \
4809- " $sendEMailNotificationsFlag "
4810- then _SetSecondaryEMailAddress_
4811- else _InvalidMenuSelection_
4812- fi
4803+ em) if " $isEMailConfigEnabledInAMTM "
4804+ then _Toggle_FW_UpdateEmailNotifications_
4805+ else _InvalidMenuSelection_
4806+ fi
48134807 ;;
4814- bt) if echo " $PRODUCT_ID " | grep -q " ^GT-"
4815- then change_build_type
4816- else _InvalidMenuSelection_
4817- fi
4818- ;;
4819- e|exit) break
4808+ ef) if " $isEMailConfigEnabledInAMTM " && \
4809+ " $sendEMailNotificationsFlag "
4810+ then _SetEMailFormatType_
4811+ else _InvalidMenuSelection_
4812+ fi
4813+ ;;
4814+ se) if " $isEMailConfigEnabledInAMTM " && \
4815+ " $sendEMailNotificationsFlag "
4816+ then _SetSecondaryEMailAddress_
4817+ else _InvalidMenuSelection_
4818+ fi
4819+ ;;
4820+ bt) if echo " $PRODUCT_ID " | grep -q " ^GT-"
4821+ then change_build_type
4822+ else _InvalidMenuSelection_
4823+ fi
4824+ ;;
4825+ e|exit) break
48204826 ;;
48214827 * ) _InvalidMenuSelection_
48224828 ;;
@@ -4860,13 +4866,13 @@ do
48604866 printf " Enter selection: " ; read -r userChoice
48614867 echo
48624868 case $userChoice in
4863- s|S|h|H)
4864- if [ " $userChoice " = " s" ] || [ " $userChoice " = " S" ]; then
4865- HIDE_ROUTER_SECTION=false
4866- elif [ " $userChoice " = " h" ] || [ " $userChoice " = " H" ]; then
4867- HIDE_ROUTER_SECTION=true
4868- fi
4869- ;;
4869+ s|S|h|H)
4870+ if [ " $userChoice " = " s" ] || [ " $userChoice " = " S" ]; then
4871+ HIDE_ROUTER_SECTION=false
4872+ elif [ " $userChoice " = " h" ] || [ " $userChoice " = " H" ]; then
4873+ HIDE_ROUTER_SECTION=true
4874+ fi
4875+ ;;
48704876 1) _RunFirmwareUpdateNow_
48714877 ;;
48724878 2) _GetLoginCredentials_
48774883 ;;
48784884 5) _Set_FW_UpdateCronSchedule_
48794885 ;;
4880- mn) if [ " $( nvram get sw_mode ) " = " 1 " ] && [ -n " $node_list " ]
4886+ mn) if " $inRouterSWmode " && [ -n " $node_list " ]
48814887 then _ShowNodesMenuOptions_
48824888 else _InvalidMenuSelection_
48834889 fi
0 commit comments