cli-source option

This commit is contained in:
j-hc 2023-07-24 18:47:22 +03:00
parent f735720905
commit b95857883f
4 changed files with 18 additions and 14 deletions

View File

@ -17,6 +17,7 @@ There exists an example below with all defaults shown and all the keys explicitl
parallel-jobs = 1 # amount of cores to use for parallel patching, if not set nproc is used
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"
rv-brand = "ReVanced Extended" # rebrand from 'ReVanced' to something different. default: "ReVanced"
patches-version = "v2.160.0" # locks the patches version. default: latest available

View File

@ -35,6 +35,7 @@ DEF_PATCHES_VER=$(toml_get "$main_config_t" patches-version) || DEF_PATCHES_VER=
DEF_INTEGRATIONS_VER=$(toml_get "$main_config_t" integrations-version) || DEF_INTEGRATIONS_VER=""
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_RV_BRAND=$(toml_get "$main_config_t" rv-brand) || DEF_RV_BRAND="ReVanced"
# -- Main config --
mkdir -p $TEMP_DIR $BUILD_DIR
@ -53,14 +54,13 @@ get_prebuilts
set_prebuilts() {
local integrations_src=$1 patches_src=$2 integrations_ver=$3 patches_ver=$4
local patches_dir=${patches_src%/*}
patches_dir=${TEMP_DIR}/${patches_dir//[^[:alnum:]]/}-rv
local integrations_dir=${integrations_src%/*}
integrations_dir=${TEMP_DIR}/${integrations_dir//[^[:alnum:]]/}-rv
local cli_dir=${cli_src%/*}
app_args[cli]=$(find "${TEMP_DIR}/jhc-rv" -name "revanced-cli-*.jar" -type f -print -quit 2>/dev/null) && [ "${app_args[cli]}" ] || return 1
app_args[integ]=$(find "$integrations_dir" -name "revanced-integrations-${integrations_ver:-*}.apk" -type f -print -quit 2>/dev/null) && [ "${app_args[integ]}" ] || return 1
app_args[ptjar]=$(find "$patches_dir" -name "revanced-patches-${patches_ver:-*}.jar" -type f -print -quit 2>/dev/null) && [ "${app_args[ptjar]}" ] || return 1
app_args[ptjs]=$(find "$patches_dir" -name "patches-${patches_ver:-*}.json" -type f -print -quit 2>/dev/null) && [ "${app_args[ptjs]}" ] || return 1
app_args[cli]=$(find "${TEMP_DIR}/${cli_dir//[^[:alnum:]]/}-rv" -name "revanced-cli-*.jar" -type f -print -quit 2>/dev/null) && [ "${app_args[cli]}" ] || return 1
app_args[integ]=$(find "${TEMP_DIR}/${integrations_dir//[^[:alnum:]]/}-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//[^[:alnum:]]/}-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//[^[:alnum:]]/}-rv" -name "patches-${patches_ver:-*}.json" -type f -print -quit 2>/dev/null) && [ "${app_args[ptjs]}" ] || return 1
}
build_rv_w() {
@ -86,9 +86,10 @@ for table_name in $(toml_get_table_names); do
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
if ! set_prebuilts "$integrations_src" "$patches_src" "$integrations_ver" "$patches_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")"
<<<"$(get_rv_prebuilts "$integrations_src" "$patches_src" "$integrations_ver" "$patches_ver" "$cli_src")"
app_args[cli]=$rv_cli_jar
app_args[integ]=$rv_integrations_apk
app_args[ptjar]=$rv_patches_jar

View File

@ -10,14 +10,13 @@ build-mode = "both" # 'both',
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 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"
cli-source = "inotia00/revanced-cli"
rv-brand = "ReVanced Extended"
build-mode = "both"
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube/"
@ -32,6 +31,7 @@ apkmirror-arch = "both" # bo
app-name = "Music"
patches-source = "inotia00/revanced-patches"
integrations-source = "inotia00/revanced-integrations"
cli-source = "inotia00/revanced-cli"
rv-brand = "ReVanced Extended"
build-mode = "both"
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music/"

View File

@ -43,18 +43,20 @@ abort() {
}
get_rv_prebuilts() {
local integrations_src=$1 patches_src=$2 integrations_ver=$3 patches_ver=$4
local integrations_src=$1 patches_src=$2 integrations_ver=$3 patches_ver=$4 cli_src=$5
local patches_dir=${patches_src%/*}
patches_dir=${TEMP_DIR}/${patches_dir//[^[:alnum:]]/}-rv
local integrations_dir=${integrations_src%/*}
integrations_dir=${TEMP_DIR}/${integrations_dir//[^[:alnum:]]/}-rv
mkdir -p "$patches_dir" "$integrations_dir" "${TEMP_DIR}/jhc-rv"
local cli_dir=${cli_src%/*}
cli_dir=${TEMP_DIR}/${cli_dir//[^[:alnum:]]/}-rv
mkdir -p "$patches_dir" "$integrations_dir" "$cli_dir"
pr "Getting prebuilts (${patches_src%/*})" >&2
local rv_cli_url rv_integrations_url rv_patches rv_patches_changelog rv_patches_dl rv_patches_url rv_patches_json
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="${TEMP_DIR}/jhc-rv/${rv_cli_url##*/}"
rv_cli_url=$(gh_req "https://api.github.com/repos/${cli_src}/releases/latest" - | 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"
local rv_integrations_rel="https://api.github.com/repos/${integrations_src}/releases/"
@ -428,7 +430,7 @@ build_rv() {
fi
if [ ! -f "$patched_apk" ] || [ "$REBUILD" = true ]; then
if ! patch_apk "$stock_apk" "$patched_apk" "${patcher_args[*]}" "${args[cli]}" "${args[ptjar]}"; then
pr "Building '${table}' failed!"
epr "Building '${table}' failed!"
return 0
fi
fi