Skip to content

Commit 0996bd0

Browse files
Temporary hack for check for Gnuton script
Added a TEMPORARY hack to check if the Gnuton F/W built-in 'webs_update.sh' script is the most recent version that includes required fixes. If not, we temporarily set up a local version so that MerlinAU can continue to work by detecting available F/W version updates.
1 parent c49023a commit 0996bd0

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

MerlinAU.sh

Lines changed: 46 additions & 2 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-Jul-02
7+
# Last Modified: 2025-Jul-03
88
###################################################################
99
set -u
1010

@@ -775,7 +775,7 @@ _GetFirmwareVariantFromRouter_()
775775

776776
##FOR TESTING/DEBUG ONLY##
777777
if false # Change to true for forcing GNUton flag #
778-
then hasGNUtonFW=true ; return 0 ; fi
778+
then echo "true" ; return 0 ; fi
779779
##FOR TESTING/DEBUG ONLY##
780780

781781
# Check if installed F/W NVRAM vars contain "gnuton" #
@@ -11168,6 +11168,50 @@ _DoInitializationStartup_()
1116811168
_SetDefaultBuildType_
1116911169
}
1117011170

11171+
##-------------------------------------##
11172+
## Added by Martinski W. [2025-Jul-03] ##
11173+
##-------------------------------------##
11174+
#######################################################################
11175+
# TEMPORARY hack to check if the Gnuton F/W built-in 'webs_update.sh'
11176+
# script is the most recent version that includes required fixes.
11177+
# If not, we temporarily set up a local version so that MerlinAU
11178+
# can continue to work by detecting available F/W version updates.
11179+
# NOTE:
11180+
# The 'webs_update.sh' MUST have "SCRIPT_VERSTAG" variable defined.
11181+
#######################################################################
11182+
_Gnuton_Check_Webs_Update_Script_()
11183+
{
11184+
if ! "$isGNUtonFW" || \
11185+
! "$checkWebsUpdateScriptForGnuton" || \
11186+
grep -qE 'SCRIPT_VERSTAG="[0-9]+"' "$FW_UpdateCheckScript"
11187+
then
11188+
checkWebsUpdateScriptForGnuton=false
11189+
return 0
11190+
fi
11191+
11192+
local theWebsUpdateFile="webs_update.sh"
11193+
local fixedWebsUpdateFilePath="${SETTINGS_DIR}/$theWebsUpdateFile"
11194+
11195+
## Get the fixed version of the script targeted for Gnuton F/W ##
11196+
if _CurlFileDownload_ "gnuton_webs_update.sh" "$fixedWebsUpdateFilePath"
11197+
then
11198+
chmod 755 "$fixedWebsUpdateFilePath"
11199+
else
11200+
return 1 #NOT available so do nothing#
11201+
fi
11202+
11203+
if ! diff "$FW_UpdateCheckScript" "$fixedWebsUpdateFilePath" >/dev/null 2>&1
11204+
then
11205+
umount "$FW_UpdateCheckScript" 2>/dev/null
11206+
mount -o bind "$fixedWebsUpdateFilePath" "$FW_UpdateCheckScript"
11207+
Say "${YLWct}Set up a fixed version of the \"${theWebsUpdateFile}\" script file.${NOct}"
11208+
fi
11209+
}
11210+
11211+
## Set variable to 'false' to stop the check ##
11212+
checkWebsUpdateScriptForGnuton="$isGNUtonFW"
11213+
_Gnuton_Check_Webs_Update_Script_
11214+
1117111215
FW_InstalledVersion="$(_GetCurrentFWInstalledLongVersion_)"
1117211216
FW_InstalledVerStr="${GRNct}${FW_InstalledVersion}${NOct}"
1117311217
FW_NewUpdateVerInit=TBD

0 commit comments

Comments
 (0)