diff --git a/MerlinAU.asp b/MerlinAU.asp index aa38b036..2ca78293 100644 --- a/MerlinAU.asp +++ b/MerlinAU.asp @@ -1264,6 +1264,7 @@ function InitializeFields() // Call the visibility handler // handleROGFWBuildTypeVisibility(); + updateTUFROGAvailText(); console.log("Initializing was completed successfully."); } else @@ -1902,6 +1903,55 @@ document.addEventListener("DOMContentLoaded", function() FormatFirmwareVersion(); }); +function updateTUFROGAvailText() { + // For ROG + let rogSelect = document.getElementById('rogFWBuildType'); + let rogMsgSpan = document.getElementById('rogFWBuildTypeAvailMsg'); + if (rogSelect && rogMsgSpan) { + if (rogSelect.value === 'ROG') { + rogMsgSpan.style.display = 'inline-block'; + } else { + rogMsgSpan.style.display = 'none'; + } + } + + // For TUF + let tufSelect = document.getElementById('tuffFWBuildType'); + let tufMsgSpan = document.getElementById('tuffFWBuildTypeAvailMsg'); + if (tufSelect && tufMsgSpan) { + if (tufSelect.value === 'TUF') { + tufMsgSpan.style.display = 'inline-block'; + } else { + tufMsgSpan.style.display = 'none'; + } + } +} + +function handleTUFROGChange(selectElem) { + // If user picks TUF or ROG, show the popup alert + if (selectElem.value === 'TUF' || selectElem.value === 'ROG') { + alert("The TUF/ROG Build will only apply if a compatible TUF firmware image is available. Otherwise, the Pure Build will be used."); + } + + // Show or hide the "if available" text next to the relevant dropdown + if (selectElem.id === 'rogFWBuildType') { + let rogMsgSpan = document.getElementById('rogFWBuildTypeAvailMsg'); + if (selectElem.value === 'ROG') { + rogMsgSpan.style.display = 'inline-block'; + } else { + rogMsgSpan.style.display = 'none'; + } + } + else if (selectElem.id === 'tuffFWBuildType') { + let tufMsgSpan = document.getElementById('tuffFWBuildTypeAvailMsg'); + if (selectElem.value === 'TUF') { + tufMsgSpan.style.display = 'inline-block'; + } else { + tufMsgSpan.style.display = 'none'; + } + } +} + function initializeCollapsibleSections() { if (typeof jQuery !== 'undefined') @@ -2303,20 +2353,28 @@ function initializeCollapsibleSections() - - + + - - + + diff --git a/MerlinAU.sh b/MerlinAU.sh index 1285649f..49799994 100644 --- a/MerlinAU.sh +++ b/MerlinAU.sh @@ -1659,20 +1659,6 @@ _Migrate_Settings_() fi } -##------------------------------------------## -## Modified by ExtremeFiretop [2024-Jun-03] ## -##------------------------------------------## -# NOTE: -# ROG upgrades to 3006 codebase should have -# the ROG option deleted. -#----------------------------------------------------------- -if ! "$isGNUtonFW" -then - if [ "$fwInstalledBaseVers" -ge 3006 ] && \ - grep -q "^ROGBuild" "$CONFIG_FILE" - then Delete_Custom_Settings "ROGBuild" ; fi -fi - ##------------------------------------------## ## Modified by ExtremeFiretop [2024-Jan-27] ## ##------------------------------------------## @@ -4803,8 +4789,10 @@ _ChangeBuildType_TUF_() do printf "\n${SEPstr}" printf "\nChoose your preferred option for the build type to flash:\n" - printf "\n ${GRNct}1${NOct}. Original ${REDct}TUF${NOct} themed user interface${NOct}\n" - printf "\n ${GRNct}2${NOct}. Pure ${GRNct}non-TUF${NOct} themed user interface ${GRNct}(Recommended)${NOct}\n" + printf "\n ${GRNct}1${NOct}. Original ${REDct}TUF${NOct} themed user interface" + printf "\n ${REDct}(Applies only if TUF F/W is available; otherwise defaults to Pure Build)${NOct}\n" + printf "\n ${GRNct}2${NOct}. Pure ${GRNct}non-TUF${NOct} themed user interface" + printf "\n ${GRNct}(Recommended)${NOct}\n" printf "\n ${GRNct}e${NOct}. Exit to Advanced Menu\n" printf "${SEPstr}\n" printf "[$display_choice] Enter selection: " @@ -4816,7 +4804,9 @@ _ChangeBuildType_TUF_() then doReturnToMenu=true ; break ; fi case $choice in - 1) buildtypechoice="ENABLED" ; break + 1) buildtypechoice="ENABLED" + 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" + break ;; 2) buildtypechoice="DISABLED" ; break ;; @@ -4863,8 +4853,10 @@ _ChangeBuildType_ROG_() do printf "\n${SEPstr}" printf "\nChoose your preferred option for the build type to flash:\n" - printf "\n ${GRNct}1${NOct}. Original ${REDct}ROG${NOct} themed user interface${NOct}\n" - printf "\n ${GRNct}2${NOct}. Pure ${GRNct}non-ROG${NOct} themed user interface ${GRNct}(Recommended)${NOct}\n" + printf "\n ${GRNct}1${NOct}. Original ${REDct}ROG${NOct} themed user interface" + printf "\n ${REDct}(Applies only if ROG F/W is available; otherwise defaults to Pure Build)${NOct}\n" + printf "\n ${GRNct}2${NOct}. Pure ${GRNct}non-ROG${NOct} themed user interface" + printf "\n ${GRNct}(Recommended)${NOct}\n" printf "\n ${GRNct}e${NOct}. Exit to Advanced Menu\n" printf "${SEPstr}\n" printf "[$display_choice] Enter selection: " @@ -4876,7 +4868,9 @@ _ChangeBuildType_ROG_() then doReturnToMenu=true ; break ; fi case $choice in - 1) buildtypechoice="ENABLED" ; break + 1) buildtypechoice="ENABLED" + 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" + break ;; 2) buildtypechoice="DISASLED" ; break ;; @@ -9166,21 +9160,41 @@ then _ReleaseLock_ ; exit 0 fi -currentBackupOption="$(Get_Custom_Setting "FW_Auto_Backupmon")" -if [ -f "/jffs/scripts/backupmon.sh" ] -then - # If setting is empty, add it to the configuration file # - if [ "$currentBackupOption" = "TBD" ] - then - Update_Custom_Settings FW_Auto_Backupmon "ENABLED" - fi -else - # If the configuration setting exists, delete it # - if [ "$currentBackupOption" != "TBD" ] - then - Delete_Custom_Settings "FW_Auto_Backupmon" +##---------------------------------------## +## Added by ExtremeFiretop [2025-Feb-08] ## +##---------------------------------------## +_CheckAndSetBackupOption_() { + local currentBackupOption + currentBackupOption="$(Get_Custom_Setting "FW_Auto_Backupmon")" + if [ -f "/jffs/scripts/backupmon.sh" ]; then + # If setting is empty, add it to the configuration file # + if [ "$currentBackupOption" = "TBD" ]; then + Update_Custom_Settings FW_Auto_Backupmon "ENABLED" + fi + else + # If the configuration setting exists, delete it # + if [ "$currentBackupOption" != "TBD" ]; then + Delete_Custom_Settings "FW_Auto_Backupmon" + fi fi -fi +} + +##---------------------------------------## +## Added by ExtremeFiretop [2025-Feb-08] ## +##---------------------------------------## +_SetDefaultBuildType_() { + if echo "$PRODUCT_ID" | grep -q "^TUF-" + then + if [ "$(Get_Custom_Setting "TUFBuild")" = "TBD" ] + then Update_Custom_Settings "TUFBuild" "DISABLED" + fi + elif echo "$PRODUCT_ID" | grep -q "^GT-" + then + if [ "$(Get_Custom_Setting "ROGBuild")" = "TBD" ] + then Update_Custom_Settings "ROGBuild" "DISABLED" + fi + fi +} ##-------------------------------------## ## Added by Martinski W. [2025-Jan-05] ## @@ -10112,11 +10126,7 @@ _AdvancedOptionsMenu_() ;; bt) if echo "$PRODUCT_ID" | grep -q "^TUF-" then _ChangeBuildType_TUF_ - elif [ "$fwInstalledBaseVers" -le 3004 ] && \ - echo "$PRODUCT_ID" | grep -q "^GT-" - then _ChangeBuildType_ROG_ - elif [ "$fwInstalledBaseVers" -ge 3006 ] && "$isGNUtonFW" && \ - echo "$PRODUCT_ID" | grep -q "^GT-" + elif echo "$PRODUCT_ID" | grep -q "^GT-" then _ChangeBuildType_ROG_ else _InvalidMenuSelection_ fi @@ -10287,6 +10297,10 @@ _DoInitializationStartup_() _AutoStartupHook_ create 2>/dev/null _AutoServiceEvent_ create 2>/dev/null fi + + _CheckAndSetBackupOption_ + _SetDefaultBuildType_ + } FW_InstalledVersion="$(_GetCurrentFWInstalledLongVersion_)"