Skip to content

Commit 8cc7335

Browse files
Allow Updates to Webs_Update Script
Allow Updates to Webs_Update Script
1 parent 1a57147 commit 8cc7335

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

MerlinAU.sh

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2651,6 +2651,18 @@ _GetDLScriptVersion_()
26512651
return 0
26522652
}
26532653

2654+
##---------------------------------------##
2655+
## Added by ExtremeFiretop [2025-Jul-24] ##
2656+
##---------------------------------------##
2657+
_GetScriptVerstag_()
2658+
{
2659+
if [ $# -eq 0 ] || [ -z "$1" ] || [ ! -s "$1" ]
2660+
then echo 0 ; return 1 ; fi
2661+
sed -n 's/.*SCRIPT_VERSTAG="\([0-9]\+\)".*/\1/p' "$1" | tail -n1
2662+
[ $? -ne 0 ] && echo 0
2663+
}
2664+
2665+
26542666
##----------------------------------------##
26552667
## Modified by Martinski W. [2025-Feb-15] ##
26562668
##----------------------------------------##
@@ -11065,9 +11077,9 @@ _DoInitializationStartup_()
1106511077
_SetDefaultBuildType_
1106611078
}
1106711079

11068-
##-------------------------------------##
11069-
## Added by Martinski W. [2025-Jul-03] ##
11070-
##-------------------------------------##
11080+
##-------------------------------------------##
11081+
## Modified by ExtremeFiretop [2025-July-24] ##
11082+
##-------------------------------------------##
1107111083
#######################################################################
1107211084
# TEMPORARY hack to check if the Gnuton F/W built-in 'webs_update.sh'
1107311085
# script is the most recent version that includes required fixes.
@@ -11079,25 +11091,33 @@ _DoInitializationStartup_()
1107911091
_Gnuton_Check_Webs_Update_Script_()
1108011092
{
1108111093
if ! "$isGNUtonFW" || \
11082-
! "$checkWebsUpdateScriptForGnuton" || \
11083-
grep -qE 'SCRIPT_VERSTAG="[0-9]+"' "$FW_UpdateCheckScript"
11094+
! "$checkWebsUpdateScriptForGnuton"
1108411095
then
1108511096
checkWebsUpdateScriptForGnuton=false
1108611097
return 0
1108711098
fi
1108811099

1108911100
local theWebsUpdateFile="webs_update.sh"
1109011101
local fixedWebsUpdateFilePath="${SETTINGS_DIR}/$theWebsUpdateFile"
11102+
local localVerstag=0 remoteVerstag=0
11103+
11104+
#Get local VERSTAG (if any) #
11105+
localVerstag="$(_GetScriptVerstag_ "$FW_UpdateCheckScript")"
11106+
[ -z "$localVerstag" ] && localVerstag=0
1109111107

11092-
## Get the fixed version of the script targeted for Gnuton F/W ##
11108+
# Get the fixed version of the script targeted for Gnuton F/W #
1109311109
if _CurlFileDownload_ "gnuton_webs_update.sh" "$fixedWebsUpdateFilePath"
1109411110
then
1109511111
chmod 755 "$fixedWebsUpdateFilePath"
11112+
remoteVerstag="$(_GetScriptVerstag_ "$fixedWebsUpdateFilePath")"
11113+
[ -z "$remoteVerstag" ] && remoteVerstag=0
1109611114
else
1109711115
return 1 #NOT available so do nothing#
1109811116
fi
1109911117

11100-
if ! diff "$FW_UpdateCheckScript" "$fixedWebsUpdateFilePath" >/dev/null 2>&1
11118+
# Only (re)bind if remote is newer OR files differ #
11119+
if [ "$remoteVerstag" -gt "$localVerstag" ] || \
11120+
! diff "$FW_UpdateCheckScript" "$fixedWebsUpdateFilePath" >/dev/null 2>&1
1110111121
then
1110211122
umount "$FW_UpdateCheckScript" 2>/dev/null
1110311123
mount -o bind "$fixedWebsUpdateFilePath" "$FW_UpdateCheckScript"

0 commit comments

Comments
 (0)