-
Notifications
You must be signed in to change notification settings - Fork 4
/
auto_createjson_8.x.sh
80 lines (71 loc) · 4.31 KB
/
auto_createjson_8.x.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
maintainer="Krell RHEL (WolfAURman)" # Here we get the name of maintainer
path=~/android/crdroid8 # Here you will need to specify the path to the crDroid source code folder
device=$(ls $path/out/target/product) # Here we get the name of the device based on the name of the folder
time=$(cat $path/out/build_date.txt) # Here we get the build time
zip=$(basename $path/out/target/product/$device/crDroidAndroid-12.1-*-$device-*.zip) # Here we get the package name with the extension .zip
nozip=$(basename $path/out/target/product/$device/crDroidAndroid-12.1-*-$device-*.zip .zip) # Here we get the package name without the extension .zip
date=$(echo $zip | cut -f3 -d '-') # Here we get the build date (in YYYY-MM-DD format)
case "${device,,}" in
"lava" ) devicename="Redmi 9" && oem="Xiaomi" ;; #
"daisy" ) devicename="Mi A2 Lite" && oem="Xiaomi" ;; # This is where the necessary information is assigned to the desired variable
"jason" ) devicename="Mi Note 3" && oem="Xiaomi" ;; # This allows you not to change the script for each device separately
"onclite" ) devicename="Redmi 7" && oem="Xiaomi" ;; #
"sakura" ) devicename="Redmi 6 Pro" && oem="Xiaomi" ;; #
"poplar_dsds" ) devicename="Xperia XZ1 Dual" && oem="Sony" ;; #
esac
buildtype="Monthly" # choose from Testing/Alpha/Beta/Weekly/Monthly
forum="https://t.me/WolfAURman_Discussion" # https link (mandatory)
gapps="https://sourceforge.net/projects/nikgapps/files/Releases/NikGapps-SL/16-Jul-2023/NikGapps-core-arm64-12.1-20230716-signed.zip/download"
firmware="" # https link (leave empty if unused)
modem="" # https link (leave empty if unused)
bootloader="" # https link (leave empty if unused)
recovery="" # https link (leave empty if unused)
paypal="http://paypal.me/rozenov" # https link (leave empty if unused)
telegram="https://t.me/red_hat_interprise13" # https link (leave empty if unused)
dt="" # https://github.com/crdroidandroid/android_device_<oem>_<device_codename>
commondt="" # https://github.com/crdroidandroid/android_device_<orm>_<SOC>-common
kernel="" # https://github.com/crdroidandroid/android_kernel_<oem>_<SOC>
#don't modify from here
zip_name=$path/out/target/product/$device/$zip
buildprop=$path/out/target/product/$device/system/build.prop
linenr=`grep -n "ro.system.build.date.utc" $buildprop | cut -d':' -f1`
timestamp=`sed -n $linenr'p' < $buildprop | cut -d'=' -f2`
zip_only=`basename "$zip_name"`
md5=`md5sum "$zip_name" | cut -d' ' -f1`
sha256=`sha256sum "$zip_name" | cut -d' ' -f1`
size=`stat -c "%s" "$zip_name"`
version=`echo "$zip_only" | cut -d'-' -f5`
v_max=`echo "$version" | cut -d'.' -f1 | cut -d'v' -f2`
v_min=`echo "$version" | cut -d'.' -f2`
version=`echo $v_max.$v_min`
echo '{
"response": [
{
"maintainer": "'$maintainer'",
"oem": "'$oem'",
"device": "'$devicename'",
"filename": "'$zip_only'",
"download": "https://github.com/WolfAURman/crdroid_ota_update/releases/download/'$nozip'/'$zip'",
"timestamp": '$timestamp',
"md5": "'$md5'",
"sha256": "'$sha256'",
"size": '$size',
"version": "'$version'",
"buildtype": "'$buildtype'",
"forum": "'$forum'",
"gapps": "'$gapps'",
"firmware": "'$firmware'",
"modem": "'$modem'",
"bootloader": "'$bootloader'",
"recovery": "'$recovery'",
"paypal": "'$paypal'",
"telegram": "'$telegram'",
"dt": "'$dt'",
"common-dt": "'$commondt'",
"kernel": "'$kernel'"
}
]
}' > 8.x/$device.json
git add -A && git commit -m "Update autogenerated json for $device $version $date/$time" && git push
gh release create $nozip --notes "Automated release сrDroid for $device $version $date/$time" $path/out/target/product/$device/$zip