mirror of
https://github.com/j-hc/revanced-magisk-module.git
synced 2025-04-29 22:24:34 +02:00
unify configs for different sources
This commit is contained in:
parent
c28493f7f2
commit
40bb335737
17
.github/workflows/build.yml
vendored
17
.github/workflows/build.yml
vendored
@ -49,20 +49,13 @@ jobs:
|
||||
echo "${DELIM}" >> "$GITHUB_OUTPUT"
|
||||
cp -f build.md build.tmp
|
||||
|
||||
yt_op=$(find build -maxdepth 1 -name "youtube-*-magisk-*.zip" -printf '%P\n')
|
||||
if [ -z "$yt_op" ]; then
|
||||
echo "RELEASE_NAME=ReVanced" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "RELEASE_NAME=$yt_op" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Upload modules to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
body: ${{ steps.get_output.outputs.BUILD_LOG }}
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ./build/*
|
||||
release_name: ${{ steps.get_output.outputs.RELEASE_NAME }}
|
||||
release_name: ReVanced
|
||||
tag: ${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}
|
||||
file_glob: true
|
||||
overwrite: true
|
||||
@ -81,13 +74,11 @@ jobs:
|
||||
}"
|
||||
}
|
||||
|
||||
cd build || echo "build folder not found"; exit 1
|
||||
cd build || { echo "build folder not found"; exit 1; }
|
||||
for OUTPUT in *magisk*.zip; do
|
||||
[ "$OUTPUT" = "*magisk*.zip" ] && continue
|
||||
ZIP_S=$(unzip -p "$OUTPUT" module.prop)
|
||||
if ! UPDATE_JSON=$(echo "$ZIP_S" | grep updateJson); then
|
||||
continue
|
||||
fi
|
||||
if ! UPDATE_JSON=$(echo "$ZIP_S" | grep updateJson); then continue; fi
|
||||
UPDATE_JSON="${UPDATE_JSON##*/}"
|
||||
VER=$(echo "$ZIP_S" | grep version=)
|
||||
VER="${VER##*=}"
|
||||
@ -110,7 +101,7 @@ jobs:
|
||||
TG_TOKEN: ${{ secrets.TG_TOKEN }}
|
||||
if: env.TG_TOKEN != null
|
||||
run: |
|
||||
cd build || echo "build folder not found"; exit 1
|
||||
cd build || { echo "build folder not found"; exit 1; }
|
||||
|
||||
TG_CHAT="@rvc_magisk"
|
||||
NL=$'\n'
|
||||
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -43,7 +43,7 @@ jobs:
|
||||
PATCHES_SRC=$(toml_get "$(toml_get_table "")" patches-source) || PATCHES_SRC="revanced/revanced-patches"
|
||||
last_patches_url=$(gh_req https://api.github.com/repos/${PATCHES_SRC}/releases/latest - | json_get 'browser_download_url' | grep 'jar')
|
||||
last_patches=${last_patches_url##*/}
|
||||
cur_patches=$(sed -n 's/.*Patches: \(.*\)/\1/p' build.md | xargs)
|
||||
cur_patches=$(sed -n "s/.*Patches: .*${PATCHES_SRC%%/*}\/\(.*\)/\1/p" build.md | xargs)
|
||||
|
||||
echo "current patches version: $cur_patches"
|
||||
echo "latest patches version: $last_patches"
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -4,9 +4,7 @@
|
||||
/revanced-cache
|
||||
/temp
|
||||
/build
|
||||
/test
|
||||
test*
|
||||
/logs
|
||||
build.md
|
||||
cmpr
|
||||
test.toml
|
||||
options.toml
|
||||
|
@ -50,6 +50,3 @@ arch = "arm64-v8a" # 'arm64-v8a', 'arm-v7a' or 'all'. default: all
|
||||
# arch option is sometimes needed to be able to download the apks from apkmirror.
|
||||
# and does not affect anything else
|
||||
```
|
||||
|
||||
# Building ReVanced Extended
|
||||
Use [`config-rv-ex.toml`](./config-rv-ex.toml) as the config. Or you can run build.sh as: `./build.sh config-rv-ex.toml`
|
||||
|
@ -1,4 +1,4 @@
|
||||
#### ⚠️ Do not download modules from 3rd party sources like random websites you found on Google. Only use this repository. I am not responsible for anything they may contain.
|
||||
#### ⚠️ Do not download modules from 3rd party sources like random websites you found on Google. There are many that uses my modules and impersonates ReVanced.
|
||||
|
||||
# ReVanced Magisk Module
|
||||
[](https://t.me/rvc_magisk)
|
||||
@ -9,7 +9,7 @@ Extensive ReVanced builder
|
||||
|
||||
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.
|
||||
[**mindetach module**](https://github.com/j-hc/mindetach-magisk) in the releases section detaches YouTube and YouTube Music from Play Store and blocks their forced updates.
|
||||
|
||||
## Features
|
||||
* Support all present and future ReVanced and [ReVanced Extended](https://github.com/inotia00/revanced-patches) apps
|
||||
@ -34,7 +34,7 @@ Get the [latest CI release](https://github.com/j-hc/revanced-magisk-module/relea
|
||||
* Run the build [workflow](../../actions/workflows/build.yml)
|
||||
* Grab your modules and APKs from [releases](../../releases)
|
||||
|
||||
To add more ReVanced apps or build ReVanced Extended `config.toml`, read here [`CONFIG.md`](./CONFIG.md)
|
||||
also see here [`CONFIG.md`](./CONFIG.md)
|
||||
|
||||
# Building Locally
|
||||
## On Termux
|
||||
@ -43,8 +43,6 @@ bash <(curl -sSf https://raw.githubusercontent.com/j-hc/revanced-magisk-module/m
|
||||
```
|
||||
|
||||
## On Desktop
|
||||
Make sure you have JDK 17 and jq installed. Then run:
|
||||
|
||||
```console
|
||||
$ git clone --recurse https://github.com/j-hc/revanced-magisk-module
|
||||
$ cd revanced-magisk-module
|
||||
|
64
build.sh
64
build.sh
@ -4,19 +4,14 @@ set -euo pipefail
|
||||
trap "rm -rf temp/tmp.*; exit 130" INT
|
||||
|
||||
if [ "${1:-}" = "clean" ]; then
|
||||
rm -rf temp build logs
|
||||
rm -rf temp build logs build.md
|
||||
exit 0
|
||||
fi
|
||||
|
||||
source utils.sh
|
||||
|
||||
: >build.md
|
||||
|
||||
vtf() {
|
||||
if ! isoneof "${1}" "true" "false"; then
|
||||
abort "ERROR: '${1}' is not a valid option for '${2}': only true or false is allowed"
|
||||
fi
|
||||
}
|
||||
vtf() { if ! isoneof "${1}" "true" "false"; then abort "ERROR: '${1}' is not a valid option for '${2}': only true or false is allowed"; fi; }
|
||||
|
||||
toml_prep "$(cat 2>/dev/null "${1:-config.toml}")" || abort "could not find config file '${1:-config.toml}'\n\tUsage: $0 <config.toml>"
|
||||
# -- Main config --
|
||||
@ -38,18 +33,12 @@ fi
|
||||
LOGGING_F=$(toml_get "$main_config_t" logging-to-file) && vtf "$LOGGING_F" "logging-to-file" || LOGGING_F=false
|
||||
CONF_PATCHES_VER=$(toml_get "$main_config_t" patches-version) || CONF_PATCHES_VER=
|
||||
CONF_INTEGRATIONS_VER=$(toml_get "$main_config_t" integrations-version) || CONF_INTEGRATIONS_VER=
|
||||
|
||||
PATCHES_SRC=$(toml_get "$main_config_t" patches-source) || PATCHES_SRC="revanced/revanced-patches"
|
||||
INTEGRATIONS_SRC=$(toml_get "$main_config_t" integrations-source) || INTEGRATIONS_SRC="revanced/revanced-integrations"
|
||||
RV_BRAND=$(toml_get "$main_config_t" rv-brand) || RV_BRAND="ReVanced"
|
||||
RV_BRAND_F=${RV_BRAND,,}
|
||||
RV_BRAND_F=${RV_BRAND_F// /-}
|
||||
PREBUILTS_DIR="${TEMP_DIR}/tools-${RV_BRAND_F}"
|
||||
mkdir -p "$BUILD_DIR" "$PREBUILTS_DIR"
|
||||
DEF_PATCHES_SRC=$(toml_get "$main_config_t" patches-source) || DEF_PATCHES_SRC="revanced/revanced-patches"
|
||||
DEF_INTEGRATIONS_SRC=$(toml_get "$main_config_t" integrations-source) || DEF_INTEGRATIONS_SRC="revanced/revanced-integrations"
|
||||
# -- Main config --
|
||||
mkdir -p $TEMP_DIR
|
||||
|
||||
if ((COMPRESSION_LEVEL > 9)) || ((COMPRESSION_LEVEL < 0)); then abort "compression-level must be within 0-9"; fi
|
||||
if [ "${NOSET:-}" = true ]; then set_prebuilts; else get_prebuilts || set_prebuilts; fi
|
||||
if [ "$BUILD_MINDETACH_MODULE" = true ]; then : >$PKGS_LIST; fi
|
||||
if [ "$LOGGING_F" = true ]; then mkdir -p logs; fi
|
||||
|
||||
@ -59,7 +48,15 @@ java --version >/dev/null || abort "\`openjdk 17\` is not installed. install it
|
||||
zip --version >/dev/null || abort "\`zip\` is not installed. install it with 'apt install zip' or equivalent"
|
||||
# --
|
||||
|
||||
log "**App Versions:**"
|
||||
get_prebuilts
|
||||
set_prebuilts() {
|
||||
local -n aa=$1
|
||||
aa[cli]=$(find "$2" -name "revanced-cli*.jar" -type f -print -quit 2>/dev/null) && [ "${aa[cli]}" ] || return 1
|
||||
aa[integ]=$(find "$2" -name "revanced-integrations-*.apk" -type f -print -quit) && [ "${aa[integ]}" ] || return 1
|
||||
aa[ptjar]=$(find "$2" -name "revanced-patches-*.jar" -type f -print -quit) && [ "${aa[ptjar]}" ] || return 1
|
||||
aa[ptjs]=$(find "$2" -name "patches-*.json" -type f -print -quit) && [ "${aa[ptjs]}" ] || return 1
|
||||
}
|
||||
|
||||
idx=0
|
||||
for table_name in $(toml_get_table_names); do
|
||||
if [ -z "$table_name" ]; then continue; fi
|
||||
@ -69,11 +66,27 @@ for table_name in $(toml_get_table_names); do
|
||||
|
||||
if ((idx >= PARALLEL_JOBS)); then wait -n; else idx=$((idx + 1)); fi
|
||||
declare -A app_args
|
||||
patches_src=$(toml_get "$t" patches-source) || patches_src=$DEF_PATCHES_SRC
|
||||
integrations_src=$(toml_get "$t" integrations-source) || integrations_src=$DEF_INTEGRATIONS_SRC
|
||||
prebuilts_dir=${patches_src%/*}
|
||||
prebuilts_dir=${TEMP_DIR}/${prebuilts_dir//[^[:alnum:]]/}-rv
|
||||
if ! set_prebuilts app_args "$prebuilts_dir"; then
|
||||
mkdir -p "$BUILD_DIR" "$prebuilts_dir"
|
||||
get_rv_prebuilts "$integrations_src" "$patches_src" "$prebuilts_dir"
|
||||
set_prebuilts app_args "$prebuilts_dir"
|
||||
fi
|
||||
app_args[cli]=$(find "$prebuilts_dir" -name "revanced-cli*.jar" -type f -print -quit)
|
||||
app_args[integ]=$(find "$prebuilts_dir" -name "revanced-integrations-*.apk" -type f -print -quit)
|
||||
app_args[ptjar]=$(find "$prebuilts_dir" -name "revanced-patches-*.jar" -type f -print -quit)
|
||||
app_args[ptjs]=$(find "$prebuilts_dir" -name "patches-*.json" -type f -print -quit)
|
||||
app_args[rv_brand]=$(toml_get "$t" rv-brand) || app_args[rv_brand]="ReVanced"
|
||||
|
||||
app_args[excluded_patches]=$(toml_get "$t" excluded-patches) || app_args[excluded_patches]=""
|
||||
app_args[included_patches]=$(toml_get "$t" included-patches) || app_args[included_patches]=""
|
||||
app_args[exclusive_patches]=$(toml_get "$t" exclusive-patches) && vtf "${app_args[exclusive_patches]}" "exclusive-patches" || app_args[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]=$table_name
|
||||
app_args[table]=$table_name
|
||||
app_args[build_mode]=$(toml_get "$t" build-mode) && {
|
||||
if ! isoneof "${app_args[build_mode]}" both apk module; then
|
||||
abort "ERROR: build-mode '${app_args[build_mode]}' is not a valid option for '${table_name}': only 'both', 'apk' or 'module' is allowed"
|
||||
@ -93,9 +106,7 @@ for table_name in $(toml_get_table_names); do
|
||||
app_args[apkmirror_dlurl]=${app_args[apkmirror_dlurl]%/}
|
||||
app_args[dl_from]=apkmirror
|
||||
} || app_args[apkmirror_dlurl]=""
|
||||
if [ -z "${app_args[dl_from]:-}" ]; then
|
||||
abort "ERROR: no 'apkmirror_dlurl', 'uptodown_dlurl' or 'apkmonk_dlurl' option was set for '$table_name'."
|
||||
fi
|
||||
if [ -z "${app_args[dl_from]:-}" ]; then abort "ERROR: no 'apkmirror_dlurl', 'uptodown_dlurl' or 'apkmonk_dlurl' option was set for '$table_name'."; fi
|
||||
app_args[arch]=$(toml_get "$t" arch) && {
|
||||
if ! isoneof "${app_args[arch]}" all arm64-v8a arm-v7a; then
|
||||
abort "ERROR: arch '${app_args[arch]}' is not a valid option for '${table_name}': only 'all', 'arm64-v8a', 'arm-v7a' is allowed"
|
||||
@ -104,14 +115,9 @@ for table_name in $(toml_get_table_names); do
|
||||
app_args[include_stock]=$(toml_get "$t" include-stock) || app_args[include_stock]=true && vtf "${app_args[include_stock]}" "include-stock"
|
||||
app_args[merge_integrations]=$(toml_get "$t" merge-integrations) || app_args[merge_integrations]=true && vtf "${app_args[merge_integrations]}" "merge-integrations"
|
||||
app_args[dpi]=$(toml_get "$t" dpi) || app_args[dpi]="nodpi"
|
||||
app_args[module_prop_name]=$(toml_get "$t" module-prop-name) || {
|
||||
app_name_l=${app_args[app_name],,}
|
||||
if [ "${app_args[arch]}" = "all" ]; then
|
||||
app_args[module_prop_name]="${app_name_l}-${RV_BRAND_F}-jhc"
|
||||
else
|
||||
app_args[module_prop_name]="${app_name_l}-${app_args[arch]}-${RV_BRAND_F}-jhc"
|
||||
fi
|
||||
}
|
||||
table_name_f=${table_name,,}
|
||||
table_name_f=${table_name_f// /-}
|
||||
app_args[module_prop_name]=$(toml_get "$t" module-prop-name) || app_args[module_prop_name]="${table_name_f}-jhc"
|
||||
if [ "$LOGGING_F" = true ]; then
|
||||
logf=logs/"${table_name,,}.log"
|
||||
: >"$logf"
|
||||
@ -139,5 +145,7 @@ if [ "$youtube_mode" != module ] || [ "$music_arm_mode" != module ] || [ "$music
|
||||
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)"
|
||||
log "\n---\nChangelog:"
|
||||
log "$(cat $TEMP_DIR/*-rv/changelog.md)"
|
||||
|
||||
pr "Done"
|
||||
|
@ -1,36 +0,0 @@
|
||||
# see https://github.com/j-hc/revanced-magisk-module/blob/main/CONFIG.md for more detailed explanations
|
||||
compression-level = 9 # compression level for module zips. between 1 and 9
|
||||
logging-to-file = true # enables logging of every patch process to a seperate file
|
||||
enable-magisk-update = true # set this to false if you do not want to receive updates for the module in magisk app
|
||||
build-mindetach-module = true
|
||||
|
||||
# extended
|
||||
patches-source = "inotia00/revanced-patches"
|
||||
integrations-source = "inotia00/revanced-integrations"
|
||||
rv-brand = "ReVanced Extended"
|
||||
|
||||
[YouTube]
|
||||
build-mode = "both"
|
||||
excluded-patches = ""
|
||||
included-patches = ""
|
||||
version = "auto"
|
||||
exclusive-patches = false
|
||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube/"
|
||||
|
||||
[Music-arm64]
|
||||
build-mode = "both"
|
||||
app-name = "Music"
|
||||
excluded-patches = ""
|
||||
included-patches = ""
|
||||
version = "auto"
|
||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music/"
|
||||
arch = "arm64-v8a"
|
||||
|
||||
[Music-arm]
|
||||
build-mode = "both"
|
||||
app-name = "Music"
|
||||
excluded-patches = ""
|
||||
included-patches = ""
|
||||
version = "auto"
|
||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music/"
|
||||
arch = "arm-v7a"
|
32
config.toml
32
config.toml
@ -2,25 +2,32 @@ logging-to-file = true # enables logging of every patch process to a sepe
|
||||
enable-magisk-update = true # set this to false if you do not want to receive updates for the module in magisk app
|
||||
build-mindetach-module = true
|
||||
|
||||
# add 'enabled = false' for not patching a specific app or remove its entry
|
||||
# add 'enabled = false' for not patching a specific app or remove it from the config
|
||||
# see https://github.com/j-hc/revanced-magisk-module/blob/main/CONFIG.md for more detailed explanations
|
||||
|
||||
[YouTube]
|
||||
enabled = true
|
||||
build-mode = "both" # 'both', 'apk' or 'module'
|
||||
excluded-patches = "" # space-seperated patches to exclude (multiline strings are not supported)
|
||||
included-patches = "" # space-seperated patches to include (non-excluded patches are included by default)
|
||||
version = "auto" # 'auto', 'latest', 'beta' or a custom one like '17.40.41'
|
||||
exclusive-patches = false # excludes all patches by default
|
||||
exclusive-patches = false # excludes all patches by default and only applies included-patches
|
||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube/"
|
||||
module-prop-name = "ytrv-magisk"
|
||||
|
||||
[YouTube-Extended]
|
||||
app-name = "YouTube"
|
||||
patches-source = "inotia00/revanced-patches"
|
||||
integrations-source = "inotia00/revanced-integrations"
|
||||
rv-brand = "ReVanced Extended"
|
||||
build-mode = "both"
|
||||
excluded-patches = ""
|
||||
included-patches = ""
|
||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube/"
|
||||
|
||||
[Music-arm64]
|
||||
build-mode = "both"
|
||||
app-name = "Music"
|
||||
excluded-patches = ""
|
||||
included-patches = ""
|
||||
version = "auto"
|
||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music/"
|
||||
module-prop-name = "ytmusicrv-magisk"
|
||||
arch = "arm64-v8a"
|
||||
@ -29,8 +36,6 @@ arch = "arm64-v8a"
|
||||
build-mode = "both"
|
||||
app-name = "Music"
|
||||
excluded-patches = ""
|
||||
included-patches = ""
|
||||
version = "auto"
|
||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music/"
|
||||
module-prop-name = "ytmusicrv-arm-magisk"
|
||||
arch = "arm-v7a"
|
||||
@ -41,24 +46,19 @@ excluded-patches = "hide-views-stats"
|
||||
version = "auto"
|
||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/twitter-inc/twitter/"
|
||||
|
||||
[Reddit]
|
||||
build-mode = "apk"
|
||||
version = "auto"
|
||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/redditinc/reddit/"
|
||||
|
||||
[Twitch]
|
||||
build-mode = "apk"
|
||||
version = "auto"
|
||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/twitch-interactive-inc/twitch/"
|
||||
|
||||
[TikTok]
|
||||
version = "auto"
|
||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/tiktok-pte-ltd/tik-tok-including-musical-ly/"
|
||||
|
||||
[Reddit]
|
||||
enabled = false
|
||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/redditinc/reddit/"
|
||||
|
||||
[Spotify]
|
||||
enabled = false
|
||||
build-mode = "apk"
|
||||
version = "auto"
|
||||
uptodown-dlurl = "https://spotify.en.uptodown.com/android"
|
||||
|
||||
[Citra]
|
||||
|
1
options.json
Normal file
1
options.json
Normal file
@ -0,0 +1 @@
|
||||
[]
|
173
utils.sh
173
utils.sh
@ -43,43 +43,41 @@ abort() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
get_prebuilts() {
|
||||
pr "Getting prebuilts"
|
||||
local rv_cli_url rv_integrations_url rv_patches rv_patches_changelog rv_patches_dl rv_patches_url rv_integrations_rel rv_patches_rel
|
||||
rv_cli_url=$(gh_req "https://api.github.com/repos/j-hc/revanced-cli/releases/latest" - | json_get 'browser_download_url') || return 1
|
||||
RV_CLI_JAR="${PREBUILTS_DIR}/${rv_cli_url##*/}"
|
||||
log "CLI: ${rv_cli_url##*/}"
|
||||
get_rv_prebuilts() {
|
||||
local integrations_src=$1 patches_src=$2 prebuilts_dir=$3
|
||||
pr "Getting prebuilts ($prebuilts_dir)"
|
||||
local rv_cli_url rv_integrations_url rv_patches rv_patches_changelog rv_patches_dl rv_patches_url rv_patches_json
|
||||
|
||||
if [ "$CONF_INTEGRATIONS_VER" ]; then
|
||||
rv_integrations_rel="https://api.github.com/repos/${INTEGRATIONS_SRC}/releases/tags/${CONF_INTEGRATIONS_VER}"
|
||||
else
|
||||
rv_integrations_rel="https://api.github.com/repos/${INTEGRATIONS_SRC}/releases/latest"
|
||||
fi
|
||||
if [ "$CONF_PATCHES_VER" ]; then
|
||||
rv_patches_rel="https://api.github.com/repos/${PATCHES_SRC}/releases/tags/${CONF_PATCHES_VER}"
|
||||
else
|
||||
rv_patches_rel="https://api.github.com/repos/${PATCHES_SRC}/releases/latest"
|
||||
fi
|
||||
rv_cli_url=$(gh_req "https://api.github.com/repos/j-hc/revanced-cli/releases/latest" - | json_get 'browser_download_url') || return 1
|
||||
local rv_cli_jar="${prebuilts_dir}/${rv_cli_url##*/}"
|
||||
log "CLI: $(cut -d/ -f4 <<<"$rv_cli_url")/$(cut -d/ -f9 <<<"$rv_cli_url")" "$prebuilts_dir/changelog.md"
|
||||
|
||||
local rv_integrations_rel="https://api.github.com/repos/${integrations_src}/releases/"
|
||||
if [ "$CONF_INTEGRATIONS_VER" ]; then rv_integrations_rel+="tags/${CONF_INTEGRATIONS_VER}"; else rv_integrations_rel+="latest"; fi
|
||||
local rv_patches_rel="https://api.github.com/repos/${patches_src}/releases/"
|
||||
if [ "$CONF_PATCHES_VER" ]; then rv_patches_rel+="tags/${CONF_PATCHES_VER}"; else rv_patches_rel+="latest"; fi
|
||||
|
||||
rv_integrations_url=$(gh_req "$rv_integrations_rel" - | json_get 'browser_download_url')
|
||||
RV_INTEGRATIONS_APK="${PREBUILTS_DIR}/${rv_integrations_url##*/}"
|
||||
log "Integrations: ${rv_integrations_url##*/}"
|
||||
local rv_integrations_apk="${prebuilts_dir}/${rv_integrations_url##*/}"
|
||||
log "Integrations: $(cut -d/ -f4 <<<"$rv_integrations_url")/$(cut -d/ -f9 <<<"$rv_integrations_url")" "$prebuilts_dir/changelog.md"
|
||||
|
||||
rv_patches=$(gh_req "$rv_patches_rel" -)
|
||||
rv_patches_changelog=$(json_get 'body' <<<"$rv_patches" | sed 's/\(\\n\)\+/\\n/g')
|
||||
rv_patches_dl=$(json_get 'browser_download_url' <<<"$rv_patches")
|
||||
RV_PATCHES_JSON="${PREBUILTS_DIR}/patches-$(json_get 'tag_name' <<<"$rv_patches").json"
|
||||
rv_patches_json="${prebuilts_dir}/patches-$(json_get 'tag_name' <<<"$rv_patches").json"
|
||||
rv_patches_url=$(grep 'jar' <<<"$rv_patches_dl")
|
||||
RV_PATCHES_JAR="${PREBUILTS_DIR}/${rv_patches_url##*/}"
|
||||
[ -f "$RV_PATCHES_JAR" ] || REBUILD=true
|
||||
log "Patches: ${rv_patches_url##*/}"
|
||||
log "\n${rv_patches_changelog//# [/### [}\n"
|
||||
local rv_patches_jar="${prebuilts_dir}/${rv_patches_url##*/}"
|
||||
[ -f "$rv_patches_jar" ] || REBUILD=true
|
||||
log "Patches: $(cut -d/ -f4 <<<"$rv_patches_url")/$(cut -d/ -f9 <<<"$rv_patches_url")" "$prebuilts_dir/changelog.md"
|
||||
log "\n${rv_patches_changelog//# [/### [}\n---\n" "$prebuilts_dir/changelog.md"
|
||||
|
||||
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"
|
||||
dl_if_dne "$RV_PATCHES_JSON" "$(grep 'json' <<<"$rv_patches_dl")"
|
||||
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"
|
||||
dl_if_dne "$rv_patches_json" "$(grep 'json' <<<"$rv_patches_dl")"
|
||||
}
|
||||
|
||||
get_prebuilts() {
|
||||
if [ "$OS" = Android ]; then
|
||||
local arch
|
||||
if [ "$(uname -m)" = aarch64 ]; then arch=arm64; else arch=arm; fi
|
||||
@ -92,11 +90,7 @@ get_prebuilts() {
|
||||
HTMLQ="${TEMP_DIR}/htmlq"
|
||||
if [ ! -f "${TEMP_DIR}/htmlq" ]; then
|
||||
if [ "$OS" = Android ]; then
|
||||
if [ "$arch" = arm64 ]; then
|
||||
arch=arm64-v8a
|
||||
else
|
||||
arch=armeabi-v7a
|
||||
fi
|
||||
if [ "$arch" = arm64 ]; then arch=arm64-v8a; else arch=armeabi-v7a; fi
|
||||
dl_if_dne ${TEMP_DIR}/htmlq https://github.com/j-hc/htmlq-ndk/releases/latest/download/htmlq-${arch}
|
||||
chmod +x $HTMLQ
|
||||
else
|
||||
@ -108,22 +102,6 @@ get_prebuilts() {
|
||||
fi
|
||||
}
|
||||
|
||||
set_prebuilts() {
|
||||
[ -d "$PREBUILTS_DIR" ] || abort "${PREBUILTS_DIR} directory could not be found"
|
||||
RV_CLI_JAR=$(find "$PREBUILTS_DIR" -maxdepth 1 -name "revanced-cli-*.jar" | tail -n1)
|
||||
[ "$RV_CLI_JAR" ] || abort "revanced cli not found"
|
||||
log "CLI: ${RV_CLI_JAR#"$PREBUILTS_DIR/"}"
|
||||
RV_INTEGRATIONS_APK=$(find "$PREBUILTS_DIR" -maxdepth 1 -name "revanced-integrations-*.apk" | tail -n1)
|
||||
[ "$RV_INTEGRATIONS_APK" ] || abort "revanced integrations not found"
|
||||
log "Integrations: ${RV_INTEGRATIONS_APK#"$PREBUILTS_DIR/"}"
|
||||
RV_PATCHES_JAR=$(find "$PREBUILTS_DIR" -maxdepth 1 -name "revanced-patches-*.jar" | tail -n1)
|
||||
[ "$RV_PATCHES_JAR" ] || abort "revanced patches not found"
|
||||
log "Patches: ${RV_PATCHES_JAR#"$PREBUILTS_DIR/"}"
|
||||
RV_PATCHES_JSON=$(find "$PREBUILTS_DIR" -maxdepth 1 -name "patches-*.json" | tail -n1)
|
||||
[ "$RV_PATCHES_JSON" ] || abort "patches.json not found"
|
||||
HTMLQ="${TEMP_DIR}/htmlq"
|
||||
}
|
||||
|
||||
_req() {
|
||||
if [ "$2" = - ]; then
|
||||
wget -nv -O "$2" --header="$3" "$1"
|
||||
@ -137,7 +115,7 @@ _req() {
|
||||
req() { _req "$1" "$2" "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0"; }
|
||||
gh_req() { _req "$1" "$2" "$GH_HEADER"; }
|
||||
|
||||
log() { echo -e "$1 " >>build.md; }
|
||||
log() { echo -e "$1 " >>"${2:-build.md}"; }
|
||||
get_largest_ver() {
|
||||
local vers m
|
||||
vers=$(tee)
|
||||
@ -159,11 +137,15 @@ get_patch_last_supported_ver() {
|
||||
| select(.compatiblePackages[].name==\"${1}\")
|
||||
| select(${inc_sel})
|
||||
| select(${exc_sel:-true})
|
||||
| .compatiblePackages[].versions" "$RV_PATCHES_JSON" |
|
||||
| .compatiblePackages[].versions" "$5" |
|
||||
tr -d ' ,\t[]"' | grep -v '^$' | sort | uniq -c | sort -nr | head -1 | xargs | cut -d' ' -f2 || return 1
|
||||
}
|
||||
|
||||
dl_if_dne() {
|
||||
[ "${DRYRUN:-}" ] && {
|
||||
: >"$1"
|
||||
return 0
|
||||
}
|
||||
if [ ! -f "$1" ]; then
|
||||
pr "Getting '$1' from '$2'"
|
||||
req "$2" "$1"
|
||||
@ -181,7 +163,7 @@ isoneof() {
|
||||
dl_apkmirror() {
|
||||
local url=$1 version=${2// /-} output=$3 apkorbundle=$4 arch=$5 dpi=$6
|
||||
[ "${DRYRUN:-}" ] && {
|
||||
echo >"$output"
|
||||
: >"$output"
|
||||
return 0
|
||||
}
|
||||
local resp node app_table dlurl=""
|
||||
@ -253,12 +235,10 @@ get_apkmonk_pkg_name() { grep -oP '.*apkmonk\.com\/app\/\K([,\w,\.]*)' <<<"$1";
|
||||
# --------------------------------------------------
|
||||
|
||||
patch_apk() {
|
||||
local stock_input=$1 patched_apk=$2 patcher_args=$3
|
||||
local stock_input=$1 patched_apk=$2 patcher_args=$3 rv_cli_jar=$4 rv_patches_jar=$5
|
||||
declare -r tdir=$(mktemp -d -p $TEMP_DIR)
|
||||
local cmd="java -jar $RV_CLI_JAR --rip-lib x86_64 --rip-lib x86 --temp-dir=$tdir -c -a $stock_input -o $patched_apk -b $RV_PATCHES_JAR --keystore=ks.keystore $patcher_args"
|
||||
if [ "$OS" = Android ]; then
|
||||
cmd+=" --custom-aapt2-binary=${TEMP_DIR}/aapt2"
|
||||
fi
|
||||
local cmd="java -jar $rv_cli_jar --rip-lib x86_64 --rip-lib x86 --temp-dir=$tdir -c -a $stock_input -o $patched_apk -b $rv_patches_jar --keystore=ks.keystore $patcher_args"
|
||||
if [ "$OS" = Android ]; then cmd+=" --custom-aapt2-binary=${TEMP_DIR}/aapt2"; fi
|
||||
pr "$cmd"
|
||||
if [ "${DRYRUN:-}" = true ]; then
|
||||
cp -f "$stock_input" "$patched_apk"
|
||||
@ -275,6 +255,7 @@ build_rv() {
|
||||
local app_name=${args[app_name]}
|
||||
local app_name_l=${app_name,,}
|
||||
app_name_l=${app_name_l// /-}
|
||||
local table=${args[table]}
|
||||
local dl_from=${args[dl_from]}
|
||||
local arch=${args[arch]}
|
||||
local p_patcher_args=()
|
||||
@ -295,7 +276,7 @@ build_rv() {
|
||||
if [ "$version_mode" = auto ]; then
|
||||
version=$(
|
||||
get_patch_last_supported_ver "$pkg_name" \
|
||||
"${args[included_patches]}" "${args[excluded_patches]}" "${args[exclusive_patches]}"
|
||||
"${args[included_patches]}" "${args[excluded_patches]}" "${args[exclusive_patches]}" "${args[ptjs]}"
|
||||
) || get_latest_ver=true
|
||||
elif isoneof "$version_mode" latest beta; then
|
||||
get_latest_ver=true
|
||||
@ -319,62 +300,58 @@ build_rv() {
|
||||
fi
|
||||
fi
|
||||
if [ -z "$version" ]; then
|
||||
epr "empty version, not building ${app_name}."
|
||||
epr "empty version, not building ${table}."
|
||||
return 0
|
||||
fi
|
||||
pr "Choosing version '${version}' (${app_name})"
|
||||
pr "Choosing version '${version}' (${table})"
|
||||
local version_f=${version// /}
|
||||
local stock_apk="${TEMP_DIR}/${pkg_name}-${version_f}-${arch}.apk"
|
||||
if [ ! -f "$stock_apk" ]; then
|
||||
for dl_p in apkmirror uptodown apkmonk; do
|
||||
if [ "$dl_p" = apkmirror ]; then
|
||||
if [ -z "${args[apkmirror_dlurl]}" ]; then continue; fi
|
||||
pr "Downloading '${app_name}' from APKMirror"
|
||||
pr "Downloading '${table}' from APKMirror"
|
||||
local apkm_arch
|
||||
if [ "$arch" = "all" ]; then apkm_arch="universal";
|
||||
elif [ "$arch" = "arm64-v8a" ]; then apkm_arch="arm64-v8a";
|
||||
if [ "$arch" = "all" ]; then
|
||||
apkm_arch="universal"
|
||||
elif [ "$arch" = "arm64-v8a" ]; then
|
||||
apkm_arch="arm64-v8a"
|
||||
elif [ "$arch" = "arm-v7a" ]; then apkm_arch="armeabi-v7a"; fi
|
||||
if ! dl_apkmirror "${args[apkmirror_dlurl]}" "$version" "$stock_apk" APK "$apkm_arch" "${args[dpi]}"; then
|
||||
epr "ERROR: Could not find any release of '${app_name}' with version '${version}', arch '${apkm_arch}' and dpi '${args[dpi]}' from APKMirror"
|
||||
epr "ERROR: Could not find any release of '${table}' with version '${version}', arch '${apkm_arch}' and dpi '${args[dpi]}' from APKMirror"
|
||||
continue
|
||||
fi
|
||||
break
|
||||
elif [ "$dl_p" = uptodown ]; then
|
||||
if [ -z "${args[uptodown_dlurl]}" ]; then continue; fi
|
||||
if [ -z "${uptwod_resp:-}" ]; then uptwod_resp=$(get_uptodown_resp "${args[uptodown_dlurl]}"); fi
|
||||
pr "Downloading '${app_name}' from Uptodown"
|
||||
pr "Downloading '${table}' from Uptodown"
|
||||
if ! dl_uptodown "$uptwod_resp" "$version" "$stock_apk"; then
|
||||
epr "ERROR: Could not download ${app_name} from Uptodown"
|
||||
epr "ERROR: Could not download ${table} from Uptodown"
|
||||
continue
|
||||
fi
|
||||
break
|
||||
elif [ "$dl_p" = apkmonk ]; then
|
||||
if [ -z "${args[apkmonk_dlurl]}" ]; then continue; fi
|
||||
if [ -z "${apkmonk_resp:-}" ]; then apkmonk_resp=$(get_apkmonk_resp "${args[apkmonk_dlurl]}"); fi
|
||||
pr "Downloading '${app_name}' from Apkmonk"
|
||||
pr "Downloading '${table}' from Apkmonk"
|
||||
if ! dl_apkmonk "$apkmonk_resp" "$version" "$stock_apk"; then
|
||||
epr "ERROR: Could not download ${app_name} from Apkmonk"
|
||||
epr "ERROR: Could not download ${table} from Apkmonk"
|
||||
continue
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ ! -f "$stock_apk" ]; then
|
||||
epr "ERROR: Could not download ${app_name} from any provider"
|
||||
epr "ERROR: Could not download ${table} from any provider"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
if [ "${arch}" = "all" ]; then
|
||||
grep -q "${app_name}:" build.md || log "${app_name}: ${version}"
|
||||
else
|
||||
grep -q "${app_name} (${arch}):" build.md || log "${app_name} (${arch}): ${version}"
|
||||
fi
|
||||
if [ "${args[merge_integrations]}" = true ]; then
|
||||
p_patcher_args+=("-m ${RV_INTEGRATIONS_APK}")
|
||||
fi
|
||||
log "${table}: ${version}"
|
||||
|
||||
if [ "${args[merge_integrations]}" = true ]; then p_patcher_args+=("-m ${args[integ]}"); fi
|
||||
local microg_patch
|
||||
microg_patch=$(jq -r ".[] | select(.compatiblePackages[].name==\"${pkg_name}\") | .name" "$RV_PATCHES_JSON" | grep -F microg || :)
|
||||
microg_patch=$(jq -r ".[] | select(.compatiblePackages[].name==\"${pkg_name}\") | .name" "${args[ptjs]}" | grep -F microg || :)
|
||||
if [ "$microg_patch" ]; then
|
||||
p_patcher_args=("${p_patcher_args[@]//-[ei] ${microg_patch}/}")
|
||||
fi
|
||||
@ -388,13 +365,13 @@ build_rv() {
|
||||
pr "Downloading '${app_name}' bundle from APKMirror"
|
||||
if dl_apkmirror "${args[apkmirror_dlurl]}" "$version" "$stock_bundle_apk" BUNDLE "" ""; then
|
||||
if (($(stat -c%s "$stock_apk") - $(stat -c%s "$stock_bundle_apk") > 10000000)); then
|
||||
pr "'${app_name}' bundle was downloaded successfully and will be used for the module"
|
||||
pr "'${table}' bundle was downloaded successfully and will be used for the module"
|
||||
is_bundle=true
|
||||
else
|
||||
pr "'${app_name}' bundle was downloaded but will not be used"
|
||||
pr "'${table}' bundle was downloaded but will not be used"
|
||||
fi
|
||||
else
|
||||
pr "'${app_name}' bundle was not found"
|
||||
pr "'${table}' bundle was not found"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@ -407,18 +384,20 @@ build_rv() {
|
||||
build_mode_arr=(apk module)
|
||||
fi
|
||||
local patcher_args patched_apk build_mode
|
||||
local rv_brand_f=${args[rv_brand],,}
|
||||
rv_brand_f=${rv_brand_f// /-}
|
||||
for build_mode in "${build_mode_arr[@]}"; do
|
||||
patcher_args=("${p_patcher_args[@]}")
|
||||
pr "Building '${app_name}' (${arch}) in '$build_mode' mode"
|
||||
pr "Building '${table}' in '$build_mode' mode"
|
||||
if [ "$microg_patch" ]; then
|
||||
patched_apk="${TEMP_DIR}/${app_name_l}-${RV_BRAND_F}-${version_f}-${arch}-${build_mode}.apk"
|
||||
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch}-${build_mode}.apk"
|
||||
if [ "$build_mode" = apk ]; then
|
||||
patcher_args+=("-i ${microg_patch}")
|
||||
elif [ "$build_mode" = module ]; then
|
||||
patcher_args+=("-e ${microg_patch}")
|
||||
fi
|
||||
else
|
||||
patched_apk="${TEMP_DIR}/${app_name_l}-${RV_BRAND_F}-${version_f}-${arch}.apk"
|
||||
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch}.apk"
|
||||
fi
|
||||
if [ "$build_mode" = module ]; then
|
||||
if [ $is_bundle = false ] || [ "${args[include_stock]}" = false ]; then
|
||||
@ -428,26 +407,23 @@ build_rv() {
|
||||
fi
|
||||
fi
|
||||
if [ ! -f "$patched_apk" ] || [ "$REBUILD" = true ]; then
|
||||
if ! patch_apk "$stock_apk" "$patched_apk" "${patcher_args[*]}"; then
|
||||
pr "Building '${app_name}' failed!"
|
||||
if ! patch_apk "$stock_apk" "$patched_apk" "${patcher_args[*]}" "${args[cli]}" "${args[ptjar]}"; then
|
||||
pr "Building '${table}' failed!"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
if [ "$build_mode" = apk ]; then
|
||||
local apk_output="${BUILD_DIR}/${app_name_l}-${RV_BRAND_F}-v${version_f}-${arch}.apk"
|
||||
local apk_output="${BUILD_DIR}/${app_name_l}-${rv_brand_f}-v${version_f}-${arch}.apk"
|
||||
cp -f "$patched_apk" "$apk_output"
|
||||
pr "Built ${app_name} (${arch}) (non-root): '${apk_output}'"
|
||||
pr "Built ${table} (non-root): '${apk_output}'"
|
||||
continue
|
||||
fi
|
||||
local base_template upj
|
||||
local base_template
|
||||
base_template=$(mktemp -d -p $TEMP_DIR)
|
||||
cp -a $MODULE_TEMPLATE_DIR/. "$base_template"
|
||||
if [ "$BUILD_MINDETACH_MODULE" = true ] && ! grep -q "$pkg_name" $PKGS_LIST; then echo "$pkg_name" >>$PKGS_LIST; fi
|
||||
if [ "$arch" = "all" ]; then
|
||||
upj="${app_name_l}-update.json"
|
||||
else
|
||||
upj="${app_name_l}-${arch}-update.json"
|
||||
fi
|
||||
local upj="${table,,}-update.json"
|
||||
|
||||
local isbndl extrct stock_apk_module
|
||||
if [ $is_bundle = true ]; then
|
||||
isbndl=":"
|
||||
@ -464,23 +440,22 @@ build_rv() {
|
||||
customize_sh "$pkg_name" "$version" "$arch" "$extrct" "$base_template"
|
||||
module_prop \
|
||||
"${args[module_prop_name]}" \
|
||||
"${app_name} ${RV_BRAND}" \
|
||||
"${app_name} ${args[rv_brand]}" \
|
||||
"$version" \
|
||||
"${app_name} ${RV_BRAND} Magisk module" \
|
||||
"${app_name} ${args[rv_brand]} Magisk module" \
|
||||
"https://raw.githubusercontent.com/${GITHUB_REPOSITORY:-}/update/${upj}" \
|
||||
"$base_template"
|
||||
|
||||
local module_output="${app_name_l}-${RV_BRAND_F}-magisk-v${version}-${arch}.zip"
|
||||
local module_output="${app_name_l}-${rv_brand_f}-magisk-v${version}-${arch}.zip"
|
||||
if [ ! -f "$module_output" ] || [ "$REBUILD" = true ]; then
|
||||
pr "Packing module ($app_name)"
|
||||
pr "Packing module $table"
|
||||
cp -f "$patched_apk" "${base_template}/base.apk"
|
||||
if [ "${args[include_stock]}" = true ]; then cp -f "$stock_apk_module" "${base_template}/${pkg_name}.apk"; fi
|
||||
pushd >/dev/null "$base_template" || abort "Module template dir not found"
|
||||
zip -"$COMPRESSION_LEVEL" -FSqr "../../${BUILD_DIR}/${module_output}" .
|
||||
popd >/dev/null || :
|
||||
fi
|
||||
|
||||
pr "Built ${app_name} (${arch}) (root): '${BUILD_DIR}/${module_output}'"
|
||||
pr "Built ${table} (root): '${BUILD_DIR}/${module_output}'"
|
||||
done
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user