mirror of
https://github.com/SinTan1729/ReVancedBuilder.git
synced 2024-12-26 12:48:36 -06:00
Improve checkonly logic
This commit is contained in:
parent
93348270ba
commit
e129f944df
2 changed files with 15 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue