forked from j-hc/revanced-magisk-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·88 lines (75 loc) · 4.06 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
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
81
82
83
84
85
86
87
88
#!/usr/bin/env bash
set -eu -o pipefail
source utils.sh
trap "rm -rf temp/tmp.*" INT
: >build.md
mkdir -p "$BUILD_DIR" "$TEMP_DIR"
toml_prep "$(cat 2>/dev/null "${1:-config.toml}")" || abort "could not find config file '${1}'"
read_main_config
if ((COMPRESSION_LEVEL > 9)) || ((COMPRESSION_LEVEL < 1)); then abort "compression-level must be from 1 to 9"; fi
if [ "$UPDATE_PREBUILTS" = true ]; then get_prebuilts; else set_prebuilts; fi
if [ "$BUILD_MINDETACH_MODULE" = true ]; then : >$PKGS_LIST; fi
mkdir -p revanced-magisk/bin/arm64 revanced-magisk/bin/arm
get_cmpr
log "**App Versions:**"
idx=0
for t in $(toml_get_all_tables); do
if [ "$t" = main-config ]; then continue; fi
enabled=$(toml_get "$t" enabled) || enabled=true
if [ "$enabled" = false ]; then continue; fi
if (( idx >= PARALLEL_JOBS )); then wait -n; else idx=$((idx + 1)); fi
declare -A app_args
merge_integrations=$(toml_get "$t" merge-integrations) || merge_integrations=false
excluded_patches=$(toml_get "$t" excluded-patches) || excluded_patches=""
included_patches=$(toml_get "$t" included-patches) || included_patches=""
exclusive_patches=$(toml_get "$t" exclusive-patches) || exclusive_patches=false
app_args[version]=$(toml_get "$t" version) || app_args[version]="auto"
app_args[app_name]=$(toml_get "$t" app-name) || app_args[app_name]=$t
app_args[allow_alpha_version]=$(toml_get "$t" allow-alpha-version) || app_args[allow_alpha_version]=false
app_args[rip_libs]=$(toml_get "$t" rip-libs) || app_args[rip_libs]=false
app_args[build_mode]=$(toml_get "$t" build-mode) || app_args[build_mode]=apk
app_args[microg_patch]=$(toml_get "$t" microg-patch) || app_args[microg_patch]=""
app_args[apkmirror_dlurl]=$(toml_get "$t" apkmirror-dlurl) || app_args[apkmirror_dlurl]=""
if [ "${app_args[apkmirror_dlurl]}" ]; then
app_args[apkmirror_dlurl]=${app_args[apkmirror_dlurl]%/}
if [[ "${app_args[apkmirror_dlurl]%/*}" == */apk ]]; then
app_args[apkmirror_dlurl]=${app_args[apkmirror_dlurl]%/*}/${app_args[apkmirror_dlurl]##*/}/${app_args[apkmirror_dlurl]##*/}
fi
fi
app_args[arch]=$(toml_get "$t" arch) || app_args[arch]="all"
app_args[module_prop_name]=$(toml_get "$t" module-prop-name) || {
app_name_l=${app_args[app_name],,}
app_args[module_prop_name]=$([ "${app_args[arch]}" = "all" ] && echo "${app_name_l}-rv-jhc-magisk" || echo "${app_name_l}-${app_args[arch]}-rv-jhc-magisk")
}
if ! app_args[apkmirror_regex]=$(toml_get "$t" apkmirror-regex); then
if [ "${app_args[arch]}" = "all" ]; then
app_args[apkmirror_regex]="APK</span>[^@]*@\([^#]*\)"
elif [ "${app_args[arch]}" = "arm64-v8a" ]; then
app_args[apkmirror_regex]='arm64-v8a</div>[^@]*@\([^"]*\)'
elif [ "${app_args[arch]}" = "arm-v7a" ]; then
app_args[apkmirror_regex]='armeabi-v7a</div>[^@]*@\([^"]*\)'
fi
fi
if [ "${app_args[apkmirror_dlurl]:-}" ] && [ "${app_args[apkmirror_regex]:-}" ]; then app_args[dl_from]=apkmirror; else app_args[dl_from]=uptodown; fi
app_args[patcher_args]="$(join_args "${excluded_patches}" -e) $(join_args "${included_patches}" -i)"
[ "$merge_integrations" = true ] && app_args[patcher_args]="${app_args[patcher_args]} -m ${RV_INTEGRATIONS_APK}"
[ "$exclusive_patches" = true ] && app_args[patcher_args]="${app_args[patcher_args]} --exclusive"
build_rv app_args &
done
wait
rm -rf temp/tmp.*
if [ "$BUILD_MINDETACH_MODULE" = true ]; then
echo "Building mindetach module"
cp -f $PKGS_LIST mindetach-magisk/mindetach/detach.txt
pushd mindetach-magisk/mindetach/
zip -r ../../build/mindetach-"$(grep version= module.prop | cut -d= -f2)".zip .
popd
fi
youtube_mode=$(toml_get "YouTube" "build-mode") || youtube_mode="module"
music_arm_mode=$(toml_get "Music-arm" "build-mode") || music_arm_mode="module"
music_arm64_mode=$(toml_get "Music-arm64" "build-mode") || music_arm64_mode="module"
if [ "$youtube_mode" != module ] || [ "$music_arm_mode" != module ] || [ "$music_arm64_mode" != module ]; then
log "\nInstall [Vanced Microg](https://github.com/TeamVanced/VancedMicroG/releases) to be able to use non-root YouTube or Music"
fi
log "\n[revanced-magisk-module](https://github.com/j-hc/revanced-magisk-module)"
echo "Done"