From 1104dbd65b13c2d96a71c08b01a82fd4f912ec21 Mon Sep 17 00:00:00 2001 From: Fioren <102145692+FiorenMas@users.noreply.github.com> Date: Wed, 6 Nov 2024 10:54:40 +0700 Subject: [PATCH] Fix cli v5 New v5 patches no longer include a .json file, so I'm using the CLI to get the correct version. --- src/build/utils.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/build/utils.sh b/src/build/utils.sh index 28e599b..014622a 100644 --- a/src/build/utils.sh +++ b/src/build/utils.sh @@ -166,7 +166,14 @@ get_apk() { esac fi if [ -z "$version" ] && [ "$version" != "latest" ]; then - version=$(jq -r '[.. | objects | select(.name == "'$1'" and .versions != null) | .versions[]] | reverse | .[0] // ""' *.json | uniq) + if [[ $(ls revanced-cli-*.jar) =~ revanced-cli-([0-9]+) ]]; then + num=${BASH_REMATCH[1]} + if [ $num -ge 5 ]; then + version=$(java -jar *cli*.jar list-patches --with-packages --with-versions *.rvp | awk -v pkg="$1" 'BEGIN { found = 0 } /^Index:/ { found = 0 } /Package name: / { if ($3 == pkg) { found = 1 } } /Compatible versions:/ { if (found) { getline; latest_version = $1; while (getline && $1 ~ /^[0-9]+\./) { latest_version = $1 } print latest_version; exit } }') + else + version=$(jq -r '[.. | objects | select(.name == "'$1'" and .versions != null) | .versions[]] | reverse | .[0] // ""' *.json | uniq) + fi + fi fi export version="$version" local attempt=0