Configurable working directory

This commit is contained in:
Sayantan Santra 2022-10-11 20:25:44 -05:00
parent e8cd60dbdb
commit efd9b748a7
3 changed files with 20 additions and 6 deletions

View file

@ -1,5 +1,8 @@
# Revanced Build # 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 <working-directory> (force/clean/experimental)`. Might be a good idea to set it up to run periodically using cron.
## Notes ## 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. - 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.

View file

@ -9,7 +9,13 @@ timestamp=$(date '+%s')
patch_file="./patches.txt" patch_file="./patches.txt"
# Set working directory and current directory # 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" ODIR="$PWD"
# Get line numbers where included & excluded patches start from. # Get line numbers where included & excluded patches start from.
@ -57,12 +63,12 @@ populate_patches() {
## Main ## Main
# cleanup to fetch new revanced on next run # 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 rm -f revanced-cli.jar revanced-integrations.apk revanced-patches.jar
exit exit
fi fi
if [[ "$1" == "experimental" ]]; then if [[ "$2" == "experimental" ]]; then
EXPERIMENTAL="--experimental" EXPERIMENTAL="--experimental"
fi fi
@ -91,7 +97,7 @@ for artifact in "${!artifacts[@]}"; do
done done
# Exit if no updates happened # 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 echo "Nothing to update" | tee -a build.log
exit exit
fi fi

View file

@ -81,7 +81,12 @@ dl_ytm() {
# Get into the build directory # Get into the build directory
cd "$1" if [ -z "$1" ]; then
cd "$1"
else
echo "Working directory not provided"
exit -1
fi
## Main ## Main