Skip to content

Commit 48fec8b

Browse files
Merge pull request #399 from ExtremeFiretop/ExtremeFiretop-DefaultBuiltType
Initialize a Default Build Type for ROG and TUF
2 parents 9617a6e + ec6c489 commit 48fec8b

File tree

2 files changed

+115
-43
lines changed

2 files changed

+115
-43
lines changed

MerlinAU.asp

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,7 @@ function InitializeFields()
12641264
12651265
// Call the visibility handler //
12661266
handleROGFWBuildTypeVisibility();
1267+
updateTUFROGAvailText();
12671268
console.log("Initializing was completed successfully.");
12681269
}
12691270
else
@@ -1902,6 +1903,55 @@ document.addEventListener("DOMContentLoaded", function()
19021903
FormatFirmwareVersion();
19031904
});
19041905
1906+
function updateTUFROGAvailText() {
1907+
// For ROG
1908+
let rogSelect = document.getElementById('rogFWBuildType');
1909+
let rogMsgSpan = document.getElementById('rogFWBuildTypeAvailMsg');
1910+
if (rogSelect && rogMsgSpan) {
1911+
if (rogSelect.value === 'ROG') {
1912+
rogMsgSpan.style.display = 'inline-block';
1913+
} else {
1914+
rogMsgSpan.style.display = 'none';
1915+
}
1916+
}
1917+
1918+
// For TUF
1919+
let tufSelect = document.getElementById('tuffFWBuildType');
1920+
let tufMsgSpan = document.getElementById('tuffFWBuildTypeAvailMsg');
1921+
if (tufSelect && tufMsgSpan) {
1922+
if (tufSelect.value === 'TUF') {
1923+
tufMsgSpan.style.display = 'inline-block';
1924+
} else {
1925+
tufMsgSpan.style.display = 'none';
1926+
}
1927+
}
1928+
}
1929+
1930+
function handleTUFROGChange(selectElem) {
1931+
// If user picks TUF or ROG, show the popup alert
1932+
if (selectElem.value === 'TUF' || selectElem.value === 'ROG') {
1933+
alert("The TUF/ROG Build will only apply if a compatible TUF firmware image is available. Otherwise, the Pure Build will be used.");
1934+
}
1935+
1936+
// Show or hide the "if available" text next to the relevant dropdown
1937+
if (selectElem.id === 'rogFWBuildType') {
1938+
let rogMsgSpan = document.getElementById('rogFWBuildTypeAvailMsg');
1939+
if (selectElem.value === 'ROG') {
1940+
rogMsgSpan.style.display = 'inline-block';
1941+
} else {
1942+
rogMsgSpan.style.display = 'none';
1943+
}
1944+
}
1945+
else if (selectElem.id === 'tuffFWBuildType') {
1946+
let tufMsgSpan = document.getElementById('tuffFWBuildTypeAvailMsg');
1947+
if (selectElem.value === 'TUF') {
1948+
tufMsgSpan.style.display = 'inline-block';
1949+
} else {
1950+
tufMsgSpan.style.display = 'none';
1951+
}
1952+
}
1953+
}
1954+
19051955
function initializeCollapsibleSections()
19061956
{
19071957
if (typeof jQuery !== 'undefined')
@@ -2303,20 +2353,28 @@ function initializeCollapsibleSections()
23032353
<tr id="rogFWBuildRow">
23042354
<td style="text-align: left;"><label for="rogFWBuildType">ROG F/W Build Type</label></td>
23052355
<td>
2306-
<select id="rogFWBuildType" name="rogFWBuildType" style="width: 20%;">
2356+
<select id="rogFWBuildType" name="rogFWBuildType" style="width: 20%;" onchange="handleTUFROGChange(this)">
23072357
<option value="ROG">ROG</option>
23082358
<option value="Pure">Pure</option>
23092359
</select>
2310-
</td>
2360+
<span id="rogFWBuildTypeAvailMsg"
2361+
style="margin-left:10px; display:none; font-size:12px; font-weight:bolder;">
2362+
Note: Only if available
2363+
</span>
2364+
</td>
23112365
</tr>
23122366
<tr id="tuffFWBuildRow">
23132367
<td style="text-align: left;"><label for="tuffFWBuildType">TUF F/W Build Type</label></td>
23142368
<td>
2315-
<select id="tuffFWBuildType" name="tuffFWBuildType" style="width: 20%;">
2369+
<select id="tuffFWBuildType" name="tuffFWBuildType" style="width: 20%;" onchange="handleTUFROGChange(this)">
23162370
<option value="TUF">TUF</option>
23172371
<option value="Pure">Pure</option>
23182372
</select>
2319-
</td>
2373+
<span id="tuffFWBuildTypeAvailMsg"
2374+
style="margin-left:10px; display:none; font-size:12px; font-weight:bolder;">
2375+
Note: Only if available
2376+
</span>
2377+
</td>
23202378
</tr>
23212379
<tr>
23222380
<td style="text-align: left;"><label for="emailNotificationsEnabled">Enable F/W Update Email Notifications</label></td>

MerlinAU.sh

Lines changed: 53 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,20 +1659,6 @@ _Migrate_Settings_()
16591659
fi
16601660
}
16611661

1662-
##------------------------------------------##
1663-
## Modified by ExtremeFiretop [2024-Jun-03] ##
1664-
##------------------------------------------##
1665-
# NOTE:
1666-
# ROG upgrades to 3006 codebase should have
1667-
# the ROG option deleted.
1668-
#-----------------------------------------------------------
1669-
if ! "$isGNUtonFW"
1670-
then
1671-
if [ "$fwInstalledBaseVers" -ge 3006 ] && \
1672-
grep -q "^ROGBuild" "$CONFIG_FILE"
1673-
then Delete_Custom_Settings "ROGBuild" ; fi
1674-
fi
1675-
16761662
##------------------------------------------##
16771663
## Modified by ExtremeFiretop [2024-Jan-27] ##
16781664
##------------------------------------------##
@@ -4804,8 +4790,10 @@ _ChangeBuildType_TUF_()
48044790
do
48054791
printf "\n${SEPstr}"
48064792
printf "\nChoose your preferred option for the build type to flash:\n"
4807-
printf "\n ${GRNct}1${NOct}. Original ${REDct}TUF${NOct} themed user interface${NOct}\n"
4808-
printf "\n ${GRNct}2${NOct}. Pure ${GRNct}non-TUF${NOct} themed user interface ${GRNct}(Recommended)${NOct}\n"
4793+
printf "\n ${GRNct}1${NOct}. Original ${REDct}TUF${NOct} themed user interface"
4794+
printf "\n ${REDct}(Applies only if TUF F/W is available; otherwise defaults to Pure Build)${NOct}\n"
4795+
printf "\n ${GRNct}2${NOct}. Pure ${GRNct}non-TUF${NOct} themed user interface"
4796+
printf "\n ${GRNct}(Recommended)${NOct}\n"
48094797
printf "\n ${GRNct}e${NOct}. Exit to Advanced Menu\n"
48104798
printf "${SEPstr}\n"
48114799
printf "[$display_choice] Enter selection: "
@@ -4817,7 +4805,9 @@ _ChangeBuildType_TUF_()
48174805
then doReturnToMenu=true ; break ; fi
48184806

48194807
case $choice in
4820-
1) buildtypechoice="ENABLED" ; break
4808+
1) buildtypechoice="ENABLED"
4809+
printf "${CYANct}\nNote: The TUF Build will only apply if a compatible TUF firmware image is available. Otherwise, the Pure Build will be used.${NOct}\n"
4810+
break
48214811
;;
48224812
2) buildtypechoice="DISABLED" ; break
48234813
;;
@@ -4864,8 +4854,10 @@ _ChangeBuildType_ROG_()
48644854
do
48654855
printf "\n${SEPstr}"
48664856
printf "\nChoose your preferred option for the build type to flash:\n"
4867-
printf "\n ${GRNct}1${NOct}. Original ${REDct}ROG${NOct} themed user interface${NOct}\n"
4868-
printf "\n ${GRNct}2${NOct}. Pure ${GRNct}non-ROG${NOct} themed user interface ${GRNct}(Recommended)${NOct}\n"
4857+
printf "\n ${GRNct}1${NOct}. Original ${REDct}ROG${NOct} themed user interface"
4858+
printf "\n ${REDct}(Applies only if ROG F/W is available; otherwise defaults to Pure Build)${NOct}\n"
4859+
printf "\n ${GRNct}2${NOct}. Pure ${GRNct}non-ROG${NOct} themed user interface"
4860+
printf "\n ${GRNct}(Recommended)${NOct}\n"
48694861
printf "\n ${GRNct}e${NOct}. Exit to Advanced Menu\n"
48704862
printf "${SEPstr}\n"
48714863
printf "[$display_choice] Enter selection: "
@@ -4877,7 +4869,9 @@ _ChangeBuildType_ROG_()
48774869
then doReturnToMenu=true ; break ; fi
48784870

48794871
case $choice in
4880-
1) buildtypechoice="ENABLED" ; break
4872+
1) buildtypechoice="ENABLED"
4873+
printf "${CYANct}\nNote: The ROG Build will only apply if a compatible ROG firmware image is available. Otherwise, the Pure Build will be used.${NOct}\n"
4874+
break
48814875
;;
48824876
2) buildtypechoice="DISASLED" ; break
48834877
;;
@@ -9167,21 +9161,41 @@ then
91679161
_ReleaseLock_ ; exit 0
91689162
fi
91699163

9170-
currentBackupOption="$(Get_Custom_Setting "FW_Auto_Backupmon")"
9171-
if [ -f "/jffs/scripts/backupmon.sh" ]
9172-
then
9173-
# If setting is empty, add it to the configuration file #
9174-
if [ "$currentBackupOption" = "TBD" ]
9175-
then
9176-
Update_Custom_Settings FW_Auto_Backupmon "ENABLED"
9177-
fi
9178-
else
9179-
# If the configuration setting exists, delete it #
9180-
if [ "$currentBackupOption" != "TBD" ]
9181-
then
9182-
Delete_Custom_Settings "FW_Auto_Backupmon"
9164+
##---------------------------------------##
9165+
## Added by ExtremeFiretop [2025-Feb-08] ##
9166+
##---------------------------------------##
9167+
_CheckAndSetBackupOption_() {
9168+
local currentBackupOption
9169+
currentBackupOption="$(Get_Custom_Setting "FW_Auto_Backupmon")"
9170+
if [ -f "/jffs/scripts/backupmon.sh" ]; then
9171+
# If setting is empty, add it to the configuration file #
9172+
if [ "$currentBackupOption" = "TBD" ]; then
9173+
Update_Custom_Settings FW_Auto_Backupmon "ENABLED"
9174+
fi
9175+
else
9176+
# If the configuration setting exists, delete it #
9177+
if [ "$currentBackupOption" != "TBD" ]; then
9178+
Delete_Custom_Settings "FW_Auto_Backupmon"
9179+
fi
91839180
fi
9184-
fi
9181+
}
9182+
9183+
##---------------------------------------##
9184+
## Added by ExtremeFiretop [2025-Feb-08] ##
9185+
##---------------------------------------##
9186+
_SetDefaultBuildType_() {
9187+
if echo "$PRODUCT_ID" | grep -q "^TUF-"
9188+
then
9189+
if [ "$(Get_Custom_Setting "TUFBuild")" = "TBD" ]
9190+
then Update_Custom_Settings "TUFBuild" "DISABLED"
9191+
fi
9192+
elif echo "$PRODUCT_ID" | grep -q "^GT-"
9193+
then
9194+
if [ "$(Get_Custom_Setting "ROGBuild")" = "TBD" ]
9195+
then Update_Custom_Settings "ROGBuild" "DISABLED"
9196+
fi
9197+
fi
9198+
}
91859199

91869200
##-------------------------------------##
91879201
## Added by Martinski W. [2025-Jan-05] ##
@@ -10113,11 +10127,7 @@ _AdvancedOptionsMenu_()
1011310127
;;
1011410128
bt) if echo "$PRODUCT_ID" | grep -q "^TUF-"
1011510129
then _ChangeBuildType_TUF_
10116-
elif [ "$fwInstalledBaseVers" -le 3004 ] && \
10117-
echo "$PRODUCT_ID" | grep -q "^GT-"
10118-
then _ChangeBuildType_ROG_
10119-
elif [ "$fwInstalledBaseVers" -ge 3006 ] && "$isGNUtonFW" && \
10120-
echo "$PRODUCT_ID" | grep -q "^GT-"
10130+
elif echo "$PRODUCT_ID" | grep -q "^GT-"
1012110131
then _ChangeBuildType_ROG_
1012210132
else _InvalidMenuSelection_
1012310133
fi
@@ -10288,6 +10298,10 @@ _DoInitializationStartup_()
1028810298
_AutoStartupHook_ create 2>/dev/null
1028910299
_AutoServiceEvent_ create 2>/dev/null
1029010300
fi
10301+
10302+
_CheckAndSetBackupOption_
10303+
_SetDefaultBuildType_
10304+
1029110305
}
1029210306

1029310307
FW_InstalledVersion="$(_GetCurrentFWInstalledLongVersion_)"

0 commit comments

Comments
 (0)