fix: buildonly should never download files

This commit is contained in:
Sayantan Santra 2023-07-01 22:55:33 -05:00
parent c5a0b9a104
commit d0bdcb7c83
Signed by: SinTan1729
GPG key ID: EB3E68BFBA25C85F

View file

@ -92,20 +92,22 @@ check_flag=false
# Get inside the working directory # Get inside the working directory
cd "$WDIR" cd "$WDIR"
echo "$(date) | Starting check..." echo "$(date) | Starting check..."
cp verions.json versions.json.old
# Fetch all the dependencies if [[ $2 != buildonly ]]; then
try=0 # Create a backup of versions
while :; do cp verions.json versions.json.old
# Fetch all the dependencies
try=0
while :; do
try=$(($try + 1)) try=$(($try + 1))
[ $try -gt 10 ] && echo "API error!" && exit 2 [ $try -gt 10 ] && echo "API error!" && exit 2
curl -X 'GET' 'https://releases.revanced.app/tools' -H 'accept: application/json' -o latest_versions.json curl -X 'GET' 'https://releases.revanced.app/tools' -H 'accept: application/json' -o latest_versions.json
cat latest_versions.json | jq -e '.error' >/dev/null || break cat latest_versions.json | jq -e '.error' >/dev/null || break
echo "API failure, trying again. $((10 - $try)) tries left..." echo "API failure, trying again. $((10 - $try)) tries left..."
sleep 10 sleep 10
done done
for artifact in $artifacts; do for artifact in $artifacts; do
#Check for updates #Check for updates
repo=$(echo $artifact | cut -d ':' -f1) repo=$(echo $artifact | cut -d ':' -f1)
name=$(echo $artifact | cut -d ':' -f2) name=$(echo $artifact | cut -d ':' -f2)
@ -129,12 +131,12 @@ for artifact in $artifacts; do
echo "Upgraded $basename from $version_present to $version" echo "Upgraded $basename from $version_present to $version"
flag=true flag=true
fi fi
done done
[[ ! -f com.google.android.youtube.apk || ! -f com.google.android.apps.youtube.music.apk ]] && flag=true [[ ! -f com.google.android.youtube.apk || ! -f com.google.android.apps.youtube.music.apk ]] && flag=true
# Exit if no updates happened # Exit if no updates happened
if [[ $flag == false && $2 != force ]]; then if [[ $flag == false && $2 != force ]]; then
if [[ $check_flag == false ]]; then if [[ $check_flag == false ]]; then
echo "Nothing to update" echo "Nothing to update"
else else
@ -142,10 +144,11 @@ if [[ $flag == false && $2 != force ]]; then
fi fi
echo "--------------------"$'\n'"--------------------" echo "--------------------"$'\n'"--------------------"
exit exit
fi fi
# Download required apk files # Download required apk files
[[ $2 != buildonly ]] && "$SDIR/download_apkmirror.sh" "$WDIR" "$SDIR/download_apkmirror.sh" "$WDIR"
fi
# If the variables are NOT empty, call populate_patches with proper arguments # If the variables are NOT empty, call populate_patches with proper arguments
[[ ! -z "$excluded_patches" ]] && populate_patches "-e" "$excluded_patches" [[ ! -z "$excluded_patches" ]] && populate_patches "-e" "$excluded_patches"
@ -254,8 +257,10 @@ if [ $error == 1 ]; then
-d "$MESSAGE" \ -d "$MESSAGE" \
"$NTFY_URL/$NTFY_TOPIC" "$NTFY_URL/$NTFY_TOPIC"
fi fi
if [[ $2 != buildonly ]]; then
mv versions.json versions.json.fail mv versions.json versions.json.fail
mv versions.json.old versions.json mv versions.json.old versions.json
fi
exit 4 exit 4
fi fi