forked from revanced-apks/build-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.sh
executable file
·535 lines (458 loc) · 17.9 KB
/
utils.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
#!/usr/bin/env bash
source semver
MODULE_TEMPLATE_DIR="revanced-magisk"
MODULE_SCRIPTS_DIR="scripts"
TEMP_DIR="temp"
BUILD_DIR="build"
ARM64_V8A="arm64-v8a"
ARM_V7A="arm-v7a"
GITHUB_REPOSITORY=${GITHUB_REPOSITORY:-$"revanced-apks/build-apps"}
NEXT_VER_CODE=${NEXT_VER_CODE:-$(date +"%m-%d-%y")}
WGET_HEADER="User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0"
SERVICE_SH=$(cat $MODULE_SCRIPTS_DIR/service.sh)
POSTFSDATA_SH=$(cat $MODULE_SCRIPTS_DIR/post-fs-data.sh)
CUSTOMIZE_SH=$(cat $MODULE_SCRIPTS_DIR/customize.sh)
UNINSTALL_SH=$(cat $MODULE_SCRIPTS_DIR/uninstall.sh)
json_get() {
local key=$1 grep_for=${2:-}
grep -o "\"${key}\":[^\"]*\"[^\"]*\"" | sed -E 's/".*".*"(.*)"/\1/' | if [ "$grep_for" ]; then grep "$grep_for"; else cat; fi
}
get_prebuilts() {
echo "Getting prebuilts"
RV_CLI_URL=$(req https://api.github.com/repos/revanced/revanced-cli/releases/latest - | json_get 'browser_download_url')
RV_CLI_JAR="${TEMP_DIR}/${RV_CLI_URL##*/}"
log "CLI: ${RV_CLI_URL##*/}"
RV_INTEGRATIONS_URL=$(req https://api.github.com/repos/revanced/revanced-integrations/releases/latest - | json_get 'browser_download_url')
RV_INTEGRATIONS_APK=${RV_INTEGRATIONS_URL##*/}
RV_INTEGRATIONS_APK="${RV_INTEGRATIONS_APK%.apk}-$(cut -d/ -f8 <<<"$RV_INTEGRATIONS_URL").apk"
log "Integrations: $RV_INTEGRATIONS_APK"
RV_INTEGRATIONS_APK="${TEMP_DIR}/${RV_INTEGRATIONS_APK}"
RV_PATCHES=$(req https://api.github.com/repos/revanced/revanced-patches/releases/latest -)
RV_PATCHES_CHANGELOG=$(echo "$RV_PATCHES" | json_get 'body' | sed 's/\(\\n\)\+/\\n/g')
RV_PATCHES_URL=$(echo "$RV_PATCHES" | json_get 'browser_download_url' 'jar')
RV_PATCHES_JAR="${TEMP_DIR}/${RV_PATCHES_URL##*/}"
log "Patches: ${RV_PATCHES_URL##*/}"
log "\n${RV_PATCHES_CHANGELOG//# [/### [}\n"
dl_if_dne "$RV_CLI_JAR" "$RV_CLI_URL"
dl_if_dne "$RV_INTEGRATIONS_APK" "$RV_INTEGRATIONS_URL"
dl_if_dne "$RV_PATCHES_JAR" "$RV_PATCHES_URL"
}
get_cmpr() {
dl_if_dne "${MODULE_TEMPLATE_DIR}/bin/arm64/cmpr" "https://github.com/j-hc/cmpr/releases/download/20220811/cmpr-arm64-v8a"
dl_if_dne "${MODULE_TEMPLATE_DIR}/bin/arm/cmpr" "https://github.com/j-hc/cmpr/releases/download/20220811/cmpr-armeabi-v7a"
}
abort() { echo "abort: $1" && exit 1; }
set_prebuilts() {
[ -d "$TEMP_DIR" ] || abort "${TEMP_DIR} directory could not be found"
RV_CLI_JAR=$(find "$TEMP_DIR" -maxdepth 1 -name "revanced-cli-*" | tail -n1)
[ -z "$RV_CLI_JAR" ] && abort "revanced cli not found"
log "CLI: ${RV_CLI_JAR#"$TEMP_DIR/"}"
RV_INTEGRATIONS_APK=$(find "$TEMP_DIR" -maxdepth 1 -name "app-release-unsigned-*" | tail -n1)
[ -z "$RV_CLI_JAR" ] && abort "revanced integrations not found"
log "Integrations: ${RV_INTEGRATIONS_APK#"$TEMP_DIR/"}"
RV_PATCHES_JAR=$(find "$TEMP_DIR" -maxdepth 1 -name "revanced-patches-*" | tail -n1)
[ -z "$RV_CLI_JAR" ] && abort "revanced patches not found"
log "Patches: ${RV_PATCHES_JAR#"$TEMP_DIR/"}"
}
reset_template() {
echo "# utils" >"${MODULE_TEMPLATE_DIR}/service.sh"
echo "# utils" >"${MODULE_TEMPLATE_DIR}/post-fs-data.sh"
echo "# utils" >"${MODULE_TEMPLATE_DIR}/customize.sh"
echo "# utils" >"${MODULE_TEMPLATE_DIR}/uninstall.sh"
echo "# utils" >"${MODULE_TEMPLATE_DIR}/module.prop"
rm -rf ${MODULE_TEMPLATE_DIR}/*.apk
mkdir -p ${MODULE_TEMPLATE_DIR}/bin/arm ${MODULE_TEMPLATE_DIR}/bin/arm64
}
req() { wget -nv -O "$2" --header="$WGET_HEADER" "$1"; }
log() { echo -e "$1 " >>build.md; }
get_largest_ver() {
local max=0
while read -r v || [ -n "$v" ]; do
if [ "$(command_compare "$v" "$max")" = 1 ]; then max=$v; fi
done
if [[ $max = 0 ]]; then echo ""; else echo "$max"; fi
}
get_patch_last_supported_ver() {
unzip -p "$RV_PATCHES_JAR" | strings -s , | sed -rn "s/.*${1},versions,(([0-9.]*,*)*),Lk.*/\1/p" | tr ',' '\n' | get_largest_ver
}
dl_if_dne() {
if [ ! -f "$1" ]; then
echo -e "\nGetting '$1' from '$2'"
req "$2" "$1"
fi
}
# if you are here to copy paste this piece of code, acknowledge it:)
dl_apkmirror() {
local url=$1 regexp=$2 output=$3
resp=$(req "$url" -) || return 1
url="https://www.apkmirror.com$(echo "$resp" | tr '\n' ' ' | sed -n "s/href=\"/@/g; s;.*${regexp}.*;\1;p")"
url="https://www.apkmirror.com$(req "$url" - | tr '\n' ' ' | sed -n 's;.*href="\(.*key=[^"]*\)">.*;\1;p')"
url="https://www.apkmirror.com$(req "$url" - | tr '\n' ' ' | sed -n 's;.*href="\(.*key=[^"]*\)">.*;\1;p')"
req "$url" "$output"
}
get_apkmirror_vers() {
local apkmirror_category=$1
req "https://www.apkmirror.com/uploads/?appcategory=${apkmirror_category}" - | sed -n 's;.*Version:</span><span class="infoSlide-value">\(.*\) </span>.*;\1;p'
}
get_uptodown_ver() {
local app_name=$1
req "https://${app_name}.en.uptodown.com/android/download" - | json_get 'softwareVersion'
}
dl_uptodown() {
local app_name=$1 output=$2
url=$(req "https://${app_name}.en.uptodown.com/android/download" - | sed -n 's;.*data-url="\(.*\)".*;\1;p')
req "$url" "$output"
}
patch_apk() {
local stock_input=$1 patched_apk=$2 patcher_args=$3
echo "java -jar $RV_CLI_JAR --rip-lib armeabi-v7a --rip-lib x86_64 --rip-lib x86 -c -a $stock_input -o $patched_apk -b $RV_PATCHES_JAR --keystore=ks.keystore $patcher_args"
# shellcheck disable=SC2086
# --rip-lib is only available in my own revanced-cli builds
java -jar "$RV_CLI_JAR" --rip-lib armeabi-v7a --rip-lib x86_64 --rip-lib x86 -c -a "$stock_input" -o "$patched_apk" -b "$RV_PATCHES_JAR" --keystore=ks.keystore $patcher_args
}
patch_apk1() {
local stock_input=$4 patched_apk=$5 patcher_args1=$6
echo "java -jar $RV_CLI_JAR -i website -i materialyou -c -a $stock_input -o $patched_apk -b $RV_PATCHES_JAR --keystore=ks.keystore $patcher_args1"
# shellcheck disable=SC2086
# --rip-lib is only available in my own revanced-cli builds
java -jar "$RV_CLI_JAR" -i website -i materialyou -c -a "$stock_input" -o "$patched_apk" -b "$RV_PATCHES_JAR" --keystore=ks.keystore $patcher_args1
}
select_ver() {
local last_ver pkg_name=$1 apkmirror_category=$2 select_ver_experimental=$3
last_ver=$(get_patch_last_supported_ver "$pkg_name")
if [ "$select_ver_experimental" = true ] || [ -z "$last_ver" ]; then
if [ "$pkg_name" = "com.twitter.android" ]; then
last_ver=$(get_apkmirror_vers "$apkmirror_category" | grep "release" | get_largest_ver)
else
last_ver=$(get_apkmirror_vers "$apkmirror_category" | get_largest_ver)
fi
fi
echo "$last_ver"
}
build_rv() {
local -n args=$1
local version patcher_args dl_from build_mode_arr
local mode_arg=${args[mode]%/*} version_mode=${args[mode]#*/}
args[arch]=${args[arch]:-all}
if [ "${args[apkmirror_dlurl]:-}" ] && [ "${args[regexp]:-}" ]; then dl_from=apkmirror; else dl_from=uptodown; fi
reset_template
if [ "$mode_arg" = none ]; then
return
elif [ "$mode_arg" = apk ]; then
build_mode_arr=(apk)
elif [ "$mode_arg" = both ]; then
build_mode_arr=(apk module)
else
echo "ERROR: undefined build mode for YouTube: '$mode_arg'"
return
fi
for build_mode in "${build_mode_arr[@]}"; do
patcher_args="${args[patcher_args]:-}"
printf "Building '%s' (%s) in " "${args[app_name]}" "${args[arch]}"
if [ "$build_mode" = module ]; then echo "'module' mode"; else echo "'APK' mode"; fi
if [ "${args[microg_patch1]:-}" ]; then
if [ "$build_mode" = module ]; then
patcher_args="$patcher_args -e ${args[microg_patch]}"
elif [[ "${args[patcher_args]}" = *"${args[microg_patch]}"* ]]; then
abort "UNREACHABLE $LINENO"
fi
fi
if [ "$version_mode" = auto ] && [ $dl_from = apkmirror ]; then
version=$(select_ver "${args[pkg_name]}" "${args[apkmirror_dlurl]##*/}" false)
elif [ "$version_mode" = latest ]; then
if [ $dl_from = apkmirror ]; then
version=$(select_ver "${args[pkg_name]}" "${args[apkmirror_dlurl]##*/}" true)
elif [ $dl_from = uptodown ]; then
version=$(get_uptodown_ver "${args[app_name],,}")
fi
patcher_args="$patcher_args --experimental"
else
version=$version_mode
patcher_args="$patcher_args --experimental"
fi
echo "Choosing version '${version}'"
local stock_apk="${TEMP_DIR}/${args[app_name],,}-stock-v${version}-${args[arch]}.apk"
local apk_output="${BUILD_DIR}/${args[app_name],,}-revanced-v${version}-${args[arch]}.apk"
if [ "${args[microg_patch]:-}" ]; then
local patched_apk="${TEMP_DIR}/${args[app_name],,}-revanced-v${version}-${args[arch]}-${build_mode}.apk"
else
local patched_apk="${TEMP_DIR}/${args[app_name],,}-revanced-v${version}-${args[arch]}.apk"
fi
if [ ! -f "$stock_apk" ]; then
if [ $dl_from = apkmirror ]; then
echo "Downloading from APKMirror"
if ! dl_apkmirror "https://www.apkmirror.com/apk/${args[apkmirror_dlurl]}-${version//./-}-release/" \
"${args[regexp]}" \
"$stock_apk"; then
echo "ERROR: Could not find version '${version}' for ${args[app_name]}"
return 1
fi
elif [ $dl_from = uptodown ]; then
echo "Downloading the latest version from Uptodown"
if ! dl_uptodown "${args[app_name],,}" "$stock_apk"; then
echo "ERROR: Could not download ${args[app_name]}"
return 1
fi
else
abort "UNREACHABLE $LINENO"
fi
fi
if [ "${args[arch]}" = "all" ]; then
log "${args[app_name]}: ${version}"
else
log "${args[app_name]} (${args[arch]}): ${version}"
fi
if [ ! -f "$patched_apk" ] || [ "${args[microg_patch]:-}" ]; then
patch_apk "$stock_apk" "$patched_apk" "$patcher_args"
fi
if [ ! -f "$patched_apk" ]; then
echo "BUILD FAIL"
return
fi
if [ "$build_mode" = apk ]; then
cp -f "$patched_apk" "${apk_output}"
echo "Built ${args[app_name]} (${args[arch]}) (non-root): '${apk_output}'"
return
fi
done
}
excluded_patches() {
if [ "$1" ]; then
echo "$1" | tr -d '\t\r' | tr ' ' '\n' | grep -v '^$' | sed 's/^/-e /' | paste -sd " " -
else
echo ""
fi
}
included_patches() {
if [ "$1" ]; then
echo "$1" | tr -d '\t\r' | tr ' ' '\n' | grep -v '^$' | sed 's/^/-i /' | paste -sd " " -
else
echo ""
fi
}
# No.2
build_rv1() {
local -n args=$1
local version patcher_args1 dl_from build_mode_arr
local mode_arg=${args[mode]%/*} version_mode=${args[mode]#*/}
args[arch]=${args[arch]:-all}
if [ "${args[apkmirror_dlurl]:-}" ] && [ "${args[regexp]:-}" ]; then dl_from=apkmirror; else dl_from=uptodown; fi
reset_template
if [ "$mode_arg" = none ]; then
return
elif [ "$mode_arg" = apk ]; then
build_mode_arr=(apk)
elif [ "$mode_arg" = both ]; then
build_mode_arr=(apk module)
else
echo "ERROR: undefined build mode for YouTube: '$mode_arg'"
return
fi
for build_mode in "${build_mode_arr[@]}"; do
patcher_args1="${args[patcher_args1]:-}"
printf "Building '%s' (%s) in " "${args[app_name]}" "${args[arch]}"
if [ "$build_mode" = module ]; then echo "'module' mode"; else echo "'APK' mode"; fi
if [ "${args[microg_patch1]:-}" ]; then
if [ "$build_mode" = module ]; then
patcher_args1="$patcher_args1 -e ${args[microg_patch]}"
elif [[ "${args[patcher_args1]}" = *"${args[microg_patch]}"* ]]; then
abort "UNREACHABLE $LINENO"
fi
fi
if [ "$version_mode" = auto ] && [ $dl_from = apkmirror ]; then
version=$(select_ver "${args[pkg_name]}" "${args[apkmirror_dlurl]##*/}" false)
elif [ "$version_mode" = latest ]; then
if [ $dl_from = apkmirror ]; then
version=$(select_ver "${args[pkg_name]}" "${args[apkmirror_dlurl]##*/}" true)
elif [ $dl_from = uptodown ]; then
version=$(get_uptodown_ver "${args[app_name],,}")
fi
patcher_args1="$patcher_args1 --experimental"
else
version=$version_mode
patcher_args1="$patcher_args1 --experimental"
fi
echo "Choosing version '${version}'"
local stock_apk="${TEMP_DIR}/${args[app_name],,}-stock-v${version}-${args[arch]}.apk"
local apk_output="${BUILD_DIR}/${args[app_name],,}-revanced-v${version}-${args[arch]}.apk"
if [ "${args[microg_patch]:-}" ]; then
local patched_apk="${TEMP_DIR}/${args[app_name],,}-revanced-v${version}-${args[arch]}-${build_mode}.apk"
else
local patched_apk="${TEMP_DIR}/${args[app_name],,}-revanced-v${version}-${args[arch]}.apk"
fi
if [ ! -f "$stock_apk" ]; then
if [ $dl_from = apkmirror ]; then
echo "Downloading from APKMirror"
if ! dl_apkmirror "https://www.apkmirror.com/apk/${args[apkmirror_dlurl]}-${version//./-}-release/" \
"${args[regexp]}" \
"$stock_apk"; then
echo "ERROR: Could not find version '${version}' for ${args[app_name]}"
return 1
fi
elif [ $dl_from = uptodown ]; then
echo "Downloading the latest version from Uptodown"
if ! dl_uptodown "${args[app_name],,}" "$stock_apk"; then
echo "ERROR: Could not download ${args[app_name]}"
return 1
fi
else
abort "UNREACHABLE $LINENO"
fi
fi
if [ "${args[arch]}" = "all" ]; then
log "${args[app_name]}: ${version}"
else
log "${args[app_name]} (${args[arch]}): ${version}"
fi
if [ ! -f "$patched_apk" ] || [ "${args[microg_patch]:-}" ]; then
patch_apk "$stock_apk" "$patched_apk" "$patcher_args1"
fi
if [ ! -f "$patched_apk" ]; then
echo "BUILD FAIL"
return
fi
if [ "$build_mode" = apk ]; then
cp -f "$patched_apk" "${apk_output}"
echo "Built ${args[app_name]} (${args[arch]}) (non-root): '${apk_output}'"
return
fi
done
}
excluded_patches() {
if [ "$1" ]; then
echo "$1" | tr -d '\t\r' | tr ' ' '\n' | grep -v '^$' | sed 's/^/-e /' | paste -sd " " -
else
echo ""
fi
}
build_youtube() {
declare -A youtube_args
youtube_args[app_name]="YouTube"
youtube_args[patcher_args]="-m ${RV_INTEGRATIONS_APK} $(excluded_patches "${YOUTUBE_EXCLUDED_PATCHES}")"
youtube_args[mode]="$YOUTUBE_MODE"
youtube_args[microg_patch]="microg-support"
youtube_args[pkg_name]="com.google.android.youtube"
youtube_args[rip_all_libs]=false
youtube_args[apkmirror_dlurl]="google-inc/youtube/youtube"
youtube_args[regexp]="APK</span>[^@]*@\([^#]*\)"
youtube_args[module_prop_name]="ytrv-magisk"
# shellcheck disable=SC2034
youtube_args[module_update_json]="yt-update.json"
build_rv youtube_args
}
# No.2
build_youtube1() {
declare -A youtube_args
youtube_args[app_name]="YouTube Monet"
youtube_args[patcher_args1]="-m ${RV_INTEGRATIONS_APK} $(included_patches "${YOUTUBE_INCLUDED_PATCHES}") $(excluded_patches "${YOUTUBE_EXCLUDED_PATCHES}")"
youtube_args[mode]="$YOUTUBE_MODE"
youtube_args[microg_patch]="microg-support"
youtube_args[pkg_name]="com.google.android.youtube"
youtube_args[rip_all_libs]=false
youtube_args[apkmirror_dlurl]="google-inc/youtube/youtube"
youtube_args[regexp]="APK</span>[^@]*@\([^#]*\)"
youtube_args[module_prop_name]="ytrv-magisk"
# shellcheck disable=SC2034
youtube_args[module_update_json]="yt-update.json"
build_rv1 youtube_args
}
build_music() {
declare -A ytmusic_args
local arch=$1
ytmusic_args[app_name]="Music"
ytmusic_args[patcher_args]="$(excluded_patches "${MUSIC_EXCLUDED_PATCHES}")"
ytmusic_args[microg_patch]="music-microg-support"
ytmusic_args[arch]=$arch
ytmusic_args[pkg_name]="com.google.android.apps.youtube.music"
ytmusic_args[rip_all_libs]=false
ytmusic_args[apkmirror_dlurl]="google-inc/youtube-music/youtube-music"
if [ "$arch" = "$ARM64_V8A" ]; then
ytmusic_args[regexp]='arm64-v8a</div>[^@]*@\([^"]*\)'
ytmusic_args[module_prop_name]="ytmusicrv-magisk"
ytmusic_args[mode]="$MUSIC_ARM64_V8A_MODE"
elif [ "$arch" = "$ARM_V7A" ]; then
ytmusic_args[regexp]='armeabi-v7a</div>[^@]*@\([^"]*\)'
ytmusic_args[module_prop_name]="ytmusicrv-arm-magisk"
ytmusic_args[mode]="$MUSIC_ARM_V7A_MODE"
fi
#shellcheck disable=SC2034
ytmusic_args[module_update_json]="music-update-${arch}.json"
build_rv ytmusic_args
}
build_twitter() {
declare -A tw_args
tw_args[app_name]="Twitter"
tw_args[mode]="$TWITTER_MODE"
tw_args[pkg_name]="com.twitter.android"
tw_args[apkmirror_dlurl]="twitter-inc/twitter/twitter"
tw_args[regexp]='APK</span>[^@]*@\([^#]*\)'
tw_args[module_prop_name]="twrv-magisk"
#shellcheck disable=SC2034
tw_args[module_update_json]="tw-update.json"
build_rv tw_args
}
build_reddit() {
declare -A reddit_args
reddit_args[app_name]="Reddit"
reddit_args[mode]="$REDDIT_MODE"
reddit_args[pkg_name]="om.reddit.frontpage"
reddit_args[apkmirror_dlurl]="redditinc/reddit/reddit"
reddit_args[regexp]='APK</span>[^@]*@\([^#]*\)'
reddit_args[module_prop_name]="rditrv-magisk"
#shellcheck disable=SC2034
reddit_args[module_update_json]="rdit-update.json"
build_rv reddit_args
}
build_tiktok() {
declare -A tiktok_args
tiktok_args[app_name]="TikTok"
tiktok_args[patcher_args]="-m ${RV_INTEGRATIONS_APK}"
tiktok_args[mode]="$TIKTOK_MODE"
tiktok_args[pkg_name]="com.zhiliaoapp.musically"
tiktok_args[apkmirror_dlurl]="tiktok-pte-ltd/tik-tok-including-musical-ly/tik-tok-including-musical-ly"
tiktok_args[regexp]='APK</span>[^@]*@\([^#]*\)'
tiktok_args[module_prop_name]="tt-magisk"
#shellcheck disable=SC2034
tiktok_args[module_update_json]="tt-update.json"
build_rv tiktok_args
}
build_spotify() {
declare -A spotify_args
spotify_args[app_name]="Spotify"
spotify_args[mode]="$SPOTIFY_MODE"
spotify_args[pkg_name]="com.spotify.music"
spotify_args[module_prop_name]="sp-magisk"
#shellcheck disable=SC2034
spotify_args[module_update_json]="sp-update.json"
build_rv spotify_args
}
build_warn_wetter() {
declare -A warn_wetter_args
warn_wetter_args[app_name]="WarnWetter"
warn_wetter_args[mode]="$WARN_WETTER_MODE"
warn_wetter_args[pkg_name]="de.dwd.warnapp"
warn_wetter_args[apkmirror_dlurl]="deutscher-wetterdienst/warnwetter/warnwetter"
warn_wetter_args[regexp]='APK</span>[^@]*@\([^#]*\)'
warn_wetter_args[module_prop_name]="ww-magisk"
#shellcheck disable=SC2034
warn_wetter_args[module_update_json]="ww-update.json"
build_rv warn_wetter_args
}
postfsdata_sh() { echo "${POSTFSDATA_SH//__PKGNAME/$1}" >"${MODULE_TEMPLATE_DIR}/post-fs-data.sh"; }
uninstall_sh() { echo "${UNINSTALL_SH//__PKGNAME/$1}" >"${MODULE_TEMPLATE_DIR}/uninstall.sh"; }
customize_sh() { echo "${CUSTOMIZE_SH//__PKGNAME/$1}" >"${MODULE_TEMPLATE_DIR}/customize.sh"; }
service_sh() {
s="${SERVICE_SH//__MNTDLY/$MOUNT_DELAY}"
echo "${s//__PKGNAME/$1}" >"${MODULE_TEMPLATE_DIR}/service.sh"
}
module_prop() {
echo "id=${1}
name=${2}
version=v${3}
versionCode=${NEXT_VER_CODE}
author=j-hc
description=${4}" >"${MODULE_TEMPLATE_DIR}/module.prop"
if [ "$ENABLE_MAGISK_UPDATE" = true ]; then
echo "updateJson=${5}" >>"${MODULE_TEMPLATE_DIR}/module.prop"
fi
}