This repository has been archived by the owner on May 11, 2024. It is now read-only.
forked from JarlPenguin/releases
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathota.sh
41 lines (35 loc) · 1.41 KB
/
ota.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
#!/bin/bash
FULL_HASH=$(sha256sum $finalzip_path)
export postdata="\"$FULL_HASH\": \"$FULL_DL_LINK\""
if [ -e $incremental_zip_path ]; then
INCREMENTAL_HASH=$(sha256sum $incremental_zip_path)
postdata="$postdata, \"$INCREMENTAL_HASH\": \"$INCREMENTAL_DL_LINK\""
fi
if [ -e "$img_path" ]; then
RECOVERY_HASH=$(sha256sum $img_path)
postdata="$postdata, \"$RECOVERY_HASH\": \"$RECOVERY_DL_LINK\""
fi
postdata="{$postdata}"
if wget -O- --post-data "$postdata" "$bigota_push_url" >/dev/null 2>&1; then
echo "--- BIGOTA PUSH FAIL ---"
exit 1
fi
unset postdata
echo "--- BIGOTA PUSH DONE ---"
ota_full_json=$("$ROM_DIR"/vendor/droid-ng/tools/make-ota-json.sh "$finalzip_path")
postdata="\"oldIncr\":\"$ota_incr_id\", \"codename\": \"$device\", \"fullOta\": \"$ota_full_json\""
if [ "${generate_incremental}" == "true" ] && [ -e "${incremental_zip_path}" ] && [ "${old_target_files_exists}" == "true" ]; then
ota_incr_json=$("$ROM_DIR"/vendor/droid-ng/tools/make-incr-json.sh "$incremental_zip_path") || echo "Failed to create ota json" && return 1
postdata=$postdata", \"incrOta\": \"$ota_incr_json\""
fi
postdata="$postdata}"
echo "--- OTA JSON ---"
echo "$postdata"
postdata="{\"secret\":\"$OTA_SECRET\", $postdata}"
echo "--- OTA PUSH LOG ---"
wget -O- --post-data "$postdata" "$ota_base_url"/v1/registerBuild
if [ $? -ne 0 ]; then
echo "--- OTA PUSH FAIL ---"
exit 1
fi
echo "--- OTA PUSH DONE ---"