Skip to content

Commit dcaff15

Browse files
Merge pull request #506 from Martinski4GitHub/dev
Minor cleanup
2 parents 8008a00 + 52e79ab commit dcaff15

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

MerlinAU.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -797,10 +797,10 @@ _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 tagRank=2
801-
local stableRank=2 betaRank=1 alphaRank=0
800+
local fwBasecodeVers="" numOfFields prodFlag tagRank
801+
local stableRank=2 betaRank=1 alphaRank=0 buildDigits=0
802802

803-
# If beta weight is NOT enabled, all tags get the same rank (0)
803+
# If beta weight is NOT enabled, all tags get the same rank (0) #
804804
if [ "$USE_BETA_WEIGHT" != "ENABLED" ]
805805
then
806806
stableRank=0 ; betaRank=0 ; alphaRank=0
@@ -813,8 +813,8 @@ _FWVersionStrToNum_()
813813
#--------------------------------------------------------------
814814
if echo "$verStr" | grep -qiE '(alpha|beta)'
815815
then
816-
if echo "$verStr" | grep -qi 'alpha'; then tagRank="$alphaRank" ; isBeta=1
817-
elif echo "$verStr" | grep -qi 'beta' ; then tagRank="$betaRank" ; isBeta=1
816+
if echo "$verStr" | grep -qi 'alpha'; then tagRank="$alphaRank"
817+
elif echo "$verStr" | grep -qi 'beta' ; then tagRank="$betaRank"
818818
fi
819819

820820
# Replace '.alpha|.beta' and anything following it with ".0" #
@@ -843,18 +843,19 @@ _FWVersionStrToNum_()
843843
# a non-digit-and-non-dot char before them (e.g. "-gnuton2").
844844
# Plain "388.9.2" should NOT set buildDigits.
845845
#-----------------------------------------------------------
846-
if printf '%s' "$verStr" | grep -q '[^0-9.]'; then
846+
if printf '%s' "$verStr" | grep -q '[^0-9.]'
847+
then
847848
buildDigits="$(printf '%s' "$verStr" | sed -n 's/^[0-9.]*[^0-9.]\+\([0-9]\+\)$/\1/p')"
848849
fi
849-
buildDigits=$(printf "%02d" "${buildDigits:-0}")
850+
buildDigits="$(printf "%02d" "${buildDigits:-0}")"
850851

851-
# Production/Beta/Alpha weight digit
852+
# Production/Beta/Alpha weight digit #
852853
prodFlag="$tagRank"
853854

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

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

860861
# Now prepend the F/W Basecode version #

0 commit comments

Comments
 (0)