From 50d79db977b89f150f53ef08d9e6d1271a086fa1 Mon Sep 17 00:00:00 2001 From: j-hc Date: Sat, 14 Dec 2024 19:30:00 +0300 Subject: [PATCH] exclude spoof patch for modules --- utils.sh | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/utils.sh b/utils.sh index 71986af..6fbb058 100755 --- a/utils.sh +++ b/utils.sh @@ -187,7 +187,7 @@ _req() { local ip="$1" op="$2" shift 2 if [ "$op" = - ]; then - wget -nv -O "$op" "$@" "$ip" + curl -L -c "$TEMP_DIR/cookie.txt" -b "$TEMP_DIR/cookie.txt" --connect-timeout 5 --retry 0 --fail -s -S "$@" "$ip" else if [ -f "$op" ]; then return; fi local dlp @@ -196,16 +196,16 @@ _req() { while [ -f "$dlp" ]; do sleep 1; done return fi - wget -nv -O "$dlp" "$@" "$ip" || return 1 + curl -L -c "$TEMP_DIR/cookie.txt" -b "$TEMP_DIR/cookie.txt" --connect-timeout 5 --retry 0 --fail -s -S "$@" "$ip" -o "$dlp" || return 1 mv -f "$dlp" "$op" fi } -req() { _req "$1" "$2" --header="User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0"; } -gh_req() { _req "$1" "$2" --header="$GH_HEADER"; } +req() { _req "$1" "$2" -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0"; } +gh_req() { _req "$1" "$2" -H "$GH_HEADER"; } gh_dl() { if [ ! -f "$1" ]; then pr "Getting '$1' from '$2'" - _req "$2" "$1" --header="$GH_HEADER" --header="Accept: application/octet-stream" + _req "$2" "$1" -H "$GH_HEADER" -H "Accept: application/octet-stream" fi } @@ -524,9 +524,16 @@ build_rv() { 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 - epr "You cant include/exclude microg patches as that's done by rvmm builder automatically." + epr "You cant include/exclude microg patch as that's done by rvmm builder automatically." p_patcher_args=("${p_patcher_args[@]//-[ei] ${microg_patch}/}") fi + local spoof_streams_patch + spoof_streams_patch=$(java -jar "$rv_cli_jar" list-patches "$rv_patches_jar" -f "$pkg_name" -v -p 2>&1 | + grep "^Name: " | grep -i "spoof" | grep -i "streams" || :) spoof_streams_patch=${spoof_streams_patch#*: } + if [ -n "$spoof_streams_patch" ] && [[ ${p_patcher_args[*]} =~ $spoof_streams_patch ]]; then + epr "You cant include/exclude spoof stream patch as that's done by rvmm builder automatically." + p_patcher_args=("${p_patcher_args[@]//-[ei] ${spoof_streams_patch}/}") + fi local patcher_args patched_apk build_mode local rv_brand_f=${args[rv_brand],,} @@ -535,15 +542,24 @@ build_rv() { for build_mode in "${build_mode_arr[@]}"; do patcher_args=("${p_patcher_args[@]}") pr "Building '${table}' in '$build_mode' mode" - if [ -n "$microg_patch" ]; then + if [ -n "$microg_patch" ] || [ -n "$spoof_streams_patch" ]; then patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}-${build_mode}.apk" + else + patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}.apk" + fi + if [ -n "$microg_patch" ]; then if [ "$build_mode" = apk ]; then patcher_args+=("-e \"${microg_patch}\"") elif [ "$build_mode" = module ]; then patcher_args+=("-d \"${microg_patch}\"") fi - else - patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}.apk" + fi + if [ -n "$spoof_streams_patch" ]; then + if [ "$build_mode" = apk ]; then + patcher_args+=("-e \"${spoof_streams_patch}\"") + elif [ "$build_mode" = module ]; then + patcher_args+=("-d \"${spoof_streams_patch}\"") + fi fi if [ "${args[riplib]}" = true ]; then patcher_args+=("--rip-lib x86_64 --rip-lib x86")