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# ##################################################################
99set -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 #
0 commit comments