-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcreatejson.sh
More file actions
executable file
·63 lines (58 loc) · 1.97 KB
/
Copy pathcreatejson.sh
File metadata and controls
executable file
·63 lines (58 loc) · 1.97 KB
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
#!/bin/bash
#put script in SpiceOS source folder, make executable (chmod +x createupdate.sh) and run it (./createupdate.sh)
#modify values below
#leave blank if not used
maintainer="Name (nickname)" #ex: Mohammed Althaf (althafvly)
oem="OEM" #ex: Motorola
device="device codename" #ex: osprey
devicename="name of device" #ex: Moto G 2015
zip="SpiceOS zip" #ex: SpiceOS-2.0-BETA-20201117-osprey-OFFICIAL.zip
buildtype="Beta" #choose from Testing/Alpha/Beta/Stable
forum="https://link"
gapps="https://link"
firmware="https://link"
modem="https://link"
bootloader="https://link"
recovery="https://link"
paypal="https://link"
telegram="https://link"
#don't modify from here
script_path="`dirname \"$0\"`"
zip_name=$script_path/out/target/product/$device/$zip
buildprop=$script_path/out/target/product/$device/system/build.prop
if [ -f $script_path/$device.json ]; then
rm $script_path/$device.json
fi
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`
size=`stat -c "%s" "$zip_name"`
version=`echo "$zip_only" | cut -d'-' -f2`
v_max=`echo "$version" | cut -d'.' -f1 | cut -d'-' -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://sourceforge.net/projects/spiceos/files/11/'$device'/'$zip_only'/download",
"timestamp": '$timestamp',
"md5": "'$md5'",
"size": '$size',
"version": "'$version'",
"buildtype": "'$buildtype'",
"forum": "'$forum'",
"gapps": "'$gapps'",
"firmware": "'$firmware'",
"modem": "'$modem'",
"bootloader": "'$bootloader'",
"recovery": "'$recovery'",
"paypal": "'$paypal'",
"telegram": "'$telegram'"
}
]
}' >> $device.json