diff --git a/README.md b/README.md index c7f7f1a..a05eaf9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Revanced Build -This repo template will allow one to build [ReVanced](https://github.com/revanced/) apps automatically. Set it up to run periodically using cron. It uses [telegram.sh](https://github.com/fabianonline/telegram.sh) and [telegram-upload](https://github.com/Nekmo/telegram-upload) to messages. +This repo template will allow one to build [ReVanced](https://github.com/revanced/) apps automatically. It uses [telegram.sh](https://github.com/fabianonline/telegram.sh) and [telegram-upload](https://github.com/Nekmo/telegram-upload) to messages. + +## How to use +Just run `./build_revanced (force/clean/experimental)`. Might be a good idea to set it up to run periodically using cron. ## Notes - The script will download the **automatically selected compatible version** (using compatibility of patches as listed [here](https://github.com/revanced/revanced-patches#list-of-available-patches)) of Youtube on APKMirror, **NOT** latest official version on Google Play. diff --git a/build_revanced.sh b/build_revanced.sh index 9b41cac..1cbee1d 100755 --- a/build_revanced.sh +++ b/build_revanced.sh @@ -9,7 +9,13 @@ timestamp=$(date '+%s') patch_file="./patches.txt" # Set working directory and current directory -WDIR="$1" +if [ -d "$1" ]; then + WDIR="$1" +else + echo "Working directory not provided" + exit -1 +fi + ODIR="$PWD" # Get line numbers where included & excluded patches start from. @@ -57,12 +63,12 @@ populate_patches() { ## Main # cleanup to fetch new revanced on next run -if [[ "$1" == "clean" ]]; then +if [[ "$2" == "clean" ]]; then rm -f revanced-cli.jar revanced-integrations.apk revanced-patches.jar exit fi -if [[ "$1" == "experimental" ]]; then +if [[ "$2" == "experimental" ]]; then EXPERIMENTAL="--experimental" fi @@ -91,7 +97,7 @@ for artifact in "${!artifacts[@]}"; do done # Exit if no updates happened -if [[ $flag==false && "$1" != "force" ]]; then +if [[ $flag==false && "$2" != "force" ]]; then echo "Nothing to update" | tee -a build.log exit fi diff --git a/download_apkmirror.sh b/download_apkmirror.sh index 7696117..2aad548 100755 --- a/download_apkmirror.sh +++ b/download_apkmirror.sh @@ -81,7 +81,12 @@ dl_ytm() { # Get into the build directory -cd "$1" +if [ -z "$1" ]; then + cd "$1" +else + echo "Working directory not provided" + exit -1 +fi ## Main