From e129f944df6fc6674dba288facbdebc987974b56 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Thu, 13 Oct 2022 23:34:05 -0500 Subject: [PATCH] Improve checkonly logic --- build_revanced.sh | 9 ++++++--- download_apkmirror.sh | 10 +++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/build_revanced.sh b/build_revanced.sh index 6d2dc90..312568a 100755 --- a/build_revanced.sh +++ b/build_revanced.sh @@ -87,6 +87,7 @@ fi # Set flag to determine if a build should happen or not flag=false +check_flag=false # Get inside the working directory cd "$WDIR" @@ -99,12 +100,14 @@ for artifact in $artifacts; do repo=$(echo $artifact | cut -d '_' -f1) name=$(echo $artifact | cut -d '_' -f2) basename=$(echo $name | cut -d '.' -f1) + echo "Checking $basename" | tee build.log version_present=$(jq -r ".\"$basename\"" versions.json) data=$(jq -r ".tools[] | select((.repository == \"$repo\") and (.content_type | contains(\"archive\")))" latest_versions.json) version=$(echo "$data" | jq -r '.version') if [[ $(ver_less_than $version_present $version) == true || ! -f $name || $2 == force ]]; then if [[ $2 == checkonly ]]; then - echo \[checkonly\] $name has an update \($version_present \-\> $version\) | tee -a build.log + echo "[checkonly] $basename has an update ($version_present -> $version)" | tee -a build.log + check_flag=true continue fi echo "Downloading $name" | tee -a build.log @@ -120,10 +123,10 @@ done # Exit if no updates happened if [[ $flag == false && $2 != force ]]; then - if [[ $2 != checkonly ]]; then + if [[ $check_flag == false ]]; then echo "Nothing to update" | tee -a build.log else - echo "Check-only run complete!" | tee -a build.log + "$SDIR/download_apkmirror.sh" "$WDIR" checkonly fi exit fi diff --git a/download_apkmirror.sh b/download_apkmirror.sh index 07d1b1b..663c850 100755 --- a/download_apkmirror.sh +++ b/download_apkmirror.sh @@ -44,6 +44,10 @@ dl_apk() { # Downloading youtube dl_yt() { + if [[ $2 == checkonly ]]; then + echo "[checkonly] YouTube Music has an update ($version_present -> $version)" | tee -a build.log + break + fi echo "Downloading YouTube" | tee -a build.log local last_ver last_ver="$version" @@ -65,6 +69,10 @@ ARM_V7A="arm-v7a" # Downloading youtube music dl_ytm() { + if [[ $2 == checkonly ]]; then + echo "[checkonly] YouTube Music has an update ($version_present -> $version)" | tee -a build.log + break + fi local arch=$ARM64_V8A echo "Downloading YouTube Music (${arch})" | tee -a build.log local last_ver @@ -98,7 +106,7 @@ fi ## Main curl -X 'GET' 'https://releases.rvcd.win/patches' -H 'accept: application/json' -o patches.json for apk in "${!apks[@]}"; do - echo "Downloading $apk" | tee -a build.log + echo "Checking $apk" | tee -a build.log supported_vers="$(jq -r '.[].compatiblePackages[] | select(.name == "'$apk'") | .versions | last' patches.json)" version=0 for vers in $supported_vers; do