mirror of
https://github.com/j-hc/revanced-magisk-module.git
synced 2025-04-29 22:24:34 +02:00
update
This commit is contained in:
parent
76bc1055de
commit
53f738bc41
@ -18,13 +18,11 @@ compression-level = 9 # module zip compression level
|
|||||||
remove-rv-integrations-checks = true # remove checks from the revanced integrations
|
remove-rv-integrations-checks = true # remove checks from the revanced integrations
|
||||||
|
|
||||||
patches-source = "revanced/revanced-patches" # where to fetch patches bundle from. default: "revanced/revanced-patches"
|
patches-source = "revanced/revanced-patches" # where to fetch patches bundle from. default: "revanced/revanced-patches"
|
||||||
integrations-source = "revanced/revanced-integrations" # where to fetch integrations from. default: "revanced/revanced-integrations"
|
|
||||||
cli-source = "j-hc/revanced-cli" # where to fetch cli from. default: "j-hc/revanced-cli"
|
cli-source = "j-hc/revanced-cli" # where to fetch cli from. default: "j-hc/revanced-cli"
|
||||||
# options like cli-source can also set per app
|
# options like cli-source can also set per app
|
||||||
rv-brand = "ReVanced Extended" # rebrand from 'ReVanced' to something different. default: "ReVanced"
|
rv-brand = "ReVanced Extended" # rebrand from 'ReVanced' to something different. default: "ReVanced"
|
||||||
|
|
||||||
patches-version = "v2.160.0" # 'latest', 'dev', or a version number. default: "latest"
|
patches-version = "v2.160.0" # 'latest', 'dev', or a version number. default: "latest"
|
||||||
# integrations-version and cli-version can be also configured
|
|
||||||
|
|
||||||
[Some-App]
|
[Some-App]
|
||||||
app-name = "SomeApp" # if set, release name becomes SomeApp instead of Some-App. default is same as table name, which is 'Some-App' here.
|
app-name = "SomeApp" # if set, release name becomes SomeApp instead of Some-App. default is same as table name, which is 'Some-App' here.
|
||||||
|
BIN
bin/paccer.jar
BIN
bin/paccer.jar
Binary file not shown.
10
build.sh
10
build.sh
@ -23,10 +23,8 @@ fi
|
|||||||
REMOVE_RV_INTEGRATIONS_CHECKS=$(toml_get "$main_config_t" remove-rv-integrations-checks) || REMOVE_RV_INTEGRATIONS_CHECKS="true"
|
REMOVE_RV_INTEGRATIONS_CHECKS=$(toml_get "$main_config_t" remove-rv-integrations-checks) || REMOVE_RV_INTEGRATIONS_CHECKS="true"
|
||||||
|
|
||||||
DEF_PATCHES_VER=$(toml_get "$main_config_t" patches-version) || DEF_PATCHES_VER="latest"
|
DEF_PATCHES_VER=$(toml_get "$main_config_t" patches-version) || DEF_PATCHES_VER="latest"
|
||||||
DEF_INTEGRATIONS_VER=$(toml_get "$main_config_t" integrations-version) || DEF_INTEGRATIONS_VER="latest"
|
|
||||||
DEF_CLI_VER=$(toml_get "$main_config_t" cli-version) || DEF_CLI_VER="latest"
|
DEF_CLI_VER=$(toml_get "$main_config_t" cli-version) || DEF_CLI_VER="latest"
|
||||||
DEF_PATCHES_SRC=$(toml_get "$main_config_t" patches-source) || DEF_PATCHES_SRC="ReVanced/revanced-patches"
|
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"
|
|
||||||
DEF_CLI_SRC=$(toml_get "$main_config_t" cli-source) || DEF_CLI_SRC="j-hc/revanced-cli"
|
DEF_CLI_SRC=$(toml_get "$main_config_t" cli-source) || DEF_CLI_SRC="j-hc/revanced-cli"
|
||||||
DEF_RV_BRAND=$(toml_get "$main_config_t" rv-brand) || DEF_RV_BRAND="ReVanced"
|
DEF_RV_BRAND=$(toml_get "$main_config_t" rv-brand) || DEF_RV_BRAND="ReVanced"
|
||||||
mkdir -p "$TEMP_DIR" "$BUILD_DIR"
|
mkdir -p "$TEMP_DIR" "$BUILD_DIR"
|
||||||
@ -73,19 +71,15 @@ for table_name in $(toml_get_table_names); do
|
|||||||
declare -A app_args
|
declare -A app_args
|
||||||
patches_src=$(toml_get "$t" patches-source) || patches_src=$DEF_PATCHES_SRC
|
patches_src=$(toml_get "$t" patches-source) || patches_src=$DEF_PATCHES_SRC
|
||||||
patches_ver=$(toml_get "$t" patches-version) || patches_ver=$DEF_PATCHES_VER
|
patches_ver=$(toml_get "$t" patches-version) || patches_ver=$DEF_PATCHES_VER
|
||||||
integrations_src=$(toml_get "$t" integrations-source) || integrations_src=$DEF_INTEGRATIONS_SRC
|
|
||||||
integrations_ver=$(toml_get "$t" integrations-version) || integrations_ver=$DEF_INTEGRATIONS_VER
|
|
||||||
cli_src=$(toml_get "$t" cli-source) || cli_src=$DEF_CLI_SRC
|
cli_src=$(toml_get "$t" cli-source) || cli_src=$DEF_CLI_SRC
|
||||||
cli_ver=$(toml_get "$t" cli-version) || cli_ver=$DEF_CLI_VER
|
cli_ver=$(toml_get "$t" cli-version) || cli_ver=$DEF_CLI_VER
|
||||||
|
|
||||||
if ! RVP="$(get_rv_prebuilts "$cli_src" "$cli_ver" "$integrations_src" "$integrations_ver" "$patches_src" "$patches_ver")"; then
|
if ! RVP="$(get_rv_prebuilts "$cli_src" "$cli_ver" "$patches_src" "$patches_ver")"; then
|
||||||
abort "could not download rv prebuilts"
|
abort "could not download rv prebuilts"
|
||||||
fi
|
fi
|
||||||
read -r rv_cli_jar rv_integrations_apk rv_patches_jar rv_patches_json <<<"$RVP"
|
read -r rv_cli_jar rv_patches_jar <<<"$RVP"
|
||||||
app_args[cli]=$rv_cli_jar
|
app_args[cli]=$rv_cli_jar
|
||||||
app_args[integ]=$rv_integrations_apk
|
|
||||||
app_args[ptjar]=$rv_patches_jar
|
app_args[ptjar]=$rv_patches_jar
|
||||||
app_args[ptjs]=$rv_patches_json
|
|
||||||
if [[ -v cliriplib[${app_args[cli]}] ]]; then app_args[riplib]=${cliriplib[${app_args[cli]}]}; else
|
if [[ -v cliriplib[${app_args[cli]}] ]]; then app_args[riplib]=${cliriplib[${app_args[cli]}]}; else
|
||||||
if [[ $(java -jar "${app_args[cli]}" patch 2>&1) == *rip-lib* ]]; then
|
if [[ $(java -jar "${app_args[cli]}" patch 2>&1) == *rip-lib* ]]; then
|
||||||
cliriplib[${app_args[cli]}]=true
|
cliriplib[${app_args[cli]}]=true
|
||||||
|
59
config.toml
59
config.toml
@ -20,26 +20,35 @@ arch = "both"
|
|||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
|
||||||
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music"
|
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music"
|
||||||
|
|
||||||
[Music-Extended]
|
[Twitch]
|
||||||
app-name = "Music"
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/twitch-interactive-inc/twitch/"
|
||||||
patches-source = "inotia00/revanced-patches"
|
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/tv.twitch.android.app"
|
||||||
integrations-source = "inotia00/revanced-integrations"
|
|
||||||
cli-source = "inotia00/revanced-cli"
|
|
||||||
rv-brand = "ReVanced Extended"
|
|
||||||
build-mode = "both"
|
|
||||||
arch = "both"
|
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
|
|
||||||
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music"
|
|
||||||
|
|
||||||
[YouTube-Extended]
|
# [Music-Extended]
|
||||||
app-name = "YouTube"
|
# app-name = "Music"
|
||||||
patches-source = "inotia00/revanced-patches"
|
# patches-source = "inotia00/revanced-patches"
|
||||||
integrations-source = "inotia00/revanced-integrations"
|
# cli-source = "inotia00/revanced-cli"
|
||||||
cli-source = "inotia00/revanced-cli"
|
# rv-brand = "ReVanced Extended"
|
||||||
rv-brand = "ReVanced Extended"
|
# build-mode = "both"
|
||||||
build-mode = "both"
|
# arch = "both"
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube"
|
# apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
|
||||||
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.youtube"
|
# # archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music"
|
||||||
|
|
||||||
|
# [YouTube-Extended]
|
||||||
|
# app-name = "YouTube"
|
||||||
|
# patches-source = "inotia00/revanced-patches"
|
||||||
|
# cli-source = "inotia00/revanced-cli"
|
||||||
|
# rv-brand = "ReVanced Extended"
|
||||||
|
# build-mode = "both"
|
||||||
|
# apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube"
|
||||||
|
# # archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.youtube"
|
||||||
|
|
||||||
|
# [Reddit-Extended]
|
||||||
|
# patches-source = "inotia00/revanced-patches"
|
||||||
|
# cli-source = "inotia00/revanced-cli"
|
||||||
|
# rv-brand = "ReVanced Extended"
|
||||||
|
# apkmirror-dlurl = "https://www.apkmirror.com/apk/redditinc/reddit/"
|
||||||
|
# # archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.reddit.frontpage"
|
||||||
|
|
||||||
[Twitter]
|
[Twitter]
|
||||||
enabled = false
|
enabled = false
|
||||||
@ -48,18 +57,6 @@ build-mode = "apk"
|
|||||||
dpi = "120-640dpi"
|
dpi = "120-640dpi"
|
||||||
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.twitter.android"
|
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.twitter.android"
|
||||||
|
|
||||||
[Reddit-Extended]
|
|
||||||
patches-source = "inotia00/revanced-patches"
|
|
||||||
integrations-source = "inotia00/revanced-integrations"
|
|
||||||
cli-source = "inotia00/revanced-cli"
|
|
||||||
rv-brand = "ReVanced Extended"
|
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/redditinc/reddit/"
|
|
||||||
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.reddit.frontpage"
|
|
||||||
|
|
||||||
[Twitch]
|
|
||||||
enabled = false
|
|
||||||
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/tv.twitch.android.app"
|
|
||||||
|
|
||||||
[TikTok]
|
[TikTok]
|
||||||
enabled = false
|
enabled = false
|
||||||
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.zhiliaoapp.musically"
|
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.zhiliaoapp.musically"
|
||||||
|
@ -1 +0,0 @@
|
|||||||
[]
|
|
@ -44,7 +44,10 @@ if ! pmex path "$PKG_NAME" >&2; then
|
|||||||
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
||||||
if [ "${BASEPATH:1:4}" = data ]; then
|
if [ "${BASEPATH:1:4}" = data ]; then
|
||||||
if pmex uninstall -k --user 0 "$PKG_NAME" >&2; then
|
if pmex uninstall -k --user 0 "$PKG_NAME" >&2; then
|
||||||
|
rm -rf "$BASEPATH" 2>&1
|
||||||
ui_print "* Cleared existing $PKG_NAME package"
|
ui_print "* Cleared existing $PKG_NAME package"
|
||||||
|
ui_print "* Reboot and reflash"
|
||||||
|
abort
|
||||||
else abort "ERROR: pm uninstall failed"; fi
|
else abort "ERROR: pm uninstall failed"; fi
|
||||||
else ui_print "* Installed stock $PKG_NAME package"; fi
|
else ui_print "* Installed stock $PKG_NAME package"; fi
|
||||||
fi
|
fi
|
||||||
|
135
utils.sh
135
utils.sh
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
MODULE_TEMPLATE_DIR="revanced-magisk"
|
MODULE_TEMPLATE_DIR="revanced-magisk"
|
||||||
CWD=$(pwd)
|
CWD=$(pwd)
|
||||||
TEMP_DIR=${CWD}/"temp"
|
TEMP_DIR="temp"
|
||||||
BIN_DIR=${CWD}/"bin"
|
BIN_DIR="bin"
|
||||||
BUILD_DIR=${CWD}/"build"
|
BUILD_DIR="build"
|
||||||
|
|
||||||
if [ "${GITHUB_TOKEN-}" ]; then GH_HEADER="Authorization: token ${GITHUB_TOKEN}"; else GH_HEADER=; fi
|
if [ "${GITHUB_TOKEN-}" ]; then GH_HEADER="Authorization: token ${GITHUB_TOKEN}"; else GH_HEADER=; fi
|
||||||
NEXT_VER_CODE=${NEXT_VER_CODE:-$(date +'%Y%m%d')}
|
NEXT_VER_CODE=${NEXT_VER_CODE:-$(date +'%Y%m%d')}
|
||||||
@ -36,19 +36,19 @@ abort() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_rv_prebuilts() {
|
get_rv_prebuilts() {
|
||||||
local cli_src=$1 cli_ver=$2 integrations_src=$3 integrations_ver=$4 patches_src=$5 patches_ver=$6
|
local cli_src=$1 cli_ver=$2 patches_src=$3 patches_ver=$4
|
||||||
local integs_file=""
|
|
||||||
pr "Getting prebuilts (${patches_src%/*})" >&2
|
pr "Getting prebuilts (${patches_src%/*})" >&2
|
||||||
local cl_dir=${patches_src%/*}
|
local cl_dir=${patches_src%/*}
|
||||||
cl_dir=${TEMP_DIR}/${cl_dir,,}-rv
|
cl_dir=${TEMP_DIR}/${cl_dir,,}-rv
|
||||||
[ -d "$cl_dir" ] || mkdir "$cl_dir"
|
[ -d "$cl_dir" ] || mkdir "$cl_dir"
|
||||||
for src_ver in "$cli_src CLI $cli_ver" "$integrations_src Integrations $integrations_ver" "$patches_src Patches $patches_ver"; do
|
for src_ver in "$cli_src CLI $cli_ver revanced-cli" "$patches_src Patches $patches_ver patches"; do
|
||||||
set -- $src_ver
|
set -- $src_ver
|
||||||
local src=$1 tag=$2 ver=${3-} ext
|
local src=$1 tag=$2 ver=${3-} fprefix=$4
|
||||||
if [ "$tag" = "CLI" ] || [ "$tag" = "Patches" ]; then
|
local ext
|
||||||
|
if [ "$tag" = "CLI" ]; then
|
||||||
ext="jar"
|
ext="jar"
|
||||||
elif [ "$tag" = "Integrations" ]; then
|
elif [ "$tag" = "Patches" ]; then
|
||||||
ext="apk"
|
ext="rvp"
|
||||||
else abort unreachable; fi
|
else abort unreachable; fi
|
||||||
local dir=${src%/*}
|
local dir=${src%/*}
|
||||||
dir=${TEMP_DIR}/${dir,,}-rv
|
dir=${TEMP_DIR}/${dir,,}-rv
|
||||||
@ -66,7 +66,7 @@ get_rv_prebuilts() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local url file tag_name name
|
local url file tag_name name
|
||||||
file=$(find "$dir" -name "revanced-${tag,,}-${name_ver#v}.${ext}" -type f 2>/dev/null)
|
file=$(find "$dir" -name "${fprefix}-${name_ver#v}.${ext}" -type f 2>/dev/null)
|
||||||
if [ -z "$file" ]; then
|
if [ -z "$file" ]; then
|
||||||
local resp asset name
|
local resp asset name
|
||||||
resp=$(gh_req "$rv_rel" -) || return 1
|
resp=$(gh_req "$rv_rel" -) || return 1
|
||||||
@ -77,7 +77,6 @@ get_rv_prebuilts() {
|
|||||||
name=$(jq -r .name <<<"$asset")
|
name=$(jq -r .name <<<"$asset")
|
||||||
file="${dir}/${name}"
|
file="${dir}/${name}"
|
||||||
gh_dl "$file" "$url" >&2 || return 1
|
gh_dl "$file" "$url" >&2 || return 1
|
||||||
if [ "$tag" = "Integrations" ]; then integs_file=$file; fi
|
|
||||||
echo "$tag: $(cut -d/ -f1 <<<"$src")/${name} " >>"${cl_dir}/changelog.md"
|
echo "$tag: $(cut -d/ -f1 <<<"$src")/${name} " >>"${cl_dir}/changelog.md"
|
||||||
else
|
else
|
||||||
local for_err=$file
|
local for_err=$file
|
||||||
@ -89,37 +88,26 @@ get_rv_prebuilts() {
|
|||||||
tag_name=$(cut -d'-' -f3- <<<"$name")
|
tag_name=$(cut -d'-' -f3- <<<"$name")
|
||||||
tag_name=v${tag_name%.*}
|
tag_name=v${tag_name%.*}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "$file "
|
|
||||||
if [ "$tag" = "Patches" ]; then
|
if [ "$tag" = "Patches" ]; then
|
||||||
name="patches-${tag_name}.json"
|
echo -e "[Changelog](https://github.com/${src}/releases/tag/${tag_name})\n" >>"${cl_dir}/changelog.md"
|
||||||
file="${dir}/${name}"
|
if [ "$REMOVE_RV_INTEGRATIONS_CHECKS" = true ]; then
|
||||||
if [ ! -f "$file" ]; then
|
if ! (
|
||||||
resp=$(gh_req "$rv_rel" -) || return 1
|
mkdir -p "${file}-zip" || return 1
|
||||||
if [ "$ver" = "dev" ]; then resp=$(jq -r '.[0]' <<<"$resp"); fi
|
unzip -qo "${file}" -d "${file}-zip" || return 1
|
||||||
url=$(jq -e -r '.assets[] | select(.name | endswith("json")) | .url' <<<"$resp") || return 1
|
java -cp "${BIN_DIR}/paccer.jar:${BIN_DIR}/dexlib2.jar" com.jhc.Main "${file}-zip/extensions/shared.rve" "${file}-zip/extensions/shared-patched.rve" || return 1
|
||||||
gh_dl "$file" "$url" >&2 || return 1
|
mv -f "${file}-zip/extensions/shared-patched.rve" "${file}-zip/extensions/shared.rve" || return 1
|
||||||
echo -e "[Changelog](https://github.com/${src}/releases/tag/${tag_name})\n" >>"${cl_dir}/changelog.md"
|
rm "${file}" || return 1
|
||||||
|
cd "${file}-zip" || abort
|
||||||
|
zip -0rq "${CWD}/${file}" . || return 1
|
||||||
|
) >&2; then
|
||||||
|
echo >&2 "Patching revanced-integrations failed"
|
||||||
|
fi
|
||||||
|
rm -r "${file}-zip" || :
|
||||||
fi
|
fi
|
||||||
echo -n "$file "
|
|
||||||
fi
|
fi
|
||||||
|
echo -n "$file "
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
|
|
||||||
if [ "$integs_file" ] && [ "$REMOVE_RV_INTEGRATIONS_CHECKS" = true ]; then
|
|
||||||
if ! (
|
|
||||||
mkdir -p "${integs_file}-zip" || return 1
|
|
||||||
unzip -qo "${integs_file}" -d "${integs_file}-zip" || return 1
|
|
||||||
cd "${integs_file}-zip" || return 1
|
|
||||||
java -cp "${BIN_DIR}/paccer.jar:${BIN_DIR}/dexlib2.jar" com.jhc.Main "${integs_file}-zip/classes.dex" "${integs_file}-zip/classes-patched.dex" || return 1
|
|
||||||
mv -f "${integs_file}-zip/classes-patched.dex" "${integs_file}-zip/classes.dex" || return 1
|
|
||||||
rm "${integs_file}" || return 1
|
|
||||||
zip -0rq "${integs_file}" . || return 1
|
|
||||||
) >&2; then
|
|
||||||
echo >&2 "Patching revanced-integrations failed"
|
|
||||||
fi
|
|
||||||
rm -r "${integs_file}-zip" || :
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_prebuilts() {
|
get_prebuilts() {
|
||||||
@ -170,8 +158,7 @@ config_update() {
|
|||||||
else
|
else
|
||||||
last_patches=$(gh_req "$rv_rel/tags/${ver}" -)
|
last_patches=$(gh_req "$rv_rel/tags/${ver}" -)
|
||||||
fi
|
fi
|
||||||
|
if ! last_patches=$(jq -e -r '.assets[] | select(.name | endswith("rvp")) | .name' <<<"$last_patches"); then
|
||||||
if ! last_patches=$(jq -e -r '.assets[] | select(.name | endswith("jar")) | .name' <<<"$last_patches"); then
|
|
||||||
abort oops
|
abort oops
|
||||||
fi
|
fi
|
||||||
if [ "$last_patches" ]; then
|
if [ "$last_patches" ]; then
|
||||||
@ -216,7 +203,7 @@ gh_dl() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log() { echo -e "$1 " >>"build.md"; }
|
log() { echo -e "$1 " >>"build.md"; }
|
||||||
get_largest_ver() {
|
get_highest_ver() {
|
||||||
local vers m
|
local vers m
|
||||||
vers=$(tee)
|
vers=$(tee)
|
||||||
m=$(head -1 <<<"$vers")
|
m=$(head -1 <<<"$vers")
|
||||||
@ -228,19 +215,30 @@ semver_validate() {
|
|||||||
[ ${#ac} = 0 ]
|
[ ${#ac} = 0 ]
|
||||||
}
|
}
|
||||||
get_patch_last_supported_ver() {
|
get_patch_last_supported_ver() {
|
||||||
local inc_sel exc_sel vs
|
local pkg_name=$1 inc_sel=$2 _exc_sel=$3 _exclusive=$4 # TODO: resolve using all of these
|
||||||
inc_sel=$(list_args "$2" | sed 's/.*/\.name == &/' | paste -sd '~' | sed 's/~/ or /g' || :)
|
local op
|
||||||
exc_sel=$(list_args "$3" | sed 's/.*/\.name != &/' | paste -sd '~' | sed 's/~/ and /g' || :)
|
if [ "$inc_sel" ]; then
|
||||||
inc_sel=${inc_sel:-false}
|
if ! op=$(java -jar "$rv_cli_jar" list-patches "$rv_patches_jar" -f "$pkg_name" -v -p 2>&1 | awk '{$1=$1}1'); then
|
||||||
if [ "$4" = false ]; then inc_sel="${inc_sel} or .use==true"; fi
|
epr "list-patches: '$op'"
|
||||||
if ! vs=$(jq -e -r ".[]
|
return 1
|
||||||
| select(.compatiblePackages // [] | .[] | .name==\"${1}\")
|
fi
|
||||||
| select(${inc_sel})
|
local ver vers="" NL=$'\n'
|
||||||
| select(${exc_sel:-true})
|
while IFS= read -r line; do
|
||||||
| .compatiblePackages[].versions // []" "$5"); then
|
line="${line:1:${#line}-2}"
|
||||||
abort "error in jq query"
|
ver=$(sed -n "/^Name: $line\$/,/^\$/p" <<<"$op" | sed -n "/^Compatible versions:\$/,/^\$/p" | tail -n +2)
|
||||||
|
vers=${ver}${NL}
|
||||||
|
done <<<"$(list_args "$inc_sel")"
|
||||||
|
get_highest_ver <<<"$vers"
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
tr -d ' ,\t[]"' <<<"$vs" | sort -u | grep -v '^$' | get_largest_ver || :
|
if ! op=$(java -jar "$rv_cli_jar" list-versions "$rv_patches_jar" -f "$pkg_name" 2>&1 | tail -n +3 | awk '{$1=$1}1'); then
|
||||||
|
epr "list-versions: '$op'"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [ "$op" = "Any" ]; then return; fi
|
||||||
|
pcount=$(head -1 <<<"$op") pcount=${pcount#*(} pcount=${pcount% *}
|
||||||
|
if [ -z "$pcount" ]; then abort "unreachable: '$pcount'"; fi
|
||||||
|
grep -F "($pcount patch" <<<"$op" | sed 's/ (.* patch.*//' | get_highest_ver || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
isoneof() {
|
isoneof() {
|
||||||
@ -261,10 +259,10 @@ merge_splits() {
|
|||||||
# this is required because of apksig
|
# this is required because of apksig
|
||||||
mkdir "${bundle}-zip"
|
mkdir "${bundle}-zip"
|
||||||
unzip -qo "${bundle}.mzip" -d "${bundle}-zip"
|
unzip -qo "${bundle}.mzip" -d "${bundle}-zip"
|
||||||
cd "${bundle}-zip" || abort
|
pushd "${bundle}-zip" || abort
|
||||||
zip -0rq "${bundle}.zip" .
|
zip -0rq "${CWD}/${bundle}.zip" .
|
||||||
cd "$CWD" || abort
|
popd || abort
|
||||||
# if building apk, sign the merged apk properly
|
# if building module, sign the merged apk properly
|
||||||
if isoneof "module" "${build_mode_arr[@]}"; then
|
if isoneof "module" "${build_mode_arr[@]}"; then
|
||||||
patch_apk "${bundle}.zip" "${output}" "--exclusive" "${args[cli]}" "${args[ptjar]}"
|
patch_apk "${bundle}.zip" "${output}" "--exclusive" "${args[cli]}" "${args[ptjar]}"
|
||||||
local ret=$?
|
local ret=$?
|
||||||
@ -329,7 +327,7 @@ dl_apkmirror() {
|
|||||||
get_apkmirror_vers() {
|
get_apkmirror_vers() {
|
||||||
local vers apkm_resp
|
local vers apkm_resp
|
||||||
apkm_resp=$(req "https://www.apkmirror.com/uploads/?appcategory=${__APKMIRROR_CAT__}" -)
|
apkm_resp=$(req "https://www.apkmirror.com/uploads/?appcategory=${__APKMIRROR_CAT__}" -)
|
||||||
vers=$(sed -n 's;.*Version:</span><span class="infoSlide-value">\(.*\) </span>.*;\1;p' <<<"$apkm_resp")
|
vers=$(sed -n 's;.*Version:</span><span class="infoSlide-value">\(.*\) </span>.*;\1;p' <<<"$apkm_resp" | awk '{$1=$1}1')
|
||||||
if [ "$__AAV__" = false ]; then
|
if [ "$__AAV__" = false ]; then
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
vers=$(grep -iv "\(beta\|alpha\)" <<<"$vers")
|
vers=$(grep -iv "\(beta\|alpha\)" <<<"$vers")
|
||||||
@ -403,8 +401,9 @@ get_archive_pkg_name() { echo "$__ARCHIVE_PKG_NAME__"; }
|
|||||||
|
|
||||||
patch_apk() {
|
patch_apk() {
|
||||||
local stock_input=$1 patched_apk=$2 patcher_args=$3 rv_cli_jar=$4 rv_patches_jar=$5
|
local stock_input=$1 patched_apk=$2 patcher_args=$3 rv_cli_jar=$4 rv_patches_jar=$5
|
||||||
local cmd="java -jar $rv_cli_jar patch $stock_input -p -o $patched_apk -b $rv_patches_jar $patcher_args --keystore=ks.keystore \
|
# TODO: --options
|
||||||
--keystore-entry-password=123456789 --keystore-password=123456789 --signer=jhc --keystore-entry-alias=jhc --options=options.json"
|
local cmd="java -jar $rv_cli_jar patch $stock_input --purge -o $patched_apk -p $rv_patches_jar --keystore=ks.keystore \
|
||||||
|
--keystore-entry-password=123456789 --keystore-password=123456789 --signer=jhc --keystore-entry-alias=jhc $patcher_args"
|
||||||
if [ "$OS" = Android ]; then cmd+=" --custom-aapt2-binary=${AAPT2}"; fi
|
if [ "$OS" = Android ]; then cmd+=" --custom-aapt2-binary=${AAPT2}"; fi
|
||||||
pr "$cmd"
|
pr "$cmd"
|
||||||
if eval "$cmd"; then [ -f "$patched_apk" ]; else
|
if eval "$cmd"; then [ -f "$patched_apk" ]; else
|
||||||
@ -435,7 +434,7 @@ build_rv() {
|
|||||||
local arch_f="${arch// /}"
|
local arch_f="${arch// /}"
|
||||||
|
|
||||||
local p_patcher_args=()
|
local p_patcher_args=()
|
||||||
p_patcher_args+=("$(join_args "${args[excluded_patches]}" -e) $(join_args "${args[included_patches]}" -i)")
|
p_patcher_args+=("$(join_args "${args[excluded_patches]}" -d) $(join_args "${args[included_patches]}" -e)")
|
||||||
[ "${args[exclusive_patches]}" = true ] && p_patcher_args+=("--exclusive")
|
[ "${args[exclusive_patches]}" = true ] && p_patcher_args+=("--exclusive")
|
||||||
|
|
||||||
local tried_dl=()
|
local tried_dl=()
|
||||||
@ -457,7 +456,7 @@ build_rv() {
|
|||||||
local get_latest_ver=false
|
local get_latest_ver=false
|
||||||
if [ "$version_mode" = auto ]; then
|
if [ "$version_mode" = auto ]; then
|
||||||
if ! version=$(get_patch_last_supported_ver "$pkg_name" \
|
if ! version=$(get_patch_last_supported_ver "$pkg_name" \
|
||||||
"${args[included_patches]}" "${args[excluded_patches]}" "${args[exclusive_patches]}" "${args[ptjs]}"); then
|
"${args[included_patches]}" "${args[excluded_patches]}" "${args[exclusive_patches]}"); then
|
||||||
exit 1
|
exit 1
|
||||||
elif [ -z "$version" ]; then get_latest_ver=true; fi
|
elif [ -z "$version" ]; then get_latest_ver=true; fi
|
||||||
elif isoneof "$version_mode" latest beta; then
|
elif isoneof "$version_mode" latest beta; then
|
||||||
@ -470,7 +469,7 @@ build_rv() {
|
|||||||
if [ $get_latest_ver = true ]; then
|
if [ $get_latest_ver = true ]; then
|
||||||
if [ "$version_mode" = beta ]; then __AAV__="true"; else __AAV__="false"; fi
|
if [ "$version_mode" = beta ]; then __AAV__="true"; else __AAV__="false"; fi
|
||||||
pkgvers=$(get_"${dl_from}"_vers)
|
pkgvers=$(get_"${dl_from}"_vers)
|
||||||
version=$(get_largest_ver <<<"$pkgvers") || version=$(head -1 <<<"$pkgvers")
|
version=$(get_highest_ver <<<"$pkgvers") || version=$(head -1 <<<"$pkgvers")
|
||||||
fi
|
fi
|
||||||
if [ -z "$version" ]; then
|
if [ -z "$version" ]; then
|
||||||
epr "empty version, not building ${table}."
|
epr "empty version, not building ${table}."
|
||||||
@ -507,9 +506,9 @@ build_rv() {
|
|||||||
fi
|
fi
|
||||||
log "${table}: ${version}"
|
log "${table}: ${version}"
|
||||||
|
|
||||||
p_patcher_args+=("-m ${args[integ]}")
|
|
||||||
local microg_patch
|
local microg_patch
|
||||||
microg_patch=$(jq -r ".[] | select(.compatiblePackages // [] | .[] | .name==\"${pkg_name}\") | .name" "${args[ptjs]}" | grep -i "gmscore\|microg" || :)
|
microg_patch=$(java -jar "$rv_cli_jar" list-patches "$rv_patches_jar" -f "$pkg_name" -v -p 2>&1 |
|
||||||
|
grep "^Name: " | grep -i "gmscore\|microg" || :) microg_patch=${microg_patch#*: }
|
||||||
if [ -n "$microg_patch" ] && [[ ${p_patcher_args[*]} =~ $microg_patch ]]; then
|
if [ -n "$microg_patch" ] && [[ ${p_patcher_args[*]} =~ $microg_patch ]]; then
|
||||||
epr "You cant include/exclude microg patches as that's done by rvmm builder automatically."
|
epr "You cant include/exclude microg patches as that's done by rvmm builder automatically."
|
||||||
p_patcher_args=("${p_patcher_args[@]//-[ei] ${microg_patch}/}")
|
p_patcher_args=("${p_patcher_args[@]//-[ei] ${microg_patch}/}")
|
||||||
@ -524,9 +523,9 @@ build_rv() {
|
|||||||
if [ -n "$microg_patch" ]; then
|
if [ -n "$microg_patch" ]; then
|
||||||
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}-${build_mode}.apk"
|
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}-${build_mode}.apk"
|
||||||
if [ "$build_mode" = apk ]; then
|
if [ "$build_mode" = apk ]; then
|
||||||
patcher_args+=("-i \"${microg_patch}\"")
|
|
||||||
elif [ "$build_mode" = module ]; then
|
|
||||||
patcher_args+=("-e \"${microg_patch}\"")
|
patcher_args+=("-e \"${microg_patch}\"")
|
||||||
|
elif [ "$build_mode" = module ]; then
|
||||||
|
patcher_args+=("-d \"${microg_patch}\"")
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}.apk"
|
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}.apk"
|
||||||
@ -574,7 +573,7 @@ build_rv() {
|
|||||||
cp -f "$patched_apk" "${base_template}/base.apk"
|
cp -f "$patched_apk" "${base_template}/base.apk"
|
||||||
if [ "${args[include_stock]}" = true ]; then cp -f "$stock_apk" "${base_template}/${pkg_name}.apk"; fi
|
if [ "${args[include_stock]}" = true ]; then cp -f "$stock_apk" "${base_template}/${pkg_name}.apk"; fi
|
||||||
pushd >/dev/null "$base_template" || abort "Module template dir not found"
|
pushd >/dev/null "$base_template" || abort "Module template dir not found"
|
||||||
zip -"$COMPRESSION_LEVEL" -FSqr "${BUILD_DIR}/${module_output}" .
|
zip -"$COMPRESSION_LEVEL" -FSqr "${CWD}/${BUILD_DIR}/${module_output}" .
|
||||||
popd >/dev/null || :
|
popd >/dev/null || :
|
||||||
pr "Built ${table} (root): '${BUILD_DIR}/${module_output}'"
|
pr "Built ${table} (root): '${BUILD_DIR}/${module_output}'"
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user