-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·61 lines (52 loc) · 2.89 KB
/
release.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
# Remember to bump the app versionCode and versionName in app/build.grade before running this
# This script assumes you have router-rescue-signing-key.jks in the project root
# prereleases=$(curl https://api.github.com/repos/althea-net/althea-firmware/releases)
#
# name=$(jq '.[0].name' <<< $prereleases);
# name="${name%\"}"
# name="${name#\"}"
#
# echo $name;
#
# sed -i "s/Reflash \(\w*\)[^-]*\(.*\)\"/Reflash \1 $name\2\"/g" app/src/main/assets/pre-release.config
# sed -i "s/Reflash\(.*\w\)-/Reflash\1 -/g" app/src/main/assets/pre-release.config
#
# if test $# -lt 1; then
# assets=$(jq '.[0].assets_url' <<< $prereleases);
# assets="${assets%\"}"
# assets="${assets#\"}"
#
# curl $assets | jq '.[].browser_download_url' | xargs -I {} wget {};
#
# # mv openwrt-ipq40xx-linksys_ea6350v3-squashfs-sysupgrade.bin app/src/main/assets/ea6350-prerelease.bin
# mv *openwrt-ipq40xx-glinet_gl-b1300-squashfs-sysupgrade.bin app/src/main/assets/glb1300-prerelease.bin
# mv *openwrt-ar71xx-generic-mynet-n750-squashfs-sysupgrade.bin app/src/main/assets/n750-prerelease.bin
# # mv openwrt-ar71xx-generic-mynet-n600-squashfs-sysupgrade.bin app/src/main/assets/n600-prerelease.bin
# # mv openwrt-mvebu-cortexa9-linksys-wrt3200acm-squashfs-sysupgrade.bin app/src/main/assets/wrt3200acm-prerelease.bin
# # mv openwrt-mvebu-cortexa9-linksys-wrt32x-squashfs-sysupgrade.bin app/src/main/assets/wrt32x-prerelease.bin
# fi
stable=$(curl https://api.github.com/repos/althea-net/rita-firmware/releases/latest);
name=$(jq '.name' <<< $stable);
name="${name%\"}"
name="${name#\"}"
sed -i "s/Reflash \(\w*\)[^-]*\(.*\)\"/Reflash \1 $name\2\"/g" app/src/main/assets/stable.config
sed -i "s/Reflash\(.*\w\)-/Reflash\1 -/g" app/src/main/assets/stable.config
if test $# -lt 1; then
assets=$(jq '.assets_url' <<< $stable);
assets="${assets%\"}"
assets="${assets#\"}"
assets="${assets}?per_page=100"
curl $assets | jq '.[].browser_download_url' | xargs -P 100 -I {} wget --no-verbose {};
mv hawk-managed-*-openwrt-ipq40xx-*-linksys_ea6350v3-squashfs-sysupgrade.bin app/src/main/assets/ea6350.bin
mv hawk-managed-*-openwrt-ipq40xx-mikrotik-mikrotik_hap-ac3-squashfs-sysupgrade.bin app/src/main/assets/hapac3.bin
mv hawk-managed-*-openwrt-ipq40xx-mikrotik-mikrotik_hap-ac2-squashfs-sysupgrade.bin app/src/main/assets/hapac2.bin
mv hawk-managed-*-openwrt-mvebu-cortexa9-linksys_wrt3200acm-squashfs-sysupgrade.bin app/src/main/assets/wrt3200acm.bin
mv hawk-managed-*-openwrt-mvebu-cortexa9-linksys_wrt32x-squashfs-sysupgrade.bin app/src/main/assets/wrt32x.bin
rm *openwrt*
fi
./gradlew build
RELEASE_DIR=app/build/outputs/apk/release
rm $RELEASE_DIR/app-release-unsigned-aligned.apk
zipalign -v -p 4 $RELEASE_DIR/app-release-unsigned.apk $RELEASE_DIR/app-release-unsigned-aligned.apk
apksigner sign --ks router-rescue-signing-key.jks --out $RELEASE_DIR/app-signed-release.apk $RELEASE_DIR/app-release-unsigned-aligned.apk