Skip to content

Commit 1a57147

Browse files
Additional Patches to Webs_Updates
Additional Patches to Webs_Updates Reimplement the use of the $USE_BETA_WEIGHT
1 parent 9e4a6fa commit 1a57147

File tree

2 files changed

+30
-12
lines changed

2 files changed

+30
-12
lines changed

MerlinAU.sh

Lines changed: 17 additions & 9 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-23
7+
# Last Modified: 2025-Jul-24
88
###################################################################
99
set -u
1010

@@ -787,7 +787,7 @@ _GetFirmwareVariantFromRouter_()
787787
}
788788

789789
##-------------------------------------------##
790-
## Modified by ExtremeFiretop [2025-July-23] ##
790+
## Modified by ExtremeFiretop [2025-July-24] ##
791791
##-------------------------------------------##
792792
_FWVersionStrToNum_()
793793
{
@@ -797,17 +797,25 @@ _FWVersionStrToNum_()
797797
USE_BETA_WEIGHT="$(Get_Custom_Setting FW_Allow_Beta_Production_Up)"
798798

799799
local verNum verStr="$1"
800-
local fwBasecodeVers="" numOfFields buildDigits isBeta=0 prodFlag
800+
local fwBasecodeVers="" numOfFields buildDigits isBeta=0 prodFlag tagRank=2
801+
local stableRank=2 betaRank=1 alphaRank=0
802+
803+
# If beta weight is NOT enabled, all tags get the same rank (0)
804+
if [ "$USE_BETA_WEIGHT" != "ENABLED" ]
805+
then
806+
stableRank=0 ; betaRank=0 ; alphaRank=0
807+
fi
808+
tagRank="$stableRank"
801809

802810
#--------------------------------------------------------------
803811
# Handle any 'alpha/beta' in the version string to be sure
804812
# that we always get good numerical values for comparison.
805813
#--------------------------------------------------------------
806814
if echo "$verStr" | grep -qiE '(alpha|beta)'
807815
then
808-
isBeta=1
809-
# Adjust weight value if "Beta-to-Production" update is enabled #
810-
[ "$USE_BETA_WEIGHT" = "ENABLED" ]
816+
if echo "$verStr" | grep -qi 'alpha'; then tagRank="$alphaRank" ; isBeta=1
817+
elif echo "$verStr" | grep -qi 'beta' ; then tagRank="$betaRank" ; isBeta=1
818+
fi
811819

812820
# Replace '.alpha|.beta' and anything following it with ".0" #
813821
verStr="$(echo "$verStr" | sed 's/[.][Aa]lpha.*/.0/ ; s/[.][Bb]eta.*/.0/')"
@@ -836,13 +844,13 @@ _FWVersionStrToNum_()
836844
buildDigits="$(echo "$verStr" | sed -n 's/.*[^0-9]\([0-9]\+\)$/\1/p')"
837845
buildDigits=$(printf "%02d" "${buildDigits:-0}")
838846

839-
# Production flag: 1 = prod, 0 = beta/alpha
840-
prodFlag="$((1 - isBeta))"
847+
# Production/Beta/Alpha weight digit
848+
prodFlag="$tagRank"
841849

842850
# Strip the non-numeric tail so we feed only dotted numbers to awk
843851
verStr="$(echo "$verStr" | sed 's/[^0-9.]*$//')"
844852

845-
# Core numeric conversion (Major Minor Patch) + build suffix + prod flag
853+
# Core numeric conversion (Major Minor Patch) + build suffix + tag weight
846854
verNum="$(echo "$verStr" | awk -F'.' '{printf ("%d%02d%02d\n", $1,$2,$3);}')${buildDigits}${prodFlag}"
847855

848856
# Now prepend the F/W Basecode version #

gnuton_webs_update.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
readonly SCRIPT_VERSTAG="25070312"
3+
readonly SCRIPT_VERSTAG="25072411"
44

55
wget_options="-q -t 2 -T 30"
66

@@ -20,8 +20,10 @@ fi
2020
current_base=$(nvram get firmver | sed "s/\.//g")
2121
current_firm=$(nvram get buildno | cut -d. -f1)
2222
current_buildno=$(nvram get buildno | cut -d. -f2)
23-
#Extract extendno, subtract value by 1 if it contains "alpha/beta", remove all other values such as "_rog" or "-g*"
24-
current_extendno="$(nvram get extendno | awk -F'[_-]' '{n=$1} /[aA]lpha|[bB]eta/{n--} END{print n}')"
23+
current_extendno="$(nvram get extendno | awk -F'[_-]' '{print $1}')"
24+
current_gnuton="$(nvram get extendno | sed -n 's/.*gnuton\([0-9]\+\).*/\1/p')"
25+
[ -z "$current_gnuton" ] && current_gnuton=0
26+
echo "$(nvram get extendno)" | grep -qiE 'beta|alpha' && current_is_beta=1 || current_is_beta=0
2527

2628
# get firmware information
2729
model=$(nvram get productid)
@@ -50,6 +52,10 @@ else
5052
extendno=$(echo $extendno | sed s/#.*//;)
5153
lextendno=$(echo $extendno | sed s/-g.*//;)
5254
55+
new_gnuton="$(echo $extendno | sed -n 's/.*gnuton\([0-9]\+\).*/\1/p')"
56+
[ -z "$new_gnuton" ] && new_gnuton=0
57+
echo "$extendno" | grep -qiE 'beta|alpha' && new_is_beta=1 || new_is_beta=0
58+
5359
nvram set webs_state_info=${firmbase}_${firmver}_${buildno}_${extendno}
5460
5561
rm -f /tmp/wlan_update.*
@@ -72,6 +78,10 @@ else
7278
newfirm=1
7379
elif [ "$current_base" -eq "$firmbase" ] && [ "$current_firm" -eq "$firmver" ] && [ "$current_buildno" -eq "$buildno" ] && [ "$current_extendno" -lt "$lextendno" ]; then
7480
newfirm=1
81+
elif [ "$current_base" -eq "$firmbase" ] && [ "$current_firm" -eq "$firmver" ] && [ "$current_buildno" -eq "$buildno" ] && [ "$current_extendno" -eq "$lextendno" ] && [ "$current_gnuton" -lt "$new_gnuton" ]; then
82+
newfirm=1
83+
elif [ "$current_base" -eq "$firmbase" ] && [ "$current_firm" -eq "$firmver" ] && [ "$current_buildno" -eq "$buildno" ] && [ "$current_extendno" -eq "$lextendno" ] && [ "$current_gnuton" -eq "$new_gnuton" ] && [ "$current_is_beta" -eq 1 ] && [ "$new_is_beta" -eq 0 ]; then
84+
newfirm=1
7585
else
7686
newfirm=0
7787
fi

0 commit comments

Comments
 (0)