-
Notifications
You must be signed in to change notification settings - Fork 661
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
48 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,54 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -ex | ||
|
||
if [ $# != 1 ];then | ||
echo "Usage: $0 <url to release gsi>" | ||
vers="$1" | ||
|
||
if [ -z "$vers" ];then | ||
echo "Usage: $0 <github version name>" | ||
exit 1 | ||
fi | ||
|
||
umount d || true | ||
rm -Rf s.img s2.img d | ||
|
||
wget "$1" -O - |xz -c -d > s.img | ||
simg2img s.img s2.img | ||
rm -f s.img | ||
mkdir -p d | ||
mount -o loop,ro s2.img d | ||
|
||
timestamp="$(sed -nE 's/ro.product.build.date.utc=(.*)/\1/p' d/system/product/build.prop)" | ||
flavor="$(sed -nE 's/ro.product.product.name=(.*)/\1/p' d/system/product/build.prop)" | ||
umount d | ||
|
||
mkdir -p "$flavor" | ||
echo "$timestamp" >> "$flavor/known_releases" | ||
echo "$timestamp" > "$flavor/date" | ||
echo "$1" > "$flavor/url" | ||
wc -c s2.img |grep -oE '^[0-9]+' > "$flavor/size" | ||
rm -f s2.img | ||
rm -f ota-list.json | ||
minUtc="" | ||
for i in /home/phh/Treble/treble_experimentations/cloud/release/release/220208/*.xz;do | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
# Grab props | ||
unxz -dc $i |strings |grep -E -e ro.system.build.fingerprint= -e ro.build.flavor= -e ro.system.build.date.utc= > tmpprops | ||
|
||
utc=$(sed -n -E -e 's/ro.system.build.date.utc=//p' tmpprops) | ||
flavor=$(sed -n -E -e 's/ro.build.flavor=//p' tmpprops |sed -E 's/-user.*//g') | ||
if echo "$i" |grep -qE secure;then | ||
flavor="$flavor-secure" | ||
elif echo "$i" |grep -qE vndklite;then | ||
flavor="$flavor-vndklite" | ||
fi | ||
|
||
if [ "$minUtc" == "" ] || [ "$utc" -le "$minUtc" ];then | ||
minUtc="$utc" | ||
fi | ||
size="$(du -s "$i" |grep -oE '^[0-9]+')" | ||
url=https://github.com/phhusson/treble_experimentations/releases/download/"$vers"/"$(basename "$i")" | ||
cat >> ota-list.json << EOF | ||
{ "name": "$flavor", "size": $size, "url": "$url"}, | ||
EOF | ||
done | ||
|
||
# Add a stupid entry to not have to remove the trailing `,` | ||
echo '{ "name": "useless", "size": 0, "url": "http://devnull.org"}' >> ota-list.json | ||
|
||
# Optimism | ||
minUtc=$((minUtc-100)) | ||
|
||
cat > ota.json << EOF | ||
{ | ||
"version": "$vers", | ||
"date": "$minUtc", | ||
"variants": [ | ||
EOF | ||
cat ota-list.json >> ota.json | ||
|
||
cat >> ota.json << EOF | ||
] | ||
} | ||
EOF |
sus