mirror of
https://github.com/j-hc/revanced-magisk-module.git
synced 2025-04-29 22:24:34 +02:00
cli compat.
This commit is contained in:
parent
1895ad9558
commit
594d08c6af
14
build.sh
14
build.sh
@ -57,8 +57,10 @@ set_prebuilts() {
|
||||
local patches_dir=${patches_src%/*}
|
||||
local integrations_dir=${integrations_src%/*}
|
||||
local cli_dir=${cli_src%/*}
|
||||
|
||||
app_args[cli]=$(find "${TEMP_DIR}/${cli_dir,,}-rv" -name "revanced-cli-${cli_ver:-*}.jar" -type f -print -quit 2>/dev/null) && [ "${app_args[cli]}" ] || return 1
|
||||
cli_ver=${cli_ver#v}
|
||||
integrations_ver="${integrations_ver#v}"
|
||||
patches_ver="${patches_ver#v}"
|
||||
app_args[cli]=$(find "${TEMP_DIR}/${cli_dir,,}-rv" -name "revanced-cli-${cli_ver:-*}-all.jar" -type f -print -quit 2>/dev/null) && [ "${app_args[cli]}" ] || return 1
|
||||
app_args[integ]=$(find "${TEMP_DIR}/${integrations_dir,,}-rv" -name "revanced-integrations-${integrations_ver:-*}.apk" -type f -print -quit 2>/dev/null) && [ "${app_args[integ]}" ] || return 1
|
||||
app_args[ptjar]=$(find "${TEMP_DIR}/${patches_dir,,}-rv" -name "revanced-patches-${patches_ver:-*}.jar" -type f -print -quit 2>/dev/null) && [ "${app_args[ptjar]}" ] || return 1
|
||||
app_args[ptjs]=$(find "${TEMP_DIR}/${patches_dir,,}-rv" -name "patches-${patches_ver:-*}.json" -type f -print -quit 2>/dev/null) && [ "${app_args[ptjs]}" ] || return 1
|
||||
@ -89,14 +91,16 @@ for table_name in $(toml_get_table_names); do
|
||||
cli_src=$(toml_get "$t" cli-source) || cli_src=$DEF_CLI_SRC
|
||||
cli_ver=$(toml_get "$t" cli-version) || cli_ver=$DEF_CLI_VER
|
||||
if ! set_prebuilts "$integrations_src" "$patches_src" "$cli_src" "$integrations_ver" "$patches_ver" "$cli_ver"; then
|
||||
read -r rv_cli_jar rv_integrations_apk rv_patches_jar rv_patches_json \
|
||||
<<<"$(get_rv_prebuilts "$integrations_src" "$patches_src" "$integrations_ver" "$patches_ver" "$cli_src" "$cli_ver")"
|
||||
if ! RVP="$(get_rv_prebuilts "$integrations_src" "$patches_src" "$integrations_ver" "$patches_ver" "$cli_src" "$cli_ver")"; then
|
||||
abort "could not download rv prebuilts"
|
||||
fi
|
||||
read -r rv_cli_jar rv_integrations_apk rv_patches_jar rv_patches_json <<<"$RVP"
|
||||
app_args[cli]=$rv_cli_jar
|
||||
app_args[integ]=$rv_integrations_apk
|
||||
app_args[ptjar]=$rv_patches_jar
|
||||
app_args[ptjs]=$rv_patches_json
|
||||
fi
|
||||
if [[ $(java -jar "${app_args[cli]}" --help) == *rip-lib* ]]; then app_args[riplib]=true; else app_args[riplib]=false; fi
|
||||
if [[ $(java -jar "${app_args[cli]}" patch 2>&1) == *rip-lib* ]]; then app_args[riplib]=true; else app_args[riplib]=false; fi
|
||||
app_args[rv_brand]=$(toml_get "$t" rv-brand) || app_args[rv_brand]="$DEF_RV_BRAND"
|
||||
|
||||
app_args[excluded_patches]=$(toml_get "$t" excluded-patches) || app_args[excluded_patches]=""
|
||||
|
9
utils.sh
9
utils.sh
@ -61,7 +61,6 @@ get_rv_prebuilts() {
|
||||
if [ "$integrations_ver" ]; then rv_integrations_rel+="tags/${integrations_ver}"; else rv_integrations_rel+="latest"; fi
|
||||
local rv_patches_rel="https://api.github.com/repos/${patches_src}/releases/"
|
||||
if [ "$patches_ver" ]; then rv_patches_rel+="tags/${patches_ver}"; else rv_patches_rel+="latest"; fi
|
||||
|
||||
rv_cli_url=$(gh_req "$rv_cli_rel" - | json_get 'browser_download_url') || return 1
|
||||
local rv_cli_jar="${cli_dir}/${rv_cli_url##*/}"
|
||||
echo "CLI: $(cut -d/ -f4 <<<"$rv_cli_url")/$(cut -d/ -f9 <<<"$rv_cli_url") " >"$patches_dir/changelog.md"
|
||||
@ -70,7 +69,7 @@ get_rv_prebuilts() {
|
||||
local rv_integrations_apk="${integrations_dir}/${rv_integrations_url##*/}"
|
||||
echo "Integrations: $(cut -d/ -f4 <<<"$rv_integrations_url")/$(cut -d/ -f9 <<<"$rv_integrations_url") " >>"$patches_dir/changelog.md"
|
||||
|
||||
rv_patches=$(gh_req "$rv_patches_rel" -)
|
||||
rv_patches=$(gh_req "$rv_patches_rel" -) || return 1
|
||||
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="${patches_dir}/patches-$(json_get 'tag_name' <<<"$rv_patches").json"
|
||||
@ -259,7 +258,7 @@ get_apkmonk_pkg_name() { grep -oP '.*apkmonk\.com\/app\/\K([,\w,\.]*)' <<<"$1";
|
||||
patch_apk() {
|
||||
local stock_input=$1 patched_apk=$2 patcher_args=$3 rv_cli_jar=$4 rv_patches_jar=$5 riplib=$6
|
||||
declare -r tdir=$(mktemp -d -p $TEMP_DIR)
|
||||
local cmd="java -jar $rv_cli_jar --temp-dir=$tdir -c -a $stock_input -o $patched_apk -b $rv_patches_jar --keystore=ks.keystore $patcher_args"
|
||||
local cmd="java -jar $rv_cli_jar patch $stock_input -r $tdir -p -o $patched_apk -b $rv_patches_jar --keystore=ks.keystore $patcher_args"
|
||||
if [ "$riplib" = true ]; then cmd+=" --rip-lib x86_64 --rip-lib x86"; fi
|
||||
if [ "$OS" = Android ]; then cmd+=" --custom-aapt2-binary=${TEMP_DIR}/aapt2"; fi
|
||||
pr "$cmd"
|
||||
@ -305,10 +304,10 @@ build_rv() {
|
||||
) || get_latest_ver=true
|
||||
elif isoneof "$version_mode" latest beta; then
|
||||
get_latest_ver=true
|
||||
p_patcher_args+=("--experimental")
|
||||
p_patcher_args+=("-f")
|
||||
else
|
||||
version=$version_mode
|
||||
p_patcher_args+=("--experimental")
|
||||
p_patcher_args+=("-f")
|
||||
fi
|
||||
if [ $get_latest_ver = true ]; then
|
||||
local apkmvers uptwodvers aav
|
||||
|
Loading…
x
Reference in New Issue
Block a user