Added command-line option checkonly

This commit is contained in:
Sayantan Santra 2022-10-13 23:19:22 -05:00
parent 4dd9d6b6c9
commit 93348270ba
2 changed files with 11 additions and 3 deletions

View file

@ -2,7 +2,7 @@
This repo will allow one to build [ReVanced](https://github.com/revanced/) apps automatically and post it to a telegram channel to access and possibly share the builds with friends. It uses [telegram.sh](https://github.com/fabianonline/telegram.sh) to send messages and [telegram-upload](https://github.com/Nekmo/telegram-upload) to upload files. Make sure that `Java >=17` is installed and selected as default. This repo will allow one to build [ReVanced](https://github.com/revanced/) apps automatically and post it to a telegram channel to access and possibly share the builds with friends. It uses [telegram.sh](https://github.com/fabianonline/telegram.sh) to send messages and [telegram-upload](https://github.com/Nekmo/telegram-upload) to upload files. Make sure that `Java >=17` is installed and selected as default.
## How to use ## How to use
Just run `./build_revanced <working-directory> (force/clean/experimental)`. Might be a good idea to set it up to run periodically using cron. I currently use the following in a user crontab to run it everyday at 6 AM: Just run `./build_revanced <working-directory> (force/clean/experimental/checkonly)`. Might be a good idea to set it up to run periodically using cron. I currently use the following in a user crontab to run it everyday at 6 AM:
``` ```
0 6 * * * <full-script-location> <full-working-directory-location> 0 6 * * * <full-script-location> <full-working-directory-location>
``` ```

View file

@ -103,6 +103,10 @@ for artifact in $artifacts; do
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
echo \[checkonly\] $name has an update \($version_present \-\> $version\) | tee -a build.log
continue
fi
echo "Downloading $name" | tee -a build.log echo "Downloading $name" | tee -a build.log
[[ $name == microg.apk && -f $name && $2 != force ]] && microg_updated=true [[ $name == microg.apk && -f $name && $2 != force ]] && microg_updated=true
# shellcheck disable=SC2086,SC2046 # shellcheck disable=SC2086,SC2046
@ -115,8 +119,12 @@ 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
echo "Nothing to update" | tee -a build.log if [[ $2 != checkonly ]]; then
echo "Nothing to update" | tee -a build.log
else
echo "Check-only run complete!" | tee -a build.log
fi
exit exit
fi fi