forked from J0SH1X/Lineage-OTA
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
supports argument for device supports arguments for repository list automatically uploads via hub to create github releases and uses them for the download url
- Loading branch information
Showing
1 changed file
with
32 additions
and
20 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,30 +1,42 @@ | ||
#!/bin/bash | ||
|
||
DEVICE=$1 | ||
REPOS="${@:2}" | ||
|
||
d=$(date +%Y%m%d) | ||
oldd=$(grep filename judyln.json | cut -d '-' -f 3) | ||
md5=$(md5sum ../out/target/product/judyln/lineage-18.0-"${d}"-UNOFFICIAL-judyln.zip | cut -d ' ' -f 1) | ||
oldmd5=$(grep '"id"' judyln.json | cut -d':' -f 2) | ||
utc=$(grep ro.build.date.utc ../out/target/product/judyln/system/build.prop | cut -d '=' -f 2) | ||
oldutc=$(grep datetime judyln.json | cut -d ':' -f 2) | ||
size=$(wc -c ../out/target/product/judyln/lineage-18.0-"${d}"-UNOFFICIAL-judyln.zip | cut -d ' ' -f 1) | ||
oldsize=$(grep size judyln.json | cut -d ':' -f 2) | ||
oldurl=$(grep url judyln.json | cut -d ' ' -f 9) | ||
|
||
#Upload the rom to AndroidFileHost | ||
FILENAME=lineage-18.0-"${d}"-UNOFFICIAL-"${DEVICE}".zip | ||
|
||
oldd=$(grep filename $DEVICE.json | cut -d '-' -f 3) | ||
md5=$(md5sum ../out/target/product/$DEVICE/$FILENAME | cut -d ' ' -f 1) | ||
oldmd5=$(grep '"id"' $DEVICE.json | cut -d':' -f 2) | ||
utc=$(grep ro.build.date.utc ../out/target/product/$DEVICE/system/build.prop | cut -d '=' -f 2) | ||
oldutc=$(grep datetime $DEVICE.json | cut -d ':' -f 2) | ||
size=$(wc -c ../out/target/product/$DEVICE/$FILENAME | cut -d ' ' -f 1) | ||
oldsize=$(grep size $DEVICE.json | cut -d ':' -f 2) | ||
oldurl=$(grep url $DEVICE.json | cut -d ' ' -f 9) | ||
|
||
curl -T ../out/target/product/judyln/lineage-18.0-"${d}"-UNOFFICIAL-judyln.zip ftp://J0SH1X:[email protected]/ | ||
# Generate the Changelog | ||
# Clear the changelog file | ||
echo "" > changelog.txt | ||
|
||
#Generate the Changelog | ||
for repo in ${REPOS[*]} | ||
do | ||
echo "########################################" >> changelog.txt | ||
echo "${repo} Changes:" >> changelog.txt | ||
git --git-dir ../$repo/.git log --since=$oldutc >> changelog.txt | ||
done | ||
|
||
cd ../device/lge/sdm845-common/ && git log > ~/los/Lineage-OTA/changelog.txt.tmp && cd ~/los/Lineage-OTA/ && echo "########################################" > changelog.txt && echo "COMMON CHANGES" >> changelog.txt && echo "########################################" >> changelog.txt && echo " " >> changelog.txt && head -40 changelog.txt.tmp >> changelog.txt && echo "########################################" >> changelog.txt && rm changelog.txt.tmp && echo " " >> changelog.txt && echo "########################################" >> changelog.txt && echo "DEVICE CHANGES" >> changelog.txt && echo "########################################" >> changelog.txt && echo " " >> changelog.txt && cd ../device/lge/judyln && git log > ~/los/Lineage-OTA/changelog.txt.tmp && cd ~/los/Lineage-OTA/ && head -40 changelog.txt.tmp >> changelog.txt && echo "########################################" >> changelog.txt && rm changelog.txt.tmp && echo " " >> changelog.txt && echo "########################################" >> changelog.txt && echo "KERNEL CHANGES" >> changelog.txt && echo "########################################" >> changelog.txt && echo " " >> changelog.txt && cd ../kernel/lge/sdm845 && git log > ~/los/Lineage-OTA/changelog.txt.tmp && cd ~/los/Lineage-OTA && head -40 changelog.txt.tmp >> changelog.txt && echo "########################################" >> changelog.txt && rm changelog.txt.tmp | ||
echo "########################################" >> changelog.txt | ||
|
||
#This is where the magic happens | ||
sed -i "s!${oldmd5}! \"${md5}\",!g" judyln.json | ||
sed -i "s!${oldutc}! \"${utc}\",!g" judyln.json | ||
sed -i "s!${oldsize}! \"${size}\",!g" judyln.json | ||
sed -i "s!${oldd}!${d}!" judyln.json | ||
#echo Enter the new Download URL | ||
#read -r url | ||
#sed -i "s!${oldurl}!\"${url}\",!g" judyln.json | ||
curl -T ./judyln.json ftp://J0SH1X:[email protected]/ | ||
sed -i "s!${oldmd5}! \"${md5}\",!g" $DEVICE.json | ||
sed -i "s!${oldutc}! \"${utc}\",!g" $DEVICE.json | ||
sed -i "s!${oldsize}! \"${size}\",!g" $DEVICE.json | ||
sed -i "s!${oldd}!${d}!" $DEVICE.json | ||
#echo Generate Download URL | ||
TAG=$(echo "${DEVICE}-${d}") | ||
url="https://github.com/SGCMarkus/Lineage-OTA/releases/download/${TAG}/${FILENAME}" | ||
sed -i "s!${oldurl}!\"${url}\",!g" $DEVICE.json | ||
|
||
hub release create -a ../out/target/product/$DEVICE/$FILENAME -a changelog.txt "${TAG}" |