Skip to content

Commit e51806a

Browse files
karliattovdovhanych
authored andcommitted
fix(scripts): update scripts to check also new releases JSON
1 parent ed52c70 commit e51806a

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

scripts/check-all-firmware-revisions.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,18 @@ cd "$PARENT_PATH/../firmware" || exit
1313

1414
EXCLUDED_DIR="translations"
1515

16+
IS_LEGACY="false"
17+
1618
for dir in */ ; do
1719
DEVICE=${dir%/}
18-
if [[ $EXCLUDED_DIR == "$DEVICE" ]]; then continue; fi
20+
# TODO: we excude t3w1 until we have releases on it.
21+
if [[ $EXCLUDED_DIR == "$DEVICE" || $DEVICE == "t3w1" ]]; then continue; fi
22+
is_legacy_for_device="$IS_LEGACY"
23+
if [[ "$DEVICE" == "1" || "$DEVICE" == "2" ]]; then
24+
is_legacy_for_device="true"
25+
fi
1926
if [ -d "$dir" ]; then
20-
if ! "$PARENT_PATH/check-firmware-revisions.sh" "$DEVICE" ; then
27+
if ! "$PARENT_PATH/check-firmware-revisions.sh" "$DEVICE" "$is_legacy_for_device" ; then
2128
exit 1
2229
fi;
2330
fi

scripts/check-firmware-revisions.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99

1010
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P )
1111

12-
if [[ $# -ne 1 ]]
12+
if [[ $# -ne 2 ]]
1313
then
14-
echo "must provide 1 argument. $# provided"
14+
echo "must provide 2 argument. $# provided"
1515
exit 1
1616
fi
1717

1818
DEVICE=$1
19+
IS_LEGACY=$2
1920

2021
RELEASES_FOLDER="$PARENT_PATH"/../firmware
2122

@@ -49,7 +50,19 @@ git fetch origin
4950
git checkout "$BRANCH"
5051
git reset "origin/$BRANCH" --hard
5152

52-
DATA=$(jq -r '.[] | .version |= join(".") | .firmware_revision + "%" + .version' < "$RELEASES_FOLDER/$DEVICE"/releases.json)
53+
54+
DATA=""
55+
56+
# When checking legacy "1" and "2" directories we do not check `bitcoinonly` and `universal` directories
57+
# with new format, we only check it for legacy `releases.json`. For the rest we check it for both formats.
58+
if [[ "$IS_LEGACY" == "true" ]]; then
59+
DATA=$(jq -r '.[] | .version |= join(".") | .firmware_revision + "%" + .version' < "$RELEASES_FOLDER/$DEVICE"/releases.json)
60+
else
61+
DATA=$(
62+
jq -r '.[] | .version |= join(".") | .firmware_revision + "%" + .version' < "$RELEASES_FOLDER/$DEVICE"/releases.json
63+
jq -r '.version |= join(".") | .firmware_revision + "%" + .version' "$RELEASES_FOLDER/$DEVICE"/{bitcoinonly,universal}/*.json
64+
)
65+
fi
5366

5467
for ROW in $DATA;
5568
do

0 commit comments

Comments
 (0)