-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.sh
53 lines (38 loc) · 1.52 KB
/
build.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
#!/system/bin/sh
# By pedro (pedrozzz0 @ GitHub)
# Thanks to bdashore3 @ GitHub
# Thanks to Draco (tytydraco @ GitHub)
yellow=$(tput setaf 3)
green=$(tput setaf 2)
boldgreen=${bold}${green}
boldred=${bold}${red}
red=$(tput setaf 1)
blue=$(tput setaf 4)
bold=$(tput bold)
blink=$(tput blink)
default=$(tput sgr0)
v="2.1"
vcd=$(grep versionCode= module.prop | sed "s/versionCode=//")
read -r -p 'Build release: ' br
read -r -p 'Codename: ' cdn
init=$(date +%s)
[ "$(grep build_date $(pwd)/module.prop)" ] && sed -i -e "/build_date=/s/=.*/=$(date)/" "$(pwd)/module.prop"
[ ! "$(grep build_date $(pwd)/module.prop)" ] && echo "build_date=$(date)" >>"$(pwd)/module.prop"
vcd=$(printf "%.3d" "$((vcd + 1))")
sed -i -e "/versionCode=/s/=.*/=$vcd/" "$(pwd)/module.prop"
sed -i -e "/version=/s/=.*/=$v-$br-$cdn/" "$(pwd)/module.prop"
echo ""
echo "Build starting at $(date)"
echo ""
echo "Zipping ${blink}KTSR-$v-$br-$cdn$default..."
zip -0 -r9 -ll "KTSR-$v-$br-$cdn.zip" . -x *.git* -x *.txt -x cleantrash -x mod-util.sh -x adjshield -x fscache-ctrl -x *.yml -x kingd -x ktsrmenu -x kingtweaks -x gameoptd -x libcommon.sh -x libktsr.sh -x kcal.sh -x build.sh
mv -f "KTSR-$v-$br-$cdn.zip" ../out
exit=$(date +%s)
exec_time=$((exit - init))
[ $? -ne "1" ] && {
echo "${boldgreen}Build done in $((exec_time / 60)) minutes and $exec_time seconds!${blue} Check the folder to the finished build."
exit 0
} || {
echo "${boldred}Build failed in $((exec_time / 60)) minutes and $exec_time seconds!${yellow} Please fix the error(s) and try again."
exit 1
}