-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_geode_syms.sh
executable file
·61 lines (46 loc) · 1.34 KB
/
update_geode_syms.sh
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
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Adds symbol files from the latest Geode releases.
# Requires jq + unzip to be installed.
supported_platforms=( "android32" "android64" )
release_tag="latest"
if ! [[ -z $1 ]]
then
release_tag="tags/$1"
fi
release_url="https://api.github.com/repos/geode-sdk/geode/releases/$release_tag"
# validate a user has jq and unzip installed
if ! [[ -x "$(command -v jq)" ]]
then
echo "error: jq unavailable"
exit 1
fi
if ! [[ -x "$(command -v unzip)" ]]
then
echo "error: unzip unavailable"
exit 1
fi
tempdir=$(mktemp -d -t geode-syms.XXXXXXX)
releases=$(curl -s "$release_url")
for platform in "${supported_platforms[@]}"
do
echo "Processing platform $platform"
download_path="$tempdir/release.zip"
platform_download="$platform.zip"
download_url=$(echo $releases | jq -r --arg platform "$platform_download" '.assets[] | select(.name | contains($platform)) | .browser_download_url')
if [[ -z "$download_url" ]]
then
echo "Skipping platform $platform, no download found"
continue
fi
curl $download_url -Lo $download_path
release_dir="$tempdir/release"
unzip -q $download_path -d $release_dir
# the option messes up jq for some reason, so set it here and then unset
shopt -s nullglob
for sym in $release_dir/*.sym
do
./copy_syms.sh $sym
done
shopt -u nullglob
rm -rf $download_path $release_dir
done