mirror of
https://github.com/j-hc/revanced-magisk-module.git
synced 2025-06-13 05:37:48 +02:00
configuration rework and add spotify support
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
|||||||
source utils.sh
|
source utils.sh
|
||||||
|
|
||||||
is_youtube_latest() {
|
is_youtube_latest() {
|
||||||
if [[ $YT_PATCHER_ARGS == *"--experimental"* ]]; then
|
if [ "${YOUTUBE_MODE%/*}" = latest ]; then
|
||||||
declare -r cur_yt=$(sed -n 's/.*YouTube: \(.*\)/\1/p' build.md | xargs)
|
declare -r cur_yt=$(sed -n 's/.*YouTube: \(.*\)/\1/p' build.md | xargs)
|
||||||
[ -z "$cur_yt" ] && return 1 # empty, fail=>dont build
|
[ -z "$cur_yt" ] && return 1 # empty, fail=>dont build
|
||||||
declare -r last_ver=$(get_apk_vers "https://www.apkmirror.com/uploads/?appcategory=youtube" | get_largest_ver)
|
declare -r last_ver=$(get_apk_vers "https://www.apkmirror.com/uploads/?appcategory=youtube" | get_largest_ver)
|
||||||
|
39
build.conf
39
build.conf
@ -1,20 +1,31 @@
|
|||||||
# ex: for excluding patches: -e patchname -e anotherpatchname
|
# patches to exclude (white-space does not matter)
|
||||||
# if you add '--experimental' arg, you get latest version of apps ignoring the versions revanced-patches support
|
# example:
|
||||||
# if you remove '-e microg-support' arg, you get non-root builds
|
# YOUTUBE_EXCLUDED_PATCHES="
|
||||||
YT_PATCHER_ARGS="-e microg-support"
|
# patch1 another-patch
|
||||||
MUSIC_PATCHER_ARGS="-e music-microg-support"
|
# some-other-patch patch2 patch3
|
||||||
|
# "
|
||||||
|
# NO NEED TO PUT MICROG PATCHES IN THIS LIST. IT IS HANDLED BY THE MODE CONFIGURATION BELOW
|
||||||
|
YOUTUBE_EXCLUDED_PATCHES=""
|
||||||
|
MUSIC_EXCLUDED_PATCHES=""
|
||||||
|
|
||||||
BUILD_YT=true
|
# MODE: build-mode/version
|
||||||
BUILD_MUSIC_ARM64_V8A=true
|
# options: [module|apk|both|none]/[auto|latest|custom (like 17.36.42)]
|
||||||
BUILD_MUSIC_ARM_V7A=true
|
# examples: module/auto, both/17.40.41, apk/latest, module/17.36.42, apk/auto, none/none
|
||||||
BUILD_TWITTER=true
|
# 'auto' = selects according to the latest revanced-patches supported version
|
||||||
BUILD_REDDIT=true
|
# '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
|
||||||
|
TIKTOK_MODE=apk/latest
|
||||||
|
SPOTIFY_MODE=apk/latest
|
||||||
|
|
||||||
BUILD_WARN_WETTER=false
|
WARN_WETTER_MODE=none/latest
|
||||||
BUILD_TIKTOK=false
|
|
||||||
|
|
||||||
BUILD_MINDETACH_MODULE=true
|
MOUNT_DELAY=5 # some low-end phones cannot mount apks on boot without a delay. increase to something like 20 if needed.
|
||||||
MOUNT_DELAY=1 # 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
|
ENABLE_MAGISK_UPDATE=true # set this to false if you do not want to receive updates from magisk app
|
||||||
|
BUILD_MINDETACH_MODULE=false
|
||||||
|
|
||||||
UPDATE_PREBUILTS=true # dont touch this
|
UPDATE_PREBUILTS=true # dont touch this
|
||||||
|
27
build.sh
27
build.sh
@ -33,22 +33,31 @@ if [ "$UPDATE_PREBUILTS" = true ]; then get_prebuilts; else set_prebuilts; fi
|
|||||||
reset_template
|
reset_template
|
||||||
get_cmpr
|
get_cmpr
|
||||||
|
|
||||||
if [ "$BUILD_TWITTER" = true ]; then build_twitter; fi
|
if ((COMPRESSION_LEVEL > 9)) || ((COMPRESSION_LEVEL < 1)); then
|
||||||
if [ "$BUILD_REDDIT" = true ]; then build_reddit; fi
|
abort "COMPRESSION_LEVEL must be between 1 and 9"
|
||||||
if [ "$BUILD_WARN_WETTER" = true ]; then build_warn_wetter; fi
|
fi
|
||||||
if [ "$BUILD_TIKTOK" = true ]; then build_tiktok; fi
|
|
||||||
if [ "$BUILD_YT" = true ]; then build_yt; fi
|
build_youtube
|
||||||
if [ "$BUILD_MUSIC_ARM64_V8A" = true ]; then build_music $ARM64_V8A; fi
|
build_music $ARM64_V8A
|
||||||
if [ "$BUILD_MUSIC_ARM_V7A" = true ]; then build_music $ARM_V7A; fi
|
build_music $ARM_V7A
|
||||||
|
build_twitter
|
||||||
|
build_reddit
|
||||||
|
build_tiktok
|
||||||
|
build_spotify
|
||||||
|
build_warn_wetter
|
||||||
|
|
||||||
if [ "$BUILD_MINDETACH_MODULE" = true ]; then
|
if [ "$BUILD_MINDETACH_MODULE" = true ]; then
|
||||||
echo "Building mindetach module"
|
echo "Building mindetach module"
|
||||||
cd mindetach-magisk/mindetach/
|
cd mindetach-magisk/mindetach/
|
||||||
: >detach.txt
|
: >detach.txt
|
||||||
if [ "$BUILD_YT" = true ]; then echo "com.google.android.youtube" >>detach.txt; fi
|
if [ "${YOUTUBE_MODE%/*}" != none ]; then echo "com.google.android.youtube" >>detach.txt; fi
|
||||||
if [ "$BUILD_MUSIC_ARM64_V8A" = true ] || [ "$BUILD_MUSIC_ARM_V7A" = true ]; then echo "com.google.android.apps.youtube.music" >>detach.txt; fi
|
if [ "${MUSIC_ARM64_V8A_MODE%/*}" != none ] || [ "${MUSIC_ARM_V7A_MODE%/*}" != none ]; then
|
||||||
|
echo "com.google.android.apps.youtube.music" >>detach.txt
|
||||||
|
fi
|
||||||
zip -r ../../build/mindetach.zip .
|
zip -r ../../build/mindetach.zip .
|
||||||
cd ../../
|
cd ../../
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "\n[revanced-magisk-module](https://github.com/j-hc/revanced-magisk-module)"
|
log "\n[revanced-magisk-module](https://github.com/j-hc/revanced-magisk-module)"
|
||||||
|
|
||||||
reset_template
|
reset_template
|
||||||
|
310
utils.sh
310
utils.sh
@ -20,7 +20,7 @@ UNINSTALL_SH=$(cat $MODULE_SCRIPTS_DIR/uninstall.sh)
|
|||||||
|
|
||||||
json_get() {
|
json_get() {
|
||||||
local key=$1 grep_for=${2:-}
|
local key=$1 grep_for=${2:-}
|
||||||
grep "$key" | if [ "$grep_for" ]; then grep "$grep_for"; else cat; fi | sed -E 's/^[^:]*:\s?"(.*)",?/\1/'
|
grep -o "\"${key}\":[^\"]*\"[^\"]*\"" | sed -E 's/".*".*"(.*)"/\1/' | if [ "$grep_for" ]; then grep "$grep_for"; else cat; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
get_prebuilts() {
|
get_prebuilts() {
|
||||||
@ -40,7 +40,7 @@ get_prebuilts() {
|
|||||||
RV_PATCHES_URL=$(echo "$RV_PATCHES" | json_get 'browser_download_url' 'jar')
|
RV_PATCHES_URL=$(echo "$RV_PATCHES" | json_get 'browser_download_url' 'jar')
|
||||||
RV_PATCHES_JAR="${TEMP_DIR}/${RV_PATCHES_URL##*/}"
|
RV_PATCHES_JAR="${TEMP_DIR}/${RV_PATCHES_URL##*/}"
|
||||||
log "Patches: ${RV_PATCHES_URL##*/}"
|
log "Patches: ${RV_PATCHES_URL##*/}"
|
||||||
log "${RV_PATCHES_CHANGELOG//# [/### [}\n"
|
log "\n${RV_PATCHES_CHANGELOG//# [/### [}\n"
|
||||||
|
|
||||||
dl_if_dne "$RV_CLI_JAR" "$RV_CLI_URL"
|
dl_if_dne "$RV_CLI_JAR" "$RV_CLI_URL"
|
||||||
dl_if_dne "$RV_INTEGRATIONS_APK" "$RV_INTEGRATIONS_URL"
|
dl_if_dne "$RV_INTEGRATIONS_APK" "$RV_INTEGRATIONS_URL"
|
||||||
@ -79,7 +79,6 @@ reset_template() {
|
|||||||
|
|
||||||
req() { wget -nv -O "$2" --header="$WGET_HEADER" "$1"; }
|
req() { wget -nv -O "$2" --header="$WGET_HEADER" "$1"; }
|
||||||
log() { echo -e "$1 " >>build.md; }
|
log() { echo -e "$1 " >>build.md; }
|
||||||
get_apk_vers() { req "https://www.apkmirror.com/uploads/?appcategory=${1}" - | sed -n 's;.*Version:</span><span class="infoSlide-value">\(.*\) </span>.*;\1;p'; }
|
|
||||||
get_largest_ver() {
|
get_largest_ver() {
|
||||||
local max=0
|
local max=0
|
||||||
while read -r v || [ -n "$v" ]; do
|
while read -r v || [ -n "$v" ]; do
|
||||||
@ -99,20 +98,34 @@ dl_if_dne() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# if you are here to copy paste this piece of code, acknowledge it:)
|
# if you are here to copy paste this piece of code, acknowledge it:)
|
||||||
dl_apk() {
|
dl_apkmirror() {
|
||||||
local url=$1 regexp=$2 output=$3
|
local url=$1 regexp=$2 output=$3
|
||||||
url="https://www.apkmirror.com$(req "$url" - | tr '\n' ' ' | sed -n "s/href=\"/@/g; s;.*${regexp}.*;\1;p")"
|
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')"
|
||||||
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"
|
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() {
|
patch_apk() {
|
||||||
local stock_input=$1 patched_output=$2 patcher_args=$3
|
local stock_input=$1 patched_apk=$2 patcher_args=$3
|
||||||
if [ -f "$patched_output" ]; then return; fi
|
echo "java -jar $RV_CLI_JAR --rip-lib x86 --rip-lib x86_64 -c -a $stock_input -o $patched_apk -b $RV_PATCHES_JAR --keystore=ks.keystore $patcher_args"
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
# --rip-lib is only available in my own revanced-cli builds
|
# --rip-lib is only available in my own revanced-cli builds
|
||||||
java -jar "$RV_CLI_JAR" --rip-lib x86 --rip-lib x86_64 -c -a "$stock_input" -o "$patched_output" -b "$RV_PATCHES_JAR" --keystore=ks.keystore $patcher_args
|
java -jar "$RV_CLI_JAR" --rip-lib x86 --rip-lib x86_64 -c -a "$stock_input" -o "$patched_apk" -b "$RV_PATCHES_JAR" --keystore=ks.keystore $patcher_args
|
||||||
}
|
}
|
||||||
|
|
||||||
zip_module() {
|
zip_module() {
|
||||||
@ -120,7 +133,7 @@ zip_module() {
|
|||||||
cp -f "$patched_apk" "${MODULE_TEMPLATE_DIR}/base.apk"
|
cp -f "$patched_apk" "${MODULE_TEMPLATE_DIR}/base.apk"
|
||||||
cp -f "$stock_apk" "${MODULE_TEMPLATE_DIR}/${pkg_name}.apk"
|
cp -f "$stock_apk" "${MODULE_TEMPLATE_DIR}/${pkg_name}.apk"
|
||||||
cd "$MODULE_TEMPLATE_DIR" || abort "Module template dir not found"
|
cd "$MODULE_TEMPLATE_DIR" || abort "Module template dir not found"
|
||||||
zip -9 -FSr "../${BUILD_DIR}/${module_name}" .
|
zip -"$COMPRESSION_LEVEL" -FSr "../${BUILD_DIR}/${module_name}" .
|
||||||
cd ..
|
cd ..
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,9 +142,9 @@ select_ver() {
|
|||||||
last_ver=$(get_patch_last_supported_ver "$pkg_name")
|
last_ver=$(get_patch_last_supported_ver "$pkg_name")
|
||||||
if [ "$select_ver_experimental" = true ] || [ -z "$last_ver" ]; then
|
if [ "$select_ver_experimental" = true ] || [ -z "$last_ver" ]; then
|
||||||
if [ "$pkg_name" = "com.twitter.android" ]; then
|
if [ "$pkg_name" = "com.twitter.android" ]; then
|
||||||
last_ver=$(get_apk_vers "$apkmirror_category" | grep "release" | get_largest_ver)
|
last_ver=$(get_apkmirror_vers "$apkmirror_category" | grep "release" | get_largest_ver)
|
||||||
else
|
else
|
||||||
last_ver=$(get_apk_vers "$apkmirror_category" | get_largest_ver)
|
last_ver=$(get_apkmirror_vers "$apkmirror_category" | get_largest_ver)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "$last_ver"
|
echo "$last_ver"
|
||||||
@ -139,117 +152,168 @@ select_ver() {
|
|||||||
|
|
||||||
build_rv() {
|
build_rv() {
|
||||||
local -n args=$1
|
local -n args=$1
|
||||||
local version
|
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
|
reset_template
|
||||||
|
|
||||||
echo "Building ${args[app_name]} (${args[arch]})"
|
if [ "$mode_arg" = none ]; then
|
||||||
if [ "${args[is_module]}" = true ]; then
|
return
|
||||||
if [[ ${args[patcher_args]} == *"--experimental"* ]]; then
|
elif [ "$mode_arg" = module ]; then
|
||||||
local select_ver_experimental=true
|
build_mode_arr=(module)
|
||||||
else
|
elif [ "$mode_arg" = apk ]; then
|
||||||
local select_ver_experimental=false
|
build_mode_arr=(apk)
|
||||||
fi
|
elif [ "$mode_arg" = both ]; then
|
||||||
if [[ ${args[patcher_args]} != *-e\ ?(music-)microg-support* ]] &&
|
build_mode_arr=(apk module)
|
||||||
[[ ${args[patcher_args]} != *"--exclusive"* ]] ||
|
|
||||||
[[ ${args[patcher_args]} == *-i\ ?(music-)microg-support* ]]; then
|
|
||||||
local is_root=false
|
|
||||||
else
|
|
||||||
local is_root=true
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
local select_ver_experimental=true
|
echo "ERROR: undefined build mode for YouTube: '$mode_arg'"
|
||||||
local is_root=false
|
return
|
||||||
fi
|
fi
|
||||||
if [ $is_root = true ]; then
|
for build_mode in "${build_mode_arr[@]}"; do
|
||||||
local output_dir="$TEMP_DIR"
|
patcher_args="${args[patcher_args]:-}"
|
||||||
# --unsigned is only available in my revanced-cli builds
|
printf "Building '%s' (%s) in " "${args[app_name]}" "${args[arch]}"
|
||||||
if [ "${args[rip_all_libs]}" = true ]; then
|
if [ "$build_mode" = module ]; then echo "'module' mode"; else echo "'APK' mode"; fi
|
||||||
# native libraries are already extracted. remove them all to keep apks smol
|
|
||||||
args[patcher_args]="${args[patcher_args]} --unsigned --rip-lib arm64-v8a --rip-lib armeabi-v7a"
|
if [ "${args[microg_patch]:-}" ]; then
|
||||||
else
|
if [ "$build_mode" = module ]; then
|
||||||
args[patcher_args]="${args[patcher_args]} --unsigned"
|
patcher_args="$patcher_args -e ${args[microg_patch]}"
|
||||||
|
elif [[ "${args[patcher_args]}" = *"${args[microg_patch]}"* ]]; then
|
||||||
|
abort "UNREACHABLE $LINENO"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
if [ "$version_mode" = auto ] && [ $dl_from = apkmirror ]; then
|
||||||
local output_dir="$BUILD_DIR"
|
version=$(select_ver "${args[pkg_name]}" "${args[apkmirror_dlurl]##*/}" false)
|
||||||
fi
|
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}'"
|
||||||
|
|
||||||
version=$(select_ver "${args[pkg_name]}" "${args[apkmirror_dlurl]##*/}" $select_ver_experimental)
|
if [ "$build_mode" = module ]; then
|
||||||
echo "Choosing version '${version}'"
|
if [ "${args[rip_all_libs]:-}" = true ]; then
|
||||||
|
# --unsigned is only available in my revanced-cli builds
|
||||||
|
# native libraries are already extracted. remove them all to keep apks smol
|
||||||
|
patcher_args="$patcher_args --unsigned --rip-lib arm64-v8a --rip-lib armeabi-v7a"
|
||||||
|
else
|
||||||
|
patcher_args="$patcher_args --unsigned"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
local stock_apk="${TEMP_DIR}/${args[app_name],,}-stock-v${version}-${args[arch]}.apk"
|
|
||||||
local patched_apk="${output_dir}/${args[app_name],,}-revanced-v${version}-${args[arch]}.apk"
|
|
||||||
if [ ! -f "$stock_apk" ]; then
|
|
||||||
dl_apk "https://www.apkmirror.com/apk/${args[apkmirror_dlurl]}-${version//./-}-release/" \
|
|
||||||
"${args[regexp]}" \
|
|
||||||
"$stock_apk"
|
|
||||||
if [ "${args[arch]}" = "all" ]; then
|
if [ "${args[arch]}" = "all" ]; then
|
||||||
log "${args[app_name]}: ${version}"
|
log "${args[app_name]}: ${version}"
|
||||||
else
|
else
|
||||||
log "${args[app_name]} (${args[arch]}): ${version}"
|
log "${args[app_name]} (${args[arch]}): ${version}"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
patch_apk "$stock_apk" "$patched_apk" "${args[patcher_args]}"
|
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}'"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -f "$patched_apk" ]; then
|
uninstall_sh "${args[pkg_name]}"
|
||||||
echo "BUILD FAIL"
|
service_sh "${args[pkg_name]}"
|
||||||
return
|
postfsdata_sh "${args[pkg_name]}"
|
||||||
fi
|
customize_sh "${args[pkg_name]}" "${version}"
|
||||||
|
module_prop "${args[module_prop_name]}" \
|
||||||
|
"${args[app_name]} ReVanced" \
|
||||||
|
"${version}" \
|
||||||
|
"${args[app_name]} ReVanced Magisk module" \
|
||||||
|
"https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/update/${args[module_update_json]}"
|
||||||
|
|
||||||
if [ $is_root = false ]; then
|
local module_output="${args[app_name],,}-revanced-magisk-v${version}-${args[arch]}.zip"
|
||||||
echo "Built ${args[app_name]} (${args[arch]}) (non-root)"
|
zip_module "$patched_apk" "$module_output" "$stock_apk" "${args[pkg_name]}"
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
uninstall_sh "${args[pkg_name]}"
|
echo "Built ${args[app_name]} (${args[arch]}) (root): '${BUILD_DIR}/${module_output}'"
|
||||||
service_sh "${args[pkg_name]}"
|
done
|
||||||
postfsdata_sh "${args[pkg_name]}"
|
|
||||||
customize_sh "${args[pkg_name]}" "${version}"
|
|
||||||
module_prop "${args[module_prop_name]}" \
|
|
||||||
"${args[app_name]} ReVanced" \
|
|
||||||
"${version}" \
|
|
||||||
"${args[app_name]} ReVanced Magisk module" \
|
|
||||||
"https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/update/${args[module_update_json]}"
|
|
||||||
|
|
||||||
local module_output="${args[app_name],,}-revanced-magisk-v${version}-${args[arch]}.zip"
|
|
||||||
zip_module "$patched_apk" "$module_output" "$stock_apk" "${args[pkg_name]}"
|
|
||||||
|
|
||||||
echo "Built ${args[app_name]}: '${BUILD_DIR}/${module_output}'"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build_yt() {
|
excluded_patches() {
|
||||||
declare -A yt_args
|
if [ "$1" ]; then
|
||||||
yt_args[app_name]="YouTube"
|
echo "$1" | tr -d '\t\r' | tr ' ' '\n' | grep -v '^$' | sed 's/^/-e /' | paste -sd " " -
|
||||||
yt_args[is_module]=true
|
else
|
||||||
yt_args[patcher_args]="${YT_PATCHER_ARGS} -m ${RV_INTEGRATIONS_APK}"
|
echo ""
|
||||||
yt_args[arch]="all"
|
fi
|
||||||
yt_args[rip_all_libs]=true
|
}
|
||||||
yt_args[pkg_name]="com.google.android.youtube"
|
|
||||||
yt_args[apkmirror_dlurl]="google-inc/youtube/youtube"
|
|
||||||
yt_args[regexp]="APK</span>[^@]*@\([^#]*\)"
|
|
||||||
yt_args[module_prop_name]="ytrv-magisk"
|
|
||||||
#shellcheck disable=SC2034
|
|
||||||
yt_args[module_update_json]="yt-update.json"
|
|
||||||
|
|
||||||
build_rv yt_args
|
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]=true
|
||||||
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
build_music() {
|
build_music() {
|
||||||
declare -A ytmusic_args
|
declare -A ytmusic_args
|
||||||
local arch=$1
|
local arch=$1
|
||||||
ytmusic_args[app_name]="Music"
|
ytmusic_args[app_name]="Music"
|
||||||
ytmusic_args[is_module]=true
|
ytmusic_args[patcher_args]="$(excluded_patches "${MUSIC_EXCLUDED_PATCHES}")"
|
||||||
ytmusic_args[patcher_args]="${MUSIC_PATCHER_ARGS}"
|
ytmusic_args[microg_patch]="music-microg-support"
|
||||||
ytmusic_args[arch]=$arch
|
ytmusic_args[arch]=$arch
|
||||||
ytmusic_args[rip_all_libs]=false
|
|
||||||
ytmusic_args[pkg_name]="com.google.android.apps.youtube.music"
|
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"
|
ytmusic_args[apkmirror_dlurl]="google-inc/youtube-music/youtube-music"
|
||||||
if [ "$arch" = "$ARM64_V8A" ]; then
|
if [ "$arch" = "$ARM64_V8A" ]; then
|
||||||
ytmusic_args[regexp]='arm64-v8a</div>[^@]*@\([^"]*\)'
|
ytmusic_args[regexp]='arm64-v8a</div>[^@]*@\([^"]*\)'
|
||||||
ytmusic_args[module_prop_name]="ytmusicrv-magisk"
|
ytmusic_args[module_prop_name]="ytmusicrv-magisk"
|
||||||
|
ytmusic_args[mode]="$MUSIC_ARM64_V8A_MODE"
|
||||||
|
|
||||||
elif [ "$arch" = "$ARM_V7A" ]; then
|
elif [ "$arch" = "$ARM_V7A" ]; then
|
||||||
ytmusic_args[regexp]='armeabi-v7a</div>[^@]*@\([^"]*\)'
|
ytmusic_args[regexp]='armeabi-v7a</div>[^@]*@\([^"]*\)'
|
||||||
ytmusic_args[module_prop_name]="ytmusicrv-arm-magisk"
|
ytmusic_args[module_prop_name]="ytmusicrv-arm-magisk"
|
||||||
|
ytmusic_args[mode]="$MUSIC_ARM_V7A_MODE"
|
||||||
fi
|
fi
|
||||||
#shellcheck disable=SC2034
|
#shellcheck disable=SC2034
|
||||||
ytmusic_args[module_update_json]="music-update-${arch}.json"
|
ytmusic_args[module_update_json]="music-update-${arch}.json"
|
||||||
@ -260,13 +324,13 @@ build_music() {
|
|||||||
build_twitter() {
|
build_twitter() {
|
||||||
declare -A tw_args
|
declare -A tw_args
|
||||||
tw_args[app_name]="Twitter"
|
tw_args[app_name]="Twitter"
|
||||||
tw_args[is_module]=false
|
tw_args[mode]="$TWITTER_MODE"
|
||||||
tw_args[patcher_args]=""
|
|
||||||
tw_args[arch]="all"
|
|
||||||
tw_args[pkg_name]="com.twitter.android"
|
tw_args[pkg_name]="com.twitter.android"
|
||||||
tw_args[apkmirror_dlurl]="twitter-inc/twitter/twitter"
|
tw_args[apkmirror_dlurl]="twitter-inc/twitter/twitter"
|
||||||
|
tw_args[regexp]='APK</span>[^@]*@\([^#]*\)'
|
||||||
|
tw_args[module_prop_name]="twrv-magisk"
|
||||||
#shellcheck disable=SC2034
|
#shellcheck disable=SC2034
|
||||||
tw_args[regexp]="APK</span>[^@]*@\([^#]*\)"
|
tw_args[module_update_json]="tw-update.json"
|
||||||
|
|
||||||
build_rv tw_args
|
build_rv tw_args
|
||||||
}
|
}
|
||||||
@ -274,55 +338,65 @@ build_twitter() {
|
|||||||
build_reddit() {
|
build_reddit() {
|
||||||
declare -A reddit_args
|
declare -A reddit_args
|
||||||
reddit_args[app_name]="Reddit"
|
reddit_args[app_name]="Reddit"
|
||||||
reddit_args[is_module]=false
|
reddit_args[mode]="$REDDIT_MODE"
|
||||||
reddit_args[patcher_args]=""
|
reddit_args[pkg_name]="om.reddit.frontpage"
|
||||||
reddit_args[arch]="all"
|
|
||||||
reddit_args[pkg_name]="com.reddit.frontpage"
|
|
||||||
reddit_args[apkmirror_dlurl]="redditinc/reddit/reddit"
|
reddit_args[apkmirror_dlurl]="redditinc/reddit/reddit"
|
||||||
|
reddit_args[regexp]='APK</span>[^@]*@\([^#]*\)'
|
||||||
|
reddit_args[module_prop_name]="rditrv-magisk"
|
||||||
#shellcheck disable=SC2034
|
#shellcheck disable=SC2034
|
||||||
reddit_args[regexp]="APK</span>[^@]*@\([^#]*\)"
|
reddit_args[module_update_json]="rdit-update.json"
|
||||||
|
|
||||||
build_rv reddit_args
|
build_rv reddit_args
|
||||||
}
|
}
|
||||||
|
|
||||||
build_warn_wetter() {
|
|
||||||
declare -A warn_wetter_args
|
|
||||||
warn_wetter_args[app_name]="WarnWetter"
|
|
||||||
warn_wetter_args[is_module]=false
|
|
||||||
warn_wetter_args[patcher_args]=""
|
|
||||||
warn_wetter_args[arch]="all"
|
|
||||||
warn_wetter_args[pkg_name]="de.dwd.warnapp"
|
|
||||||
warn_wetter_args[apkmirror_dlurl]="deutscher-wetterdienst/warnwetter/warnwetter"
|
|
||||||
#shellcheck disable=SC2034
|
|
||||||
warn_wetter_args[regexp]="APK</span>[^@]*@\([^#]*\)"
|
|
||||||
|
|
||||||
build_rv warn_wetter_args
|
|
||||||
}
|
|
||||||
|
|
||||||
build_tiktok() {
|
build_tiktok() {
|
||||||
declare -A tiktok_args
|
declare -A tiktok_args
|
||||||
tiktok_args[app_name]="TikTok"
|
tiktok_args[app_name]="TikTok"
|
||||||
tiktok_args[is_module]=false
|
|
||||||
tiktok_args[patcher_args]="-m ${RV_INTEGRATIONS_APK}"
|
tiktok_args[patcher_args]="-m ${RV_INTEGRATIONS_APK}"
|
||||||
tiktok_args[arch]="all"
|
tiktok_args[mode]="$TIKTOK_MODE"
|
||||||
tiktok_args[pkg_name]="com.zhiliaoapp.musically"
|
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[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
|
#shellcheck disable=SC2034
|
||||||
tiktok_args[regexp]="APK</span>[^@]*@\([^#]*\)"
|
tiktok_args[module_update_json]="tt-update.json"
|
||||||
|
|
||||||
build_rv tiktok_args
|
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"; }
|
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"; }
|
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() {
|
service_sh() {
|
||||||
s="${SERVICE_SH//__MNTDLY/$MOUNT_DELAY}"
|
s="${SERVICE_SH//__MNTDLY/$MOUNT_DELAY}"
|
||||||
echo "${s//__PKGNAME/$1}" >"${MODULE_TEMPLATE_DIR}/service.sh"
|
echo "${s//__PKGNAME/$1}" >"${MODULE_TEMPLATE_DIR}/service.sh"
|
||||||
}
|
}
|
||||||
customize_sh() {
|
|
||||||
s="${CUSTOMIZE_SH//__PKGNAME/$1}"
|
|
||||||
echo "${s//__MDVRSN/$2}" >"${MODULE_TEMPLATE_DIR}/customize.sh"
|
|
||||||
}
|
|
||||||
|
|
||||||
module_prop() {
|
module_prop() {
|
||||||
echo "id=${1}
|
echo "id=${1}
|
||||||
|
Reference in New Issue
Block a user