diff --git a/CONFIG.md b/CONFIG.md
new file mode 100644
index 0000000..34d632f
--- /dev/null
+++ b/CONFIG.md
@@ -0,0 +1,29 @@
+# Config
+
+Adding a new app is as easy as this:
+```toml
+[Some-App]
+apkmirror-dlurl = "https://www.apkmirror.com/apk/inc/app" # download url for the app. if not set, uptodown is used but its support is lacking.
+```
+
+## If you'd like to get to know more about other options:
+
+There exists an example below with all defaults and all the keys explicitly set.
+Almost all keys are optional and are assigned their default values if not set explicitly.
+
+```toml
+[Some-App]
+app-name = "SomeApp" # if set, app name becomes SomeApp instead of Some-App. default is same as table-name
+enabled = true # whether to build the app. default: true
+build-mode = "both" # 'both', 'apk' or 'module'. default: apk
+excluded-patches = "some-patch" # whitespace seperated list of patches to exclude. default: "" (empty)
+included-patches = "patch-name" # whitespace seperated list of patches to include. default: "" (empty)
+version = "auto" # 'auto', 'latest' or a custom one e.g. '17.40.41'. default: auto
+exclusive-patches = false # exclude all patches by default. default: false
+microg-patch = "microg-support" # name of the microg-patch if exists for the app. default: "" (empty)
+apkmirror-dlurl = "https://www.apkmirror.com/apk/inc/app" # download url for the app. if not set, uptodown is used but its support is lacking.
+module-prop-name = "ytrv-magisk" # explicit magisk module prop name. not explicitly needed to be set.
+merge-integrations = true # whether to merge revanced integrations. default: false
+apkmirror-regex = 'APK[^@]*@\([^#]*\)' # regex used to get the dl url in apkmirror. default: APK[^@]*@\([^#]*\)
+ # this default gets the url to the non-bundle apk
+```
\ No newline at end of file
diff --git a/README.md b/README.md
index 8533ded..20fa3d8 100644
--- a/README.md
+++ b/README.md
@@ -2,12 +2,12 @@
[](https://github.com/j-hc/revanced-magisk-module/actions/workflows/build.yml)
[](https://github.com/j-hc/revanced-magisk-module/actions/workflows/ci.yml)
-You can get the [latest CI release from here](https://github.com/j-hc/revanced-magisk-module/releases).
+get the [latest CI release](https://github.com/j-hc/revanced-magisk-module/releases).
[**mindetach module**](https://github.com/j-hc/mindetach-magisk) in the releases section detaches YouTube and YouTube Music from Play Store and blocks it from updating them.
## Features
- * Can build Magisk modules or non-root APKs
+ * Can build Magisk modules and non-root APKs
* Updated daily with the latest versions of apps and patches in accordance with your configuration
* Cleans APKs from unneeded libs to make them smaller
* Fully open-source, every binary or APK is compiled without human intervention
@@ -18,18 +18,20 @@ You can get the [latest CI release from here](https://github.com/j-hc/revanced-m
* handle installation of the correct version of the stock app and all that
* mount the patched app immediately without needing to reboot
-#### **Note that the [CI workflow](../../actions/workflows/ci.yml) is scheduled to build the modules and APKs everyday if there is a change. You may want to disable it.**
+#### **Note that the [CI workflow](../../actions/workflows/ci.yml) is scheduled to build the modules and APKs everyday using GitHub Actions if there is a change in ReVanced patches. You may want to disable it.**
## To include/exclude patches
[**See the list of patches**](https://github.com/revanced/revanced-patches#-list-of-available-patches)
* Star the repo :eyes:
* [Fork the repo](https://github.com/j-hc/revanced-magisk-module/fork) or use it as a template
- * Edit the patcher args in [`build.conf`](./build.conf)
- * Run the [workflow](../../actions/workflows/build.yml)
- * Grab your modules from [releases](../../releases)
+ * Edit the options in [`config.toml`](./config.toml)
+ * Run the build [workflow](../../actions/workflows/build.yml)
+ * Grab your modules and APKs from [releases](../../releases)
-To be able to use non-root variants of YT and Music you will need to install [Vanced MicroG](https://github.com/TeamVanced/VancedMicroG/releases).
+To get to know more about `config.toml`, read here [`CONFIG.md`](./CONFIG.md)
+
+To be able to use non-root variants of YouTube and YT Music, install [Vanced MicroG](https://github.com/TeamVanced/VancedMicroG/releases).
# Building Locally
Make sure you have JDK 17 installed. Then run:
diff --git a/build.conf b/build.conf
deleted file mode 100644
index 2bb62ea..0000000
--- a/build.conf
+++ /dev/null
@@ -1,38 +0,0 @@
-# patches to exclude/include (white-space does not matter)
-# all the default patches are applied
-# example:
-# YOUTUBE_EXCLUDED_PATCHES="
-# patch1 another-patch
-# some-other-patch patch2 patch3
-# "
-# DO NOT PUT MICROG PATCHES IN ANY OF THESE LISTS. IT IS HANDLED BY THE MODE CONFIGURATION BELOW
-YOUTUBE_EXCLUDED_PATCHES=""
-YOUTUBE_INCLUDED_PATCHES="theme"
-MUSIC_EXCLUDED_PATCHES=""
-MUSIC_INCLUDED_PATCHES=""
-
-# MODE: build-mode/version
-# options: [module|apk|both|none]/[auto|latest|custom (like 17.36.42)]
-# examples: module/auto, both/17.40.41, apk/latest, module/17.36.42, apk/auto, none/none
-# 'auto' = selects according to the latest revanced-patches supported version
-# 'latest' = always latest
-YOUTUBE_MODE=both/auto
-MUSIC_ARM64_V8A_MODE=both/auto
-MUSIC_ARM_V7A_MODE=both/auto
-TWITTER_MODE=apk/latest
-REDDIT_MODE=apk/latest
-TWITCH_MODE=apk/latest
-TIKTOK_MODE=apk/27.2.5
-
-SPOTIFY_MODE=none/latest
-TICKTICK_MODE=none/latest
-WARN_WETTER_MODE=none/latest
-BACKDROPS_MODE=none/latest
-WINDY_MODE=none/latest
-
-MOUNT_DELAY=5 # some low-end phones cannot mount apks on boot without a delay. increase to something like 20 if needed.
-COMPRESSION_LEVEL=9 # compression level for module zips. between 1 and 9
-ENABLE_MAGISK_UPDATE=true # set this to false if you do not want to receive updates from magisk app
-BUILD_MINDETACH_MODULE=true
-
-UPDATE_PREBUILTS=true # dont touch this
diff --git a/build.sh b/build.sh
index 8b68da0..cf1ac87 100755
--- a/build.sh
+++ b/build.sh
@@ -2,9 +2,6 @@
set -eu -o pipefail
-source build.conf
-source utils.sh
-
print_usage() {
echo -e "Usage:\n${0} build|clean|reset-template"
}
@@ -13,7 +10,7 @@ if [ -z ${1+x} ]; then
print_usage
exit 0
elif [ "$1" = "clean" ]; then
- rm -rf revanced-cache build.md build
+ rm -rf temp/tmp.* build.md build
reset_template
exit 0
elif [ "$1" = "reset-template" ]; then
@@ -26,9 +23,16 @@ else
exit 1
fi
+source utils.sh
+trap "rm -rf temp/tmp.*" INT
+trap "kill 0" EXIT
+
: >build.md
mkdir -p "$BUILD_DIR" "$TEMP_DIR"
+toml_prep "$(cat config.toml)"
+read_main_config
+
if [ "$UPDATE_PREBUILTS" = true ]; then get_prebuilts; else set_prebuilts; fi
reset_template
get_cmpr
@@ -36,39 +40,65 @@ get_cmpr
if ((COMPRESSION_LEVEL > 9)) || ((COMPRESSION_LEVEL < 1)); then
abort "COMPRESSION_LEVEL must be between 1 and 9"
fi
+if [ "$BUILD_MINDETACH_MODULE" = true ]; then : >$PKGS_LIST; fi
-build_functions=(
- build_youtube build_music
- build_twitter build_reddit
- build_twitch build_tiktok
- build_spotify build_ticktick
- build_warn_wetter build_backdrops
- build_windy
-)
-
+# building from config
log "**App Versions:**"
-for f in "${build_functions[@]}"; do
- eval "$f &"
- while [ "$(jobs -r | wc -l)" -ge 3 ]; do
- sleep 5
- done
+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
+
+ 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" app-name) || app_args[allow_alpha_version]=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]=${app_args[apkmirror_dlurl]%/} || app_args[apkmirror_dlurl]=""
+ 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[^@]*@\([^#]*\)"
+ elif [ "${app_args[arch]}" = "arm64-v8a" ]; then
+ app_args[apkmirror_regex]='arm64-v8a[^@]*@\([^"]*\)'
+ elif [ "${app_args[arch]}" = "arm-v7a" ]; then
+ app_args[apkmirror_regex]='armeabi-v7a[^@]*@\([^"]*\)'
+ 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 &
+ while [ "$(jobs -r | wc -l)" -ge "$PARALLEL_JOBS" ]; do sleep 3; done
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
cd mindetach-magisk/mindetach/
- : >detach.txt
- if [ "${YOUTUBE_MODE%/*}" != apk ]; then echo "com.google.android.youtube" >>detach.txt; fi
- if [ "${MUSIC_ARM64_V8A_MODE%/*}" != apk ] || [ "${MUSIC_ARM_V7A_MODE%/*}" != apk ]; then
- echo "com.google.android.apps.youtube.music" >>detach.txt
- fi
zip -r ../../build/mindetach-"$(grep version= module.prop | cut -d= -f2)".zip .
cd ../../
fi
-if [[ "${YOUTUBE_MODE%/*}" =~ ^(apk|both)$ || "${MUSIC_ARM64_V8A_MODE%/*}" =~ ^(apk|both)$ || "${MUSIC_ARM_V7A_MODE%/*}" =~ ^(apk|both)$ ]]; then
+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)"
diff --git a/config.toml b/config.toml
new file mode 100644
index 0000000..13db920
--- /dev/null
+++ b/config.toml
@@ -0,0 +1,96 @@
+
+[main-config]
+mount-delay = 5 # some low-end phones cannot mount apks on boot without a delay. increase to something like 20 if needed.
+compression-level = 9 # compression level for module zips. between 1 and 9
+enable-magisk-update = true # set this to false if you do not want to receive updates from magisk app
+parallel-jobs = 3 # max number of concurrent building jobs at once
+update-prebuilts = true # dont touch this
+build-mindetach-module = true
+
+
+[YouTube]
+enabled = true # add 'enabled = false' key to entries to not build them
+build-mode = "both" # 'both', 'apk' or 'module'
+excluded-patches = "" # whitespace seperated list of patches to exclude
+included-patches = "theme" # whitespace seperated list of patches to include
+version = "auto" # 'auto', 'latest' or a custom one like '17.40.41'
+exclusive-patches = false # excludes all patches by default
+microg-patch = "microg-support"
+apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube/"
+module-prop-name = "ytrv-magisk"
+merge-integrations = true
+
+[Music-arm64]
+build-mode = "module"
+app-name = "Music"
+excluded-patches = ""
+included-patches = ""
+version = "auto"
+microg-patch = "music-microg-support"
+apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music/"
+module-prop-name = "ytmusicrv-magisk"
+arch = "arm64-v8a"
+merge-integrations = true
+
+[Music-arm]
+build-mode = "both"
+app-name = "Music"
+excluded-patches = ""
+included-patches = ""
+version = "auto"
+microg-patch = "music-microg-support"
+apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music/"
+module-prop-name = "ytmusicrv-arm-magisk"
+arch = "arm-v7a"
+
+[Twitter]
+build-mode = "both"
+excluded-patches = ""
+version = "latest"
+apkmirror-dlurl = "https://www.apkmirror.com/apk/twitter-inc/twitter/"
+
+[Reddit]
+build-mode = "apk"
+version = "latest"
+apkmirror-dlurl = "https://www.apkmirror.com/apk/redditinc/reddit/"
+
+[Twitch]
+build-mode = "apk"
+version = "latest"
+apkmirror-dlurl = "https://www.apkmirror.com/apk/twitch-interactive-inc/twitch/"
+merge-integrations = true
+
+[Tiktok]
+build-mode = "apk"
+version = "27.2.5"
+apkmirror-dlurl = "https://www.apkmirror.com/apk/tiktok-pte-ltd/tik-tok-including-musical-ly/"
+merge-integrations = true
+
+[Spotify]
+enabled = false
+build-mode = "apk"
+version = "latest"
+
+[TickTick]
+enabled = false
+build-mode = "apk"
+version = "latest"
+apkmirror-dlurl = "https://www.apkmirror.com/apk/appest-inc/ticktick-to-do-list-with-reminder-day-planner/"
+
+[WarnWetter]
+enabled = false
+version = "latest"
+build-mode = "apk"
+apkmirror-dlurl = "https://www.apkmirror.com/apk/appest-inc/deutscher-wetterdienst/warnwetter/"
+
+[Backdrops]
+enabled = false
+build-mode = "apk"
+version = "latest"
+apkmirror-dlurl = "https://www.apkmirror.com/apk/backdrops/backdrops-wallpapers/"
+
+[Windy]
+enabled = false
+build-mode = "apk"
+version = "latest"
+apkmirror-dlurl = "https://www.apkmirror.com/apk/windy-weather-world-inc/windy-wind-weather-forecast/"
diff --git a/scripts/customize.sh b/scripts/customize.sh
index 9a0746c..7f8dfa2 100755
--- a/scripts/customize.sh
+++ b/scripts/customize.sh
@@ -24,8 +24,7 @@ am force-stop __PKGNAME
BASEPATH=$(basepath)
if [ -n "$BASEPATH" ] && cmpr $BASEPATH $MODPATH/__PKGNAME.apk; then
- ui_print "* Installed __PKGNAME and module APKs are identical"
- ui_print "* Skipping stock APK installation"
+ ui_print "* Updating with stock APK is not needed"
else
ui_print "* Updating stock __PKGNAME"
set_perm $MODPATH/__PKGNAME.apk 1000 1000 644 u:object_r:apk_data_file:s0
@@ -45,12 +44,11 @@ ui_print "* Mounting __PKGNAME"
RVPATH=/data/adb/__PKGNAME_rv.apk
ln -f $MODPATH/base.apk $RVPATH
-if ! op=$(su -Mc mount -o bind $RVPATH $BASEPATH 2>&1); then
+if ! op=$(mount -o bind $RVPATH $BASEPATH 2>&1); then
ui_print "ERROR: Mount failed!"
abort "$op"
fi
rm -r $MODPATH/bin $MODPATH/__PKGNAME.apk
-rm -f /data/local/tmp/__PKGNAME_rv.apk
am force-stop __PKGNAME
ui_print "* Optimizing __PKGNAME"
diff --git a/scripts/service.sh b/scripts/service.sh
index 3884bb9..a5b17f5 100644
--- a/scripts/service.sh
+++ b/scripts/service.sh
@@ -10,5 +10,5 @@ BASEPATH=$(pm path __PKGNAME | grep base)
BASEPATH=${BASEPATH#*:}
if [ "$BASEPATH" ] && [ -d ${BASEPATH%base.apk}/lib ]; then
chcon u:object_r:apk_data_file:s0 $RVPATH
- su -Mc mount -o bind $RVPATH $BASEPATH
+ mount -o bind $RVPATH $BASEPATH
fi
diff --git a/utils.sh b/utils.sh
index e7a5c53..28f680b 100755
--- a/utils.sh
+++ b/utils.sh
@@ -6,6 +6,7 @@ MODULE_TEMPLATE_DIR="revanced-magisk"
MODULE_SCRIPTS_DIR="scripts"
TEMP_DIR="temp"
BUILD_DIR="build"
+PKGS_LIST="temp/module-pkgs"
GITHUB_REPOSITORY=${GITHUB_REPOSITORY:-$"j-hc/revanced-magisk-module"}
NEXT_VER_CODE=${NEXT_VER_CODE:-$(date +'%Y%m%d')}
@@ -20,6 +21,34 @@ json_get() {
grep -o "\"${1}\":[^\"]*\"[^\"]*\"" | sed -E 's/".*".*"(.*)"/\1/'
}
+toml_prep() {
+ __TOML__=$(echo "$1" | sed -r 's/^([^"]*"[^"]*")*([^#]*).*/\1\2/' | tr -d ' \t\r' | grep -v '^$')
+}
+
+toml_get_all_tables() {
+ echo "$__TOML__" | grep -x '\[.*\]' | tr -d '[]' || return 1
+}
+
+toml_get() {
+ local table=$1 key=$2
+ val=$(echo "$__TOML__" | sed -n "/\[${table}]/,/^\[.*]$/p" | grep "^${key}=")
+ if [ "$val" ]; then
+ echo "${val#*=}" | sed -e "s/^[\"']//" -e "s/[\"']$//"
+ else
+ return 1
+ fi
+}
+
+#shellcheck disable=SC2034
+read_main_config() {
+ MOUNT_DELAY=$(toml_get "main-config" mount-delay)
+ COMPRESSION_LEVEL=$(toml_get "main-config" compression-level)
+ ENABLE_MAGISK_UPDATE=$(toml_get "main-config" enable-magisk-update)
+ PARALLEL_JOBS=$(toml_get "main-config" parallel-jobs)
+ UPDATE_PREBUILTS=$(toml_get "main-config" update-prebuilts)
+ BUILD_MINDETACH_MODULE=$(toml_get "main-config" build-mindetach-module)
+}
+
get_prebuilts() {
echo "Getting prebuilts"
RV_CLI_URL=$(req https://api.github.com/repos/revanced/revanced-cli/releases/latest - | json_get 'browser_download_url')
@@ -97,7 +126,8 @@ dl_if_dne() {
# if you are here to copy paste this piece of code, acknowledge it:)
dl_apkmirror() {
local url=$1 version=$2 regexp=$3 output=$4
- url="https://www.apkmirror.com/apk/${url}/${url##*/}-${version//./-}-release/"
+ local resp
+ url="${url}/${url##*/}-${version//./-}-release/"
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')"
@@ -105,15 +135,15 @@ dl_apkmirror() {
req "$url" "$output"
}
get_apkmirror_vers() {
- local apkmirror_category=$1
- apkm_resp=$(req "https://www.apkmirror.com/uploads/?appcategory=${apkmirror_category}" -)
- apkm_name=$(echo "$apkm_resp" | sed -n 's;.*Latest \(.*\) Uploads.*;\1;p')
- vers=$(echo "$apkm_resp" | sed -n 's;.*Version:\(.*\) .*;\1;p')
- for v in $vers; do
- if ! grep -q "${apkm_name} ${v} beta" <<<"$apkm_resp"; then
- echo "$v"
- fi
- done
+ local apkmirror_category=$1 allow_alpha_version=$2
+ local vers
+ # apkm_resp=$(req "https://www.apkmirror.com/uploads/?appcategory=${apkmirror_category}" -)
+ # apkm_name=$(echo "$apkm_resp" | sed -n 's;.*Latest \(.*\) Uploads.*;\1;p')
+ vers=$(req "https://www.apkmirror.com/uploads/?appcategory=${apkmirror_category}" - | sed -n 's;.*Version:\(.*\) .*;\1;p')
+ if [ "$allow_alpha_version" = false ]; then grep -v -e "beta" -e "alpha" <<<"$vers"; else echo "$vers"; fi
+}
+get_apkmirror_pkg_name() {
+ req "$1" - | sed -n 's;.*id=\(.*\)" class="accent_color.*;\1;p'
}
get_uptodown_ver() {
local app_name=$1
@@ -144,44 +174,46 @@ zip_module() {
build_rv() {
local -n args=$1
- local version patcher_args dl_from build_mode_arr
- local mode_arg=${args[mode]%/*} version_mode=${args[mode]#*/}
- local arch=${args[arch]:-all} app_name_l=${args[app_name],,}
- if [ "${args[apkmirror_dlurl]:-}" ] && [ "${args[regexp]:-}" ]; then dl_from=apkmirror; else dl_from=uptodown; fi
+ local version patcher_args build_mode_arr
+ local mode_arg=${args[build_mode]} version_mode=${args[version]}
+ local app_name_l=${args[app_name],,}
+ local dl_from=${args[dl_from]}
+ local arch=${args[arch]}
- if [ "$mode_arg" = none ]; then
- return
- elif [ "$mode_arg" = module ]; then
+ if [ "$mode_arg" = module ]; then
build_mode_arr=(module)
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 ${args[app_name]}: '${mode_arg}'"
+ echo "ERROR: undefined build mode for '${args[app_name]}': '${mode_arg}'"
+ echo " only 'both', 'apk' or 'module' are allowed"
return 1
fi
for build_mode in "${build_mode_arr[@]}"; do
- patcher_args="${args[patcher_args]:-}"
- printf "Building '%s' (%s) in " "${args[app_name]}" "${arch}"
+ patcher_args="${args[patcher_args]}"
+ echo -n "Building '${args[app_name]}' (${arch}) in "
if [ "$build_mode" = module ]; then echo "'module' mode"; else echo "'APK' mode"; fi
- if [ "${args[microg_patch]:-}" ]; then
+ if [ "${args[microg_patch]}" ]; 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=$(get_patch_last_supported_ver "${args[pkg_name]}")
+
+ pkg_name=$(get_apkmirror_pkg_name "${args[apkmirror_dlurl]}")
+ if [ "$version_mode" = auto ] && [ "$dl_from" = apkmirror ]; then
+ version=$(get_patch_last_supported_ver "$pkg_name")
if [ -z "$version" ]; then
- version=$(get_apkmirror_vers "${args[apkmirror_dlurl]##*/}" | if [ "${args[pkg_name]}" = "com.twitter.android" ]; then grep release; else cat; fi | get_largest_ver)
+ version=$(get_apkmirror_vers "${args[apkmirror_dlurl]##*/}" "${args[allow_alpha_version]}" | get_largest_ver)
fi
elif [ "$version_mode" = latest ]; then
- if [ $dl_from = apkmirror ]; then
- version=$(get_apkmirror_vers "${args[apkmirror_dlurl]##*/}" | if [ "${args[pkg_name]}" = "com.twitter.android" ]; then grep release; else cat; fi | get_largest_ver)
- elif [ $dl_from = uptodown ]; then
+ if [ "$dl_from" = apkmirror ]; then
+ version=$(get_apkmirror_vers "${args[apkmirror_dlurl]##*/}" "${args[allow_alpha_version]}" | get_largest_ver)
+ elif [ "$dl_from" = uptodown ]; then
version=$(get_uptodown_ver "${app_name_l}")
fi
patcher_args="$patcher_args --experimental"
@@ -197,20 +229,20 @@ build_rv() {
local stock_apk="${TEMP_DIR}/${app_name_l}-stock-v${version}-${arch}.apk"
local apk_output="${BUILD_DIR}/${app_name_l}-revanced-v${version}-${arch}.apk"
- if [ "${args[microg_patch]:-}" ]; then
+ if [ "${args[microg_patch]}" ]; then
local patched_apk="${TEMP_DIR}/${app_name_l}-revanced-v${version}-${arch}-${build_mode}.apk"
else
local patched_apk="${TEMP_DIR}/${app_name_l}-revanced-v${version}-${arch}.apk"
fi
if [ ! -f "$stock_apk" ]; then
- if [ $dl_from = apkmirror ]; then
- echo "Downloading from APKMirror"
- if ! dl_apkmirror "${args[apkmirror_dlurl]}" "$version" "${args[regexp]}" "$stock_apk"; then
- echo "ERROR: Could not find version '${version}' for ${args[app_name]}"
+ if [ "$dl_from" = apkmirror ]; then
+ echo "Downloading '${args[app_name]}' from APKMirror"
+ if ! dl_apkmirror "${args[apkmirror_dlurl]}" "$version" "${args[apkmirror_regex]}" "$stock_apk"; then
+ echo "ERROR: Could not find any release of '${args[app_name]}' with the given version ('${version}') and regex"
return 1
fi
- elif [ $dl_from = uptodown ]; then
- echo "Downloading the latest version from Uptodown"
+ elif [ "$dl_from" = uptodown ]; then
+ echo "Downloading the latest version of '${args[app_name]}' from Uptodown"
if ! dl_uptodown "$app_name_l" "$stock_apk"; then
echo "ERROR: Could not download ${args[app_name]}"
return 1
@@ -226,7 +258,7 @@ build_rv() {
! grep -q "${args[app_name]} (${arch}):" build.md && log "${args[app_name]} (${arch}): ${version}"
fi
- [ ! -f "$patched_apk" ] && patch_apk "$stock_apk" "$patched_apk" "$patcher_args"
+ if [ ! -f "$patched_apk" ]; then patch_apk "$stock_apk" "$patched_apk" "$patcher_args"; fi
if [ ! -f "$patched_apk" ]; then
echo "BUILDING '${args[app_name]}' FAILED"
return
@@ -236,23 +268,19 @@ build_rv() {
echo "Built ${args[app_name]} (${arch}) (non-root): '${apk_output}'"
continue
fi
+ if ! grep -q "$pkg_name" $PKGS_LIST; then echo "$pkg_name" >>$PKGS_LIST; fi
declare -r base_template=$(mktemp -d -p $TEMP_DIR)
cp -a $MODULE_TEMPLATE_DIR/. "$base_template"
- uninstall_sh "${args[pkg_name]}" "$base_template"
- service_sh "${args[pkg_name]}" "$base_template"
- postfsdata_sh "${args[pkg_name]}" "$base_template"
- customize_sh "${args[pkg_name]}" "$base_template"
+ uninstall_sh "$pkg_name" "$base_template"
+ service_sh "$pkg_name" "$base_template"
+ postfsdata_sh "$pkg_name" "$base_template"
+ customize_sh "$pkg_name" "$base_template"
- local upj pn
+ local upj
upj=$([ "${arch}" = "all" ] && echo "${app_name_l}-update.json" || echo "${app_name_l}-${arch}-update.json")
- if [ "${args[module_prop_name]:-}" ]; then
- pn=${args[module_prop_name]}
- else
- pn=$([ "${arch}" = "all" ] && echo "${app_name_l}-rv-jhc-magisk" || echo "${app_name_l}-${arch}-rv-jhc-magisk")
- fi
- module_prop "$pn" \
+ module_prop "${args[module_prop_name]}" \
"${args[app_name]} ReVanced" \
"$version" \
"${args[app_name]} ReVanced Magisk module" \
@@ -260,7 +288,7 @@ build_rv() {
"$base_template"
local module_output="${app_name_l}-revanced-magisk-v${version}-${arch}.zip"
- zip_module "$patched_apk" "$module_output" "$stock_apk" "${args[pkg_name]}" "$base_template"
+ zip_module "$patched_apk" "$module_output" "$stock_apk" "$pkg_name" "$base_template"
rm -rf "$base_template"
echo "Built ${args[app_name]} (${arch}) (root): '${BUILD_DIR}/${module_output}'"
@@ -271,157 +299,6 @@ join_args() {
echo "$1" | tr -d '\t\r' | tr ' ' '\n' | grep -v '^$' | sed "s/^/${2} /" | paste -sd " " - || echo ""
}
-#shellcheck disable=SC2034
-build_youtube() {
- declare -A youtube_args
- youtube_args[app_name]="YouTube"
- youtube_args[patcher_args]="-m ${RV_INTEGRATIONS_APK} $(join_args "${YOUTUBE_EXCLUDED_PATCHES}" -e) $(join_args "${YOUTUBE_INCLUDED_PATCHES}" -i)"
- youtube_args[mode]="$YOUTUBE_MODE"
- youtube_args[microg_patch]="microg-support"
- youtube_args[pkg_name]="com.google.android.youtube"
- youtube_args[rip_all_libs]=true
- youtube_args[apkmirror_dlurl]="google-inc/youtube"
- youtube_args[regexp]="APK[^@]*@\([^#]*\)"
- youtube_args[module_prop_name]="ytrv-magisk"
-
- build_rv youtube_args
-}
-
-#shellcheck disable=SC2034
-build_music() {
- declare -A ytmusic_args
- ytmusic_args[app_name]="Music"
- ytmusic_args[patcher_args]="$(join_args "${MUSIC_EXCLUDED_PATCHES}" -e) $(join_args "${MUSIC_INCLUDED_PATCHES}" -i)"
- ytmusic_args[microg_patch]="music-microg-support"
- ytmusic_args[pkg_name]="com.google.android.apps.youtube.music"
- ytmusic_args[rip_all_libs]=false
- ytmusic_args[apkmirror_dlurl]="google-inc/youtube-music"
-
- for a in arm64-v8a arm-v7a; do
- if [ $a = arm64-v8a ]; then
- ytmusic_args[module_prop_name]="ytmusicrv-magisk"
- ytmusic_args[arch]=arm64-v8a
- ytmusic_args[regexp]='arm64-v8a[^@]*@\([^"]*\)'
- ytmusic_args[mode]="$MUSIC_ARM64_V8A_MODE"
- elif [ $a = arm-v7a ]; then
- ytmusic_args[module_prop_name]="ytmusicrv-arm-magisk"
- ytmusic_args[arch]=arm-v7a
- ytmusic_args[regexp]='armeabi-v7a[^@]*@\([^"]*\)'
- ytmusic_args[mode]="$MUSIC_ARM_V7A_MODE"
- fi
-
- build_rv ytmusic_args
- done
-}
-
-#shellcheck disable=SC2034
-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"
- tw_args[regexp]='APK[^@]*@\([^#]*\)'
-
- build_rv tw_args
-}
-
-#shellcheck disable=SC2034
-build_reddit() {
- declare -A reddit_args
- reddit_args[app_name]="Reddit"
- reddit_args[mode]="$REDDIT_MODE"
- reddit_args[pkg_name]="com.reddit.frontpage"
- reddit_args[apkmirror_dlurl]="redditinc/reddit"
- reddit_args[regexp]='APK[^@]*@\([^#]*\)'
-
- build_rv reddit_args
-}
-
-#shellcheck disable=SC2034
-build_twitch() {
- declare -A twitch_args
- twitch_args[app_name]="Twitch"
- twitch_args[patcher_args]="-m ${RV_INTEGRATIONS_APK}"
- twitch_args[mode]="$TWITCH_MODE"
- twitch_args[pkg_name]="tv.twitch.android.app"
- twitch_args[apkmirror_dlurl]="twitch-interactive-inc/twitch"
- twitch_args[regexp]='APK[^@]*@\([^#]*\)'
-
- build_rv twitch_args
-}
-
-#shellcheck disable=SC2034
-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"
- tiktok_args[regexp]='APK[^@]*@\([^#]*\)'
-
- build_rv tiktok_args
-}
-
-#shellcheck disable=SC2034
-build_spotify() {
- declare -A spotify_args
- spotify_args[app_name]="Spotify"
- spotify_args[mode]="$SPOTIFY_MODE"
- spotify_args[pkg_name]="com.spotify.music"
-
- build_rv spotify_args
-}
-
-#shellcheck disable=SC2034
-build_ticktick() {
- declare -A ticktick_args
- ticktick_args[app_name]="TickTick"
- ticktick_args[mode]="$TICKTICK_MODE"
- ticktick_args[pkg_name]="com.ticktick.task"
- ticktick_args[apkmirror_dlurl]="appest-inc/ticktick-to-do-list-with-reminder-day-planner"
- ticktick_args[regexp]='APK[^@]*@\([^#]*\)'
-
- build_rv ticktick_args
-}
-
-#shellcheck disable=SC2034
-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"
- warn_wetter_args[regexp]='APK[^@]*@\([^#]*\)'
-
- build_rv warn_wetter_args
-}
-
-#shellcheck disable=SC2034
-build_backdrops() {
- declare -A backdrops_args
- backdrops_args[app_name]="Backdrops"
- backdrops_args[mode]="$BACKDROPS_MODE"
- backdrops_args[pkg_name]="com.backdrops.wallpapers"
- backdrops_args[apkmirror_dlurl]="backdrops/backdrops-wallpapers"
- backdrops_args[regexp]='APK[^@]*@\([^#]*\)'
-
- build_rv backdrops_args
-}
-
-#shellcheck disable=SC2034
-build_windy() {
- declare -A windy_args
- windy_args[app_name]="Windy"
- windy_args[mode]="$WINDY_MODE"
- windy_args[pkg_name]="co.windyapp.android"
- windy_args[apkmirror_dlurl]="windy-weather-world-inc/windy-wind-weather-forecast"
- windy_args[regexp]='APK[^@]*@\([^#]*\)'
-
- build_rv windy_args
-}
-
postfsdata_sh() { echo "${POSTFSDATA_SH//__PKGNAME/$1}" >"${2}/post-fs-data.sh"; }
uninstall_sh() { echo "${UNINSTALL_SH//__PKGNAME/$1}" >"${2}/uninstall.sh"; }
customize_sh() { echo "${CUSTOMIZE_SH//__PKGNAME/$1}" >"${2}/customize.sh"; }