Repository navigation
Expand file tree
/
Copy pathget_artifacts.sh
More file actions
executable file
·51 lines (45 loc) · 1.65 KB
/
Copy pathget_artifacts.sh
File metadata and controls
executable file
·51 lines (45 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
mkdir -p public/assets
cd public/assets
# Remove old firmware files
rm -rf firmware backpack
# Download main ELRS firmware, for each tagged version
mkdir -p firmware
cd firmware
curl -L -o index.json https://artifactory.expresslrs.org/ExpressLRS/index.json
LATEST_RC_TAG=$(jq -r '.tags | keys[] | select(test("-RC[0-9]+$"))' index.json | sort -V | tail -n1)
jq --arg latest_rc "$LATEST_RC_TAG" '.tags |= with_entries(select((.key | test("-RC[0-9]+$") | not) or .key == $latest_rc))' index.json > index.filtered.json
mv index.filtered.json index.json
for HASH in `cat index.json | jq '.tags,.branches | values[]' | sed 's/\"//g' | sort -ru` ; do
curl -L -o firmware.zip "https://artifactory.expresslrs.org/ExpressLRS/$HASH/firmware.zip"
mkdir $HASH
cd $HASH
unzip -q ../firmware.zip
mv firmware/* .
rm -rf firmware
cd ..
rm firmware.zip
done
# Download the published hardware targets into the `firmware` directory
mkdir hardware
cd hardware
curl -L -o hardware.zip https://artifactory.expresslrs.org/ExpressLRS/hardware.zip
unzip -q hardware.zip
rm hardware.zip
# Download backpack firmware, for each tagged version
cd ../..
mkdir -p backpack
cd backpack
curl -L -o index.json https://artifactory.expresslrs.org/Backpack/index.json
for HASH in `cat index.json | jq '.tags,.branches | values[]' | sed 's/"//g' | sort -ru` ; do
curl -L -o firmware.zip "https://artifactory.expresslrs.org/Backpack/$HASH/firmware.zip"
mkdir $HASH
cd $HASH
unzip -q ../firmware.zip
mv firmware/* .
rm -rf firmware
cd ..
rm firmware.zip
done
MASTER=`grep '"master"' index.json | sed 's/.*: "\([^"]*\)".*/\1/'`
cp -r $MASTER/hardware .