-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild-module.sh
45 lines (30 loc) · 876 Bytes
/
build-module.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
#!/bin/bash
set -e
# We just build the executable
bash ./build.sh
mkdir -p module/backtap/system/bin
# move it to our module
mv backtap module/backtap/system/bin/backtap
cd module/backtap
ZIP_NAME="MagiskModule-backtap.zip"
if [ "$1" == "-debug" ]
then
echo "Building in debug mode"
ZIP_NAME="MagiskModule-backtap-debug.zip"
# Add file to enable debug mode (see service.sh)
touch "DEBUG"
# Read module props file before
FILE_BEFORE=$(<module.prop)
# exit_cleanup resets all of them on exit
exit_cleanup() {
rm -f DEBUG
echo "$FILE_BEFORE" > module.prop
}
trap exit_cleanup EXIT
# Mark version as debug version
sed -i -Ee 's/version=(.*)/version=\1-debug/g' module.prop
fi
# remove the old packed module, if possible
rm -f "../../$ZIP_NAME"
# and create the new one
zip -r "../../$ZIP_NAME" .