Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
Update utils.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
bean-factory authored Oct 12, 2023
1 parent 2c6e207 commit 90a1684
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,19 @@ semver_validate() {
[ ${#ac} = 0 ]
}
get_patch_last_supported_ver() {
if [ ${1} == "com.google.android.youtube" ] || [ ${1} == "com.google.android.apps.youtube.music" ];then
jq -r ".[] | select(.compatiblePackages[].name==\"${1}\" and .excluded==false) | .compatiblePackages[].versions" "$RVE_PATCHES_JSON" |
tr -d ' ,\t[]"' | sort -u | grep -v '^$' | get_largest_ver || return 1
else
jq -r ".[] | select(.compatiblePackages[].name==\"${1}\" and .excluded==false) | .compatiblePackages[].versions" "$RV_PATCHES_JSON" |
tr -d ' ,\t[]"' | sort -u | grep -v '^$' | get_largest_ver || return 1
local inc_sel exc_sel vs
inc_sel=$(list_args "$2" | sed 's/.*/\.name == &/' | paste -sd '~' | sed 's/~/ or /g' || :)
exc_sel=$(list_args "$3" | sed 's/.*/\.name != &/' | paste -sd '~' | sed 's/~/ and /g' || :)
inc_sel=${inc_sel:-false}
if [ "$4" = false ]; then inc_sel="${inc_sel} or .use==true"; fi
if ! vs=$(jq -r ".[]
| select(.compatiblePackages // [] | .[] | .name==\"${1}\")
| select(${inc_sel})
| select(${exc_sel:-true})
| .compatiblePackages[].versions // []" "$5"); then
abort "error in jq query"
fi

tr -d ' ,\t[]"' <<<"$vs" | sort -u | grep -v '^$' | get_largest_ver || :
}

dl_if_dne() {
Expand Down Expand Up @@ -157,7 +162,7 @@ dl_uptodown() {
patch_apk() {
local stock_input=$1 patched_apk=$2 patcher_args=$3
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 -i predictive-back-gesture $patcher_args --options=./options.json"
local cmd="java -jar $RV_CLI_JAR patch --temp-dir=$tdir -c -a $stock_input -o $patched_apk -b $RV_PATCHES_JAR --keystore=ks.keystore -i predictive-back-gesture $patcher_args --options=./options.json"
echo "$cmd"
eval "$cmd"
}
Expand Down

0 comments on commit 90a1684

Please sign in to comment.