-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathota.sh
executable file
·21 lines (20 loc) · 950 Bytes
/
ota.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
# Automatic OTA Script
# Copyright (C) 2023 PixelBlaster-OS
VERSION="6.3"
DEVICE_NAME=$1
ZIP_NAME=$2
ID=$(md5sum $ZIP_NAME | awk '{print $1}')
Date=$(grep "ro.build.date.utc=" out/target/product/$DEVICE_NAME/system/build.prop | cut -d "=" -f 2)
Size=$(wc -c $ZIP_NAME | awk '{print $1}')
git clone https://github.com/PixelBlaster-releases/$DEVICE_NAME
cp $ZIP_NAME $DEVICE_NAME/
cd $DEVICE_NAME
OTA_URL=$(gh release create v$VERSION -n "" -t "PixelBlaster v$VERSION | $DEVICE_NAME" $ZIP_NAME)
OTA_JSON='{\n"response": [\n{\n"datetime": %s,\n"filename": "%s",\n"id": "%s", \n"romtype": "OFFICIAL", \n"size": %s, \n"url": "https://github.com/PixelBlaster-Releases/%s/releases/download/v%s/%s", \n"version": "%s"\n}\n ]\n}'
printf "$OTA_JSON" "$Date" "$ZIP_NAME" "$ID" "$Size" "$DEVICE_NAME" "$VERSION" "$ZIP_NAME" "$VERSION" >ota.json
git add ota.json
git commit -m "OTA for $DEVICE_NAME"
git push
cd ..
rm -rf $DEVICE_NAME