Skip to content

Commit

Permalink
OTA: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Linux4 committed Jan 23, 2021
0 parents commit 5fdf077
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gta4xl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"response": [
{
"datetime": "1611400176",
"filename": "lineage-18.1-20210123-UNOFFICIAL-gta4xl.zip",
"id": "84103ea3dbad0b33f4d837c23112f6e88a2ab1208a830c20410562d2dfad75d9",
"romtype": "UNOFFICIAL",
"size": "746254446",
"url": "https://github.com/Linux4/lineage_OTA/releases/download/20210123/lineage-18.1-20210123-UNOFFICIAL-gta4xl.zip",
"version": "18.1"
}
]
}
13 changes: 13 additions & 0 deletions gta4xlwifi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"response": [
{
"datetime": "1611396947",
"filename": "lineage-18.1-20210123-UNOFFICIAL-gta4xlwifi.zip",
"id": "a48e7fc9b25e6d25bac656fe5e20a721a959614d61d72667c38cbb982d393c8e",
"romtype": "UNOFFICIAL",
"size": "726039326",
"url": "https://github.com/Linux4/lineage_OTA/releases/download/20210123/lineage-18.1-20210123-UNOFFICIAL-gta4xlwifi.zip",
"version": "18.1"
}
]
}
37 changes: 37 additions & 0 deletions otainfo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

if [ -z "$1" ]; then
echo "Usage: $0 <ota zip>"
exit 1
fi

ZIP="$1"

METADATA=$(unzip -p "$ZIP" META-INF/com/android/metadata)

DEVICE=$(echo "$METADATA" | grep pre-device | cut -f2 -d '=' | cut -f1 -d ',')
SDK_LEVEL=$(echo "$METADATA" | grep post-sdk-level | cut -f2 -d '=')
TIMESTAMP=$(echo "$METADATA" | grep post-timestamp | cut -f2 -d '=')

FILENAME=$(basename $ZIP)
DATE=$(echo $FILENAME | cut -f3 -d '-')
ID=$(echo ${TIMESTAMP}${DEVICE}${SDK_LEVEL} | sha256sum | cut -f 1 -d ' ')
SIZE=$(du -b $ZIP | cut -f1 -d ' ')
TYPE=$(echo $FILENAME | cut -f4 -d '-')
VERSION=$(echo $FILENAME | cut -f2 -d '-')

URL="https://github.com/Linux4/lineage_OTA/releases/download/${DATE}/${FILENAME}"

echo "{"
echo " \"response\": ["
echo " {"
echo " \"datetime\": \"$TIMESTAMP\","
echo " \"filename\": \"$FILENAME\","
echo " \"id\": \"$ID\","
echo " \"romtype\": \"$TYPE\","
echo " \"size\": \"$SIZE\","
echo " \"url\": \"$URL\","
echo " \"version\": \"$VERSION\""
echo " }"
echo " ]"
echo "}"

0 comments on commit 5fdf077

Please sign in to comment.