Skip to content

Commit bc86e9c

Browse files
Merge pull request #401 from ExtremeFiretop/ExtremeFiretop-ROGPatch
More Build Type Refinements
2 parents 48fec8b + 0214b3a commit bc86e9c

File tree

1 file changed

+99
-150
lines changed

1 file changed

+99
-150
lines changed

MerlinAU.sh

Lines changed: 99 additions & 150 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-08
7+
# Last Modified: 2025-Feb-12
88
###################################################################
99
set -u
1010

@@ -1843,6 +1843,7 @@ _Mount_WebUI_()
18431843
if [ ! -f "$TEMP_MENU_TREE" ]
18441844
then cp -fp "$ORIG_MENU_TREE" "$TEMP_MENU_TREE"
18451845
fi
1846+
18461847
sed -i "/url: \"$webPageFile\", tabName: \"$SCRIPT_NAME\"/d" "$TEMP_MENU_TREE"
18471848

18481849
# Insert new page tab in the 'Administration' menu #
@@ -7648,11 +7649,11 @@ _GnutonBuildSelection_()
76487649

76497650
if [ "$previous_choice" = "ENABLED" ]
76507651
then
7651-
echo "TUF Build selected for flashing"
7652+
Say "TUF build selected for flashing"
76527653
firmware_choice="tuf"
76537654
elif [ "$previous_choice" = "DISABLED" ]
76547655
then
7655-
echo "Pure Build selected for flashing"
7656+
Say "Pure build selected for flashing"
76567657
firmware_choice="pure"
76577658
elif [ "$inMenuMode" = true ]
76587659
then
@@ -7662,16 +7663,16 @@ _GnutonBuildSelection_()
76627663
read -r choice
76637664
if [ "$choice" = "y" ] || [ "$choice" = "Y" ]
76647665
then
7665-
echo "TUF Build selected for flashing"
7666+
Say "TUF build selected for flashing"
76667667
firmware_choice="tuf"
76677668
Update_Custom_Settings "TUFBuild" "ENABLED"
76687669
else
7669-
echo "Pure Build selected for flashing"
7670+
Say "Pure build selected for flashing"
76707671
firmware_choice="pure"
76717672
Update_Custom_Settings "TUFBuild" "DISABLED"
76727673
fi
76737674
else
7674-
echo "Defaulting to Pure Build due to non-interactive mode."
7675+
Say "Defaulting to Pure build due to non-interactive mode."
76757676
firmware_choice="pure"
76767677
Update_Custom_Settings "TUFBuild" "DISABLED"
76777678
fi
@@ -7682,11 +7683,11 @@ _GnutonBuildSelection_()
76827683

76837684
if [ "$previous_choice" = "ENABLED" ]
76847685
then
7685-
echo "ROG Build selected for flashing"
7686+
Say "ROG build selected for flashing"
76867687
firmware_choice="rog"
76877688
elif [ "$previous_choice" = "DISABLED" ]
76887689
then
7689-
echo "Pure Build selected for flashing"
7690+
Say "Pure build selected for flashing"
76907691
firmware_choice="pure"
76917692
elif [ "$inMenuMode" = true ]
76927693
then
@@ -7696,16 +7697,16 @@ _GnutonBuildSelection_()
76967697
read -r choice
76977698
if [ "$choice" = "y" ] || [ "$choice" = "Y" ]
76987699
then
7699-
echo "ROG Build selected for flashing"
7700+
Say "ROG build selected for flashing"
77007701
firmware_choice="rog"
77017702
Update_Custom_Settings "ROGBuild" "ENABLED"
77027703
else
7703-
echo "Pure Build selected for flashing"
7704+
Say "Pure build selected for flashing"
77047705
firmware_choice="pure"
77057706
Update_Custom_Settings "ROGBuild" "DISABLED"
77067707
fi
77077708
else
7708-
echo "Defaulting to Pure Build due to non-interactive mode."
7709+
Say "Defaulting to Pure build due to non-interactive mode."
77097710
firmware_choice="pure"
77107711
Update_Custom_Settings "ROGBuild" "DISABLED"
77117712
fi
@@ -8239,72 +8240,47 @@ Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or
82398240
## Modified by ExtremeFiretop [2024-Dec-21] ##
82408241
##------------------------------------------##
82418242
pure_file="$(ls -1 | grep -iE '.*[.](w|pkgtb)$' | grep -iv 'rog')"
8243+
# Detect ROG firmware file #
8244+
rog_file="$(ls | grep -i '_rog_')"
82428245

8243-
if [ "$fwInstalledBaseVers" -le 3004 ] && [ "$fwUpdateBaseNum" -le 3004 ]
8246+
# Check if a ROG build is present #
8247+
if [ -n "$rog_file" ]
82448248
then
8245-
# Handle upgrades from 3004 and lower #
8246-
8247-
# Detect ROG firmware file #
8248-
rog_file="$(ls | grep -i '_rog_')"
8249-
82508249
# Fetch the previous choice from the settings file
82518250
previous_choice="$(Get_Custom_Setting "ROGBuild")"
8252-
8253-
# Check if a ROG build is present #
8254-
if [ -n "$rog_file" ]
8251+
# Use the previous choice if it exists and valid, else prompt the user for their choice in interactive mode
8252+
if [ "$previous_choice" = "ENABLED" ]
82558253
then
8256-
# Use the previous choice if it exists and valid, else prompt the user for their choice in interactive mode
8257-
if [ "$previous_choice" = "ENABLED" ]
8258-
then
8259-
Say "ROG Build selected for flashing"
8254+
Say "ROG build selected for flashing"
8255+
firmware_file="$rog_file"
8256+
elif [ "$previous_choice" = "DISABLED" ]
8257+
then
8258+
Say "Pure build selected for flashing"
8259+
firmware_file="$pure_file"
8260+
elif [ "$inMenuMode" = true ]
8261+
then
8262+
printf "${REDct}Found ROG build: $rog_file.${NOct}\n"
8263+
printf "${REDct}Would you like to use the ROG build?${NOct}\n"
8264+
printf "Enter your choice (y/n): "
8265+
read -r choice
8266+
if [ "$choice" = "y" ] || [ "$choice" = "Y" ]; then
8267+
Say "ROG build selected for flashing"
82608268
firmware_file="$rog_file"
8261-
elif [ "$previous_choice" = "DISABLED" ]
8262-
then
8263-
Say "Pure Build selected for flashing"
8264-
firmware_file="$pure_file"
8265-
elif [ "$inMenuMode" = true ]
8266-
then
8267-
printf "${REDct}Found ROG build: $rog_file.${NOct}\n"
8268-
printf "${REDct}Would you like to use the ROG build?${NOct}\n"
8269-
printf "Enter your choice (y/n): "
8270-
read -r choice
8271-
if [ "$choice" = "y" ] || [ "$choice" = "Y" ]; then
8272-
Say "ROG Build selected for flashing"
8273-
firmware_file="$rog_file"
8274-
Update_Custom_Settings "ROGBuild" "ENABLED"
8275-
else
8276-
Say "Pure Build selected for flashing"
8277-
firmware_file="$pure_file"
8278-
Update_Custom_Settings "ROGBuild" "DISABLED"
8279-
fi
8269+
Update_Custom_Settings "ROGBuild" "ENABLED"
82808270
else
8281-
# Default to pure_file in non-interactive mode if no previous choice
8282-
Say "Pure Build selected for flashing"
8283-
Update_Custom_Settings "ROGBuild" "DISABLED"
8271+
Say "Pure build selected for flashing"
82848272
firmware_file="$pure_file"
8273+
Update_Custom_Settings "ROGBuild" "DISABLED"
82858274
fi
82868275
else
8287-
# No ROG build found, use the pure build
8288-
Say "No ROG Build detected. Skipping."
8289-
firmware_file="$pure_file"
8290-
fi
8291-
elif [ "$fwInstalledBaseVers" -eq 3004 ] && [ "$fwUpdateBaseNum" -ge 3006 ]
8292-
then
8293-
# Handle upgrade from 3004 to 3006
8294-
# Fetch the previous choice from the settings file
8295-
previous_choice="$(Get_Custom_Setting "ROGBuild")"
8296-
8297-
# Handle upgrade from 3004 to 3006 if there is a ROG setting
8298-
if [ "$previous_choice" = "ENABLED" ]
8299-
then
8300-
Say "Upgrading from 3004 to 3006, ROG UI is no longer supported, auto-selecting Pure UI firmware."
8301-
firmware_file="$pure_file"
8276+
# Default to pure_file in non-interactive mode if no previous choice
8277+
Say "Defaulting to Pure build for flashing"
83028278
Update_Custom_Settings "ROGBuild" "DISABLED"
8303-
else
83048279
firmware_file="$pure_file"
83058280
fi
83068281
else
8307-
# Handle upgrades from 3006 and higher #
8282+
# No ROG build found, use the pure build
8283+
Say "No ROG build found. Skipping."
83088284
firmware_file="$pure_file"
83098285
fi
83108286

@@ -9850,99 +9826,72 @@ _ShowAdvancedOptionsMenu_()
98509826
printf "\n${padStr}[${GRNct}%s${NOct}]\n" "$(_TranslateCronSchedHR_ "$scriptUpdateCronSched")"
98519827
fi
98529828

9853-
if "$isGNUtonFW"
9854-
then
9855-
if [ "$fwInstalledBaseVers" -le 3004 ]
9856-
then
9857-
# Retrieve the current build type setting
9858-
current_build_type="$(Get_Custom_Setting "TUFBuild")"
9859-
9860-
# Convert the setting to a descriptive text
9861-
if [ "$current_build_type" = "ENABLED" ]; then
9862-
current_build_type_menu="TUF Build"
9863-
elif [ "$current_build_type" = "DISABLED" ]; then
9864-
current_build_type_menu="Pure Build"
9865-
else
9866-
current_build_type_menu="NOT SET"
9867-
fi
9829+
if "$isGNUtonFW"
9830+
then
9831+
if echo "$PRODUCT_ID" | grep -q "^TUF-"
9832+
then
9833+
# Retrieve the current build type setting
9834+
local current_build_type="$(Get_Custom_Setting "TUFBuild")"
98689835

9869-
if echo "$PRODUCT_ID" | grep -q "^TUF-"
9870-
then
9871-
printf "\n ${GRNct}bt${NOct}. Toggle F/W Build Type"
9872-
if [ "$current_build_type_menu" = "NOT SET" ]
9873-
then printf "\n${padStr}[Current Build Type: ${REDct}${current_build_type_menu}${NOct}]\n"
9874-
else printf "\n${padStr}[Current Build Type: ${GRNct}${current_build_type_menu}${NOct}]\n"
9875-
fi
9876-
fi
9877-
elif [ "$fwInstalledBaseVers" -ge 3006 ]
9878-
then
9879-
# Retrieve the current build type setting #
9880-
local current_build_typerog="$(Get_Custom_Setting "ROGBuild")"
9836+
# Convert the setting to a descriptive text
9837+
if [ "$current_build_type" = "ENABLED" ]
9838+
then
9839+
current_build_type_menu="TUF Build"
9840+
elif [ "$current_build_type" = "DISABLED" ]
9841+
then
9842+
current_build_type_menu="Pure Build"
9843+
else
9844+
current_build_type_menu="NOT SET"
9845+
fi
9846+
printf "\n ${GRNct}bt${NOct}. Toggle F/W Build Type"
9847+
if [ "$current_build_type_menu" = "NOT SET" ]
9848+
then printf "\n${padStr}[Current Build Type: ${REDct}${current_build_type_menu}${NOct}]\n"
9849+
else printf "\n${padStr}[Current Build Type: ${GRNct}${current_build_type_menu}${NOct}]\n"
9850+
fi
9851+
elif echo "$PRODUCT_ID" | grep -q "^GT-"
9852+
then
9853+
# Retrieve the current build type setting #
9854+
local current_build_typerog="$(Get_Custom_Setting "ROGBuild")"
98819855

9882-
# Convert the setting to a descriptive text
9883-
if [ "$current_build_typerog" = "ENABLED" ]; then
9856+
# Convert the setting to a descriptive text
9857+
if [ "$current_build_typerog" = "ENABLED" ]
9858+
then
98849859
current_build_type_menurog="ROG Build"
9885-
elif [ "$current_build_typerog" = "DISABLED" ]; then
9860+
elif [ "$current_build_typerog" = "DISABLED" ]
9861+
then
98869862
current_build_type_menurog="Pure Build"
9887-
else
9863+
else
98889864
current_build_type_menurog="NOT SET"
9889-
fi
9890-
9891-
if echo "$PRODUCT_ID" | grep -q "^GT-"
9892-
then
9893-
printf "\n ${GRNct}bt${NOct}. Toggle F/W Build Type"
9894-
if [ "$current_build_type_menurog" = "NOT SET" ]
9895-
then printf "\n${padStr}[Current Build Type: ${REDct}${current_build_type_menurog}${NOct}]\n"
9896-
else printf "\n${padStr}[Current Build Type: ${GRNct}${current_build_type_menurog}${NOct}]\n"
9897-
fi
9898-
fi
9899-
9900-
# Retrieve the current build type setting
9901-
local current_build_typetuf="$(Get_Custom_Setting "TUFBuild")"
9902-
9903-
# Convert the setting to a descriptive text
9904-
if [ "$current_build_typetuf" = "ENABLED" ]; then
9905-
current_build_type_menutuf="TUF Build"
9906-
elif [ "$current_build_typetuf" = "DISABLED" ]; then
9907-
current_build_type_menutuf="Pure Build"
9908-
else
9909-
current_build_type_menutuf="NOT SET"
9910-
fi
9911-
9912-
if echo "$PRODUCT_ID" | grep -q "^TUF-"
9913-
then
9914-
printf "\n ${GRNct}bt${NOct}. Toggle F/W Build Type"
9915-
if [ "$current_build_type_menutuf" = "NOT SET" ]
9916-
then printf "\n${padStr}[Current Build Type: ${REDct}${current_build_type_menutuf}${NOct}]\n"
9917-
else printf "\n${padStr}[Current Build Type: ${GRNct}${current_build_type_menutuf}${NOct}]\n"
9918-
fi
9919-
fi
9920-
fi
9921-
else
9922-
if [ "$fwInstalledBaseVers" -le 3004 ]
9923-
then
9924-
# Retrieve the current build type setting
9925-
current_build_type="$(Get_Custom_Setting "ROGBuild")"
9926-
9927-
# Convert the setting to a descriptive text
9928-
if [ "$current_build_type" = "ENABLED" ]; then
9929-
current_build_type_menu="ROG Build"
9930-
elif [ "$current_build_type" = "DISABLED" ]; then
9931-
current_build_type_menu="Pure Build"
9932-
else
9933-
current_build_type_menu="NOT SET"
9934-
fi
9865+
fi
9866+
printf "\n ${GRNct}bt${NOct}. Toggle F/W Build Type"
9867+
if [ "$current_build_type_menurog" = "NOT SET" ]
9868+
then printf "\n${padStr}[Current Build Type: ${REDct}${current_build_type_menurog}${NOct}]\n"
9869+
else printf "\n${padStr}[Current Build Type: ${GRNct}${current_build_type_menurog}${NOct}]\n"
9870+
fi
9871+
fi
9872+
else
9873+
if echo "$PRODUCT_ID" | grep -q "^GT-"
9874+
then
9875+
# Retrieve the current build type setting
9876+
local current_build_type="$(Get_Custom_Setting "ROGBuild")"
99359877

9936-
if echo "$PRODUCT_ID" | grep -q "^GT-"
9937-
then
9938-
printf "\n ${GRNct}bt${NOct}. Toggle F/W Build Type"
9939-
if [ "$current_build_type_menu" = "NOT SET" ]
9940-
then printf "\n${padStr}[Current Build Type: ${REDct}${current_build_type_menu}${NOct}]\n"
9941-
else printf "\n${padStr}[Current Build Type: ${GRNct}${current_build_type_menu}${NOct}]\n"
9942-
fi
9943-
fi
9944-
fi
9945-
fi
9878+
# Convert the setting to a descriptive text
9879+
if [ "$current_build_type" = "ENABLED" ]
9880+
then
9881+
current_build_type_menu="ROG Build"
9882+
elif [ "$current_build_type" = "DISABLED" ]
9883+
then
9884+
current_build_type_menu="Pure Build"
9885+
else
9886+
current_build_type_menu="NOT SET"
9887+
fi
9888+
printf "\n ${GRNct}bt${NOct}. Toggle F/W Build Type"
9889+
if [ "$current_build_type_menu" = "NOT SET" ]
9890+
then printf "\n${padStr}[Current Build Type: ${REDct}${current_build_type_menu}${NOct}]\n"
9891+
else printf "\n${padStr}[Current Build Type: ${GRNct}${current_build_type_menu}${NOct}]\n"
9892+
fi
9893+
fi
9894+
fi
99469895

99479896
# Additional Email Notification Options #
99489897
_WebUI_SetEmailConfigFileFromAMTM_

0 commit comments

Comments
 (0)