-
Notifications
You must be signed in to change notification settings - Fork 23
/
compile.sh
executable file
·64 lines (51 loc) · 1.6 KB
/
compile.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
#!/bin/bash
set -e -u
IFS=$'\n'
renice -n 19 $$ &>/dev/null
source magiskmodule/constants.sh
GZIP=(gzip --best)
[ -n "$(command -v pigz)" ] && {
GZIP=(pigz --best)
[ "$(nproc)" -ge 8 ] && GZIP=(pigz -11)
}
compressArchiveZip() {
local files="$(basename "$1")"
local folder="$(dirname "$1")"
local targetarchive="$(pwd)"/"$2"
(
cd "$folder"
#shellcheck disable=SC2086
zip -r -9 -q "$targetarchive" $files
)
}
compressArchiveTarGz() {
local files="$(basename "$1")"
local folder="$(dirname "$1")"
local targetarchive="$2"
(
cd "$folder"
#shellcheck disable=SC2086
tar -cf - $files | "${GZIP[@]}" > "../$targetarchive"
)
}
setVersionVariables() {
local folder="$1"
[ -n "$(git status --porcelain -- "$folder")" ] && CHANGES="+" || CHANGES="-"
VERSIONCODE=$(git rev-list --count HEAD -- "$folder")
REPACKAGEDSTRING="repackagedhoch$VERSIONCODE"
COMMITHASH=$(git log -1 --pretty=%h -- "$folder")
VERSION=v$VERSIONCODE$CHANGES\($COMMITHASH\)
FILENAMEVERSION=$REPACKAGEDSTRING$CHANGES$COMMITHASH
}
git clean -Xdfq magiskmodule/
sed -e 's/^\s*#.*$//' -e '/^$/d' < stockeqpackages.csv > magiskmodule/stockeqpackages.csv &
setVersionVariables .
cp -f README.md magiskmodule/README.md &
declare -x VERSION VERSIONCODE REPACKAGEDSTRING
envsubst < module.prop > magiskmodule/module.prop &
OUTPUT_FILE="ViPER4AndroidFX-$FILENAMEVERSION.zip"
rm -f ViPER4AndroidFX-repackaged*.zip &
compressArchiveTarGz ViperIRS/"*.irs" magiskmodule/"$VIPERIRSFILE" &
compressArchiveTarGz ViperVDC/"*.vdc" magiskmodule/"$VIPERVDCFILE" &
wait
compressArchiveZip "magiskmodule/." "$OUTPUT_FILE"