Skip to content

Commit 5f3d666

Browse files
Fixed "Toggle F/W Build Type" Error
Fixed "buildtypechoice: parameter not set" error found when using the CLI menu option to "Toggle F/W Build Type" and user simply types the <ENTER> key.
1 parent b4e3ca2 commit 5f3d666

File tree

2 files changed

+42
-41
lines changed

2 files changed

+42
-41
lines changed

MerlinAU.sh

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
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-15
7+
# Last Modified: 2025-Feb-16
88
###################################################################
99
set -u
1010

@@ -72,6 +72,7 @@ readonly WHITEct="\e[1;37m"
7272
readonly CRITct="\e[1;41m"
7373
readonly InvREDct="\e[1;41m"
7474
readonly InvGRNct="\e[1;42m"
75+
readonly InvBYLWct="\e[30;103m"
7576

7677
readonly ScriptFileName="${0##*/}"
7778
readonly ScriptFNameTag="${ScriptFileName%%.*}"
@@ -3810,50 +3811,52 @@ _Toggle_Auto_Backups_()
38103811
_WaitForEnterKey_
38113812
}
38123813

3813-
##------------------------------------------##
3814-
## Modified by ExtremeFiretop [2024-Feb-18] ##
3815-
##------------------------------------------##
3814+
##----------------------------------------##
3815+
## Modified by Martinski W. [2025-Feb-16] ##
3816+
##----------------------------------------##
38163817
_ChangeBuildType_TUF_()
38173818
{
38183819
local doReturnToMenu buildtypechoice
3819-
printf "Changing Flash Build Type...\n"
38203820

38213821
# Use Get_Custom_Setting to retrieve the previous choice
38223822
previous_choice="$(Get_Custom_Setting "TUFBuild")"
38233823

3824-
# If the previous choice is not set, default to 'n'
3824+
# If the previous choice is not set, default to 'n' #
38253825
if [ "$previous_choice" = "TBD" ]; then
38263826
previous_choice="n"
38273827
fi
38283828

3829-
# Convert previous choice to a descriptive text
3829+
# Convert previous choice to a descriptive text #
38303830
if [ "$previous_choice" = "y" ]; then
38313831
display_choice="TUF Build"
38323832
else
38333833
display_choice="Pure Build"
38343834
fi
3835-
3836-
printf "\nCurrent Build Type: ${GRNct}$display_choice${NOct}.\n"
3835+
printf "\n\nCurrent Build Type: ${GRNct}${display_choice}${NOct}.\n"
38373836

38383837
doReturnToMenu=false
38393838
while true
38403839
do
38413840
printf "\n${SEPstr}"
38423841
printf "\nChoose your preferred option for the build type to flash:\n"
3843-
printf "\n ${GRNct}1${NOct}. Original ${REDct}TUF${NOct} themed user interface${NOct}\n"
3844-
printf "\n ${GRNct}2${NOct}. Pure ${GRNct}non-TUF${NOct} themed user interface ${GRNct}(Recommended)${NOct}\n"
3842+
printf "\n ${GRNct}1${NOct}. Original ${REDct}TUF${NOct} themed user interface"
3843+
printf "\n ${REDct}(Applies only if TUF F/W is available; otherwise, defaults to Pure build)${NOct}\n"
3844+
printf "\n ${GRNct}2${NOct}. Pure ${GRNct}Non-TUF${NOct} themed user interface"
3845+
printf "\n ${GRNct}(Recommended)${NOct}\n"
38453846
printf "\n ${GRNct}e${NOct}. Exit to Advanced Menu\n"
38463847
printf "${SEPstr}\n"
3847-
printf "[$display_choice] Enter selection: "
3848+
printf "[${GRNct}${display_choice}${NOct}] Enter selection: "
38483849
read -r choice
38493850

3850-
[ -z "$choice" ] && break
3851-
3852-
if echo "$choice" | grep -qE "^(e|exit|Exit)$"
3851+
if [ -z "$choice" ] || echo "$choice" | grep -qE "^(e|exit|Exit)$"
38533852
then doReturnToMenu=true ; break ; fi
38543853

38553854
case $choice in
3856-
1) buildtypechoice="y" ; break
3855+
1) buildtypechoice="y"
3856+
printf "\n${InvBYLWct} NOTE: ${NOct}\n"
3857+
printf "${CYANct}The TUF build will apply only if a compatible TUF firmware image is available."
3858+
printf "\nOtherwise, the Pure ${GRNct}Non-TUF${NOct}${CYANct} build will be used instead.${NOct}\n"
3859+
break
38573860
;;
38583861
2) buildtypechoice="n" ; break
38593862
;;
@@ -3870,50 +3873,52 @@ _ChangeBuildType_TUF_()
38703873
_WaitForEnterKey_ "$advnMenuReturnPromptStr"
38713874
}
38723875

3873-
##------------------------------------------##
3874-
## Modified by ExtremeFiretop [2024-Feb-18] ##
3875-
##------------------------------------------##
3876+
##----------------------------------------##
3877+
## Modified by Martinski W. [2025-Feb-16] ##
3878+
##----------------------------------------##
38763879
_ChangeBuildType_ROG_()
38773880
{
38783881
local doReturnToMenu buildtypechoice
3879-
printf "Changing Flash Build Type...\n"
38803882

38813883
# Use Get_Custom_Setting to retrieve the previous choice
38823884
previous_choice="$(Get_Custom_Setting "ROGBuild")"
38833885

3884-
# If the previous choice is not set, default to 'n'
3886+
# If the previous choice is not set, default to 'n' #
38853887
if [ "$previous_choice" = "TBD" ]; then
38863888
previous_choice="n"
38873889
fi
38883890

3889-
# Convert previous choice to a descriptive text
3891+
# Convert previous choice to a descriptive text #
38903892
if [ "$previous_choice" = "y" ]; then
38913893
display_choice="ROG Build"
38923894
else
38933895
display_choice="Pure Build"
38943896
fi
3895-
3896-
printf "\nCurrent Build Type: ${GRNct}$display_choice${NOct}.\n"
3897+
printf "\n\nCurrent Build Type: ${GRNct}${display_choice}${NOct}.\n"
38973898

38983899
doReturnToMenu=false
38993900
while true
39003901
do
39013902
printf "\n${SEPstr}"
39023903
printf "\nChoose your preferred option for the build type to flash:\n"
3903-
printf "\n ${GRNct}1${NOct}. Original ${REDct}ROG${NOct} themed user interface${NOct}\n"
3904-
printf "\n ${GRNct}2${NOct}. Pure ${GRNct}non-ROG${NOct} themed user interface ${GRNct}(Recommended)${NOct}\n"
3904+
printf "\n ${GRNct}1${NOct}. Original ${REDct}ROG${NOct} themed user interface"
3905+
printf "\n ${REDct}(Applies only if ROG F/W is available; otherwise, defaults to Pure build)${NOct}\n"
3906+
printf "\n ${GRNct}2${NOct}. Pure ${GRNct}Non-ROG${NOct} themed user interface"
3907+
printf "\n ${GRNct}(Recommended)${NOct}\n"
39053908
printf "\n ${GRNct}e${NOct}. Exit to Advanced Menu\n"
39063909
printf "${SEPstr}\n"
3907-
printf "[$display_choice] Enter selection: "
3910+
printf "[${GRNct}${display_choice}${NOct}] Enter selection: "
39083911
read -r choice
39093912

3910-
[ -z "$choice" ] && break
3911-
3912-
if echo "$choice" | grep -qE "^(e|exit|Exit)$"
3913+
if [ -z "$choice" ] || echo "$choice" | grep -qE "^(e|exit|Exit)$"
39133914
then doReturnToMenu=true ; break ; fi
39143915

39153916
case $choice in
3916-
1) buildtypechoice="y" ; break
3917+
1) buildtypechoice="y"
3918+
printf "\n${InvBYLWct} NOTE: ${NOct}\n"
3919+
printf "${CYANct}The ROG build will apply only if a compatible ROG firmware image is available."
3920+
printf "\nOtherwise, the Pure ${GRNct}Non-ROG${NOct}${CYANct} build will be used instead.${NOct}\n"
3921+
break
39173922
;;
39183923
2) buildtypechoice="n" ; break
39193924
;;
@@ -8625,7 +8630,7 @@ _ShowMainMenu_()
86258630
}
86268631

86278632
##----------------------------------------##
8628-
## Modified by Martinski W. [2024-Dec-22] ##
8633+
## Modified by Martinski W. [2025-Feb-16] ##
86298634
##----------------------------------------##
86308635
_ShowAdvancedOptionsMenu_()
86318636
{
@@ -8689,7 +8694,6 @@ _ShowAdvancedOptionsMenu_()
86898694
then
86908695
if [ "$fwInstalledBaseVers" -le 3004 ]
86918696
then
8692-
# Retrieve the current build type setting
86938697
current_build_type="$(Get_Custom_Setting "TUFBuild")"
86948698

86958699
# Convert the setting to a descriptive text
@@ -8703,15 +8707,14 @@ _ShowAdvancedOptionsMenu_()
87038707

87048708
if echo "$PRODUCT_ID" | grep -q "^TUF-"
87058709
then
8706-
printf "\n ${GRNct}bt${NOct}. Toggle F/W Build Type"
8710+
printf "\n ${GRNct}bt${NOct}. Toggle F/W Build Type Preference"
87078711
if [ "$current_build_type_menu" = "NOT SET" ]
87088712
then printf "\n${padStr}[Current Build Type: ${REDct}${current_build_type_menu}${NOct}]\n"
87098713
else printf "\n${padStr}[Current Build Type: ${GRNct}${current_build_type_menu}${NOct}]\n"
87108714
fi
87118715
fi
87128716
elif [ "$fwInstalledBaseVers" -ge 3006 ]
87138717
then
8714-
# Retrieve the current build type setting
87158718
local current_build_typerog="$(Get_Custom_Setting "ROGBuild")"
87168719

87178720
# Convert the setting to a descriptive text
@@ -8725,14 +8728,13 @@ _ShowAdvancedOptionsMenu_()
87258728

87268729
if echo "$PRODUCT_ID" | grep -q "^GT-"
87278730
then
8728-
printf "\n ${GRNct}bt${NOct}. Toggle F/W Build Type"
8731+
printf "\n ${GRNct}bt${NOct}. Toggle F/W Build Type Preference"
87298732
if [ "$current_build_type_menurog" = "NOT SET" ]
87308733
then printf "\n${padStr}[Current Build Type: ${REDct}${current_build_type_menurog}${NOct}]\n"
87318734
else printf "\n${padStr}[Current Build Type: ${GRNct}${current_build_type_menurog}${NOct}]\n"
87328735
fi
87338736
fi
87348737

8735-
# Retrieve the current build type setting
87368738
local current_build_typetuf="$(Get_Custom_Setting "TUFBuild")"
87378739

87388740
# Convert the setting to a descriptive text
@@ -8746,7 +8748,7 @@ _ShowAdvancedOptionsMenu_()
87468748

87478749
if echo "$PRODUCT_ID" | grep -q "^TUF-"
87488750
then
8749-
printf "\n ${GRNct}bt${NOct}. Toggle F/W Build Type"
8751+
printf "\n ${GRNct}bt${NOct}. Toggle F/W Build Type Preference"
87508752
if [ "$current_build_type_menutuf" = "NOT SET" ]
87518753
then printf "\n${padStr}[Current Build Type: ${REDct}${current_build_type_menutuf}${NOct}]\n"
87528754
else printf "\n${padStr}[Current Build Type: ${GRNct}${current_build_type_menutuf}${NOct}]\n"
@@ -8756,7 +8758,6 @@ _ShowAdvancedOptionsMenu_()
87568758
else
87578759
if [ "$fwInstalledBaseVers" -le 3004 ]
87588760
then
8759-
# Retrieve the current build type setting
87608761
current_build_type="$(Get_Custom_Setting "ROGBuild")"
87618762

87628763
# Convert the setting to a descriptive text
@@ -8770,7 +8771,7 @@ _ShowAdvancedOptionsMenu_()
87708771

87718772
if echo "$PRODUCT_ID" | grep -q "^GT-"
87728773
then
8773-
printf "\n ${GRNct}bt${NOct}. Toggle F/W Build Type"
8774+
printf "\n ${GRNct}bt${NOct}. Toggle F/W Build Type Preference"
87748775
if [ "$current_build_type_menu" = "NOT SET" ]
87758776
then printf "\n${padStr}[Current Build Type: ${REDct}${current_build_type_menu}${NOct}]\n"
87768777
else printf "\n${padStr}[Current Build Type: ${GRNct}${current_build_type_menu}${NOct}]\n"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MerlinAU - AsusWRT-Merlin Firmware Auto Updater
22
## v1.3.10
3-
## 2025-Jan-06
3+
## 2025-Feb-??
44

55
![image](https://github.com/user-attachments/assets/185f9fe4-acdb-419a-8154-ab6fa6e0fd46)
66
![image](https://github.com/user-attachments/assets/8f22818d-2118-4c47-a54a-e54fb147fd6b)

0 commit comments

Comments
 (0)