mirror of
https://github.com/SinTan1729/ReVancedBuilder.git
synced 2024-12-27 05:08:35 -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
|
# Set flag to determine if a build should happen or not
|
||||||
flag=false
|
flag=false
|
||||||
|
check_flag=false
|
||||||
|
|
||||||
# Get inside the working directory
|
# Get inside the working directory
|
||||||
cd "$WDIR"
|
cd "$WDIR"
|
||||||
|
@ -99,12 +100,14 @@ for artifact in $artifacts; do
|
||||||
repo=$(echo $artifact | cut -d '_' -f1)
|
repo=$(echo $artifact | cut -d '_' -f1)
|
||||||
name=$(echo $artifact | cut -d '_' -f2)
|
name=$(echo $artifact | cut -d '_' -f2)
|
||||||
basename=$(echo $name | cut -d '.' -f1)
|
basename=$(echo $name | cut -d '.' -f1)
|
||||||
|
echo "Checking $basename" | tee build.log
|
||||||
version_present=$(jq -r ".\"$basename\"" versions.json)
|
version_present=$(jq -r ".\"$basename\"" versions.json)
|
||||||
data=$(jq -r ".tools[] | select((.repository == \"$repo\") and (.content_type | contains(\"archive\")))" latest_versions.json)
|
data=$(jq -r ".tools[] | select((.repository == \"$repo\") and (.content_type | contains(\"archive\")))" latest_versions.json)
|
||||||
version=$(echo "$data" | jq -r '.version')
|
version=$(echo "$data" | jq -r '.version')
|
||||||
if [[ $(ver_less_than $version_present $version) == true || ! -f $name || $2 == force ]]; then
|
if [[ $(ver_less_than $version_present $version) == true || ! -f $name || $2 == force ]]; then
|
||||||
if [[ $2 == checkonly ]]; 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
|
continue
|
||||||
fi
|
fi
|
||||||
echo "Downloading $name" | tee -a build.log
|
echo "Downloading $name" | tee -a build.log
|
||||||
|
@ -120,10 +123,10 @@ done
|
||||||
|
|
||||||
# Exit if no updates happened
|
# Exit if no updates happened
|
||||||
if [[ $flag == false && $2 != force ]]; then
|
if [[ $flag == false && $2 != force ]]; then
|
||||||
if [[ $2 != checkonly ]]; then
|
if [[ $check_flag == false ]]; then
|
||||||
echo "Nothing to update" | tee -a build.log
|
echo "Nothing to update" | tee -a build.log
|
||||||
else
|
else
|
||||||
echo "Check-only run complete!" | tee -a build.log
|
"$SDIR/download_apkmirror.sh" "$WDIR" checkonly
|
||||||
fi
|
fi
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -44,6 +44,10 @@ dl_apk() {
|
||||||
|
|
||||||
# Downloading youtube
|
# Downloading youtube
|
||||||
dl_yt() {
|
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
|
echo "Downloading YouTube" | tee -a build.log
|
||||||
local last_ver
|
local last_ver
|
||||||
last_ver="$version"
|
last_ver="$version"
|
||||||
|
@ -65,6 +69,10 @@ ARM_V7A="arm-v7a"
|
||||||
|
|
||||||
# Downloading youtube music
|
# Downloading youtube music
|
||||||
dl_ytm() {
|
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
|
local arch=$ARM64_V8A
|
||||||
echo "Downloading YouTube Music (${arch})" | tee -a build.log
|
echo "Downloading YouTube Music (${arch})" | tee -a build.log
|
||||||
local last_ver
|
local last_ver
|
||||||
|
@ -98,7 +106,7 @@ fi
|
||||||
## Main
|
## Main
|
||||||
curl -X 'GET' 'https://releases.rvcd.win/patches' -H 'accept: application/json' -o patches.json
|
curl -X 'GET' 'https://releases.rvcd.win/patches' -H 'accept: application/json' -o patches.json
|
||||||
for apk in "${!apks[@]}"; do
|
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)"
|
supported_vers="$(jq -r '.[].compatiblePackages[] | select(.name == "'$apk'") | .versions | last' patches.json)"
|
||||||
version=0
|
version=0
|
||||||
for vers in $supported_vers; do
|
for vers in $supported_vers; do
|
||||||
|
|
Loading…
Reference in a new issue