You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
616 B
27 lines
616 B
2 years ago
|
#! /usr/bin/env bash
|
||
|
|
||
|
# Get the runtime path of the bot
|
||
|
ABS_PATH="$(readlink -f "$0")"
|
||
|
RUN_DIR="$(dirname "$ABS_PATH")"
|
||
|
|
||
|
# Relative paths to the virtual environment and main.py
|
||
|
VENV='./venv/bin/activate'
|
||
|
ENTRY='./blockbot.py'
|
||
|
|
||
|
# cd into the bot's root path, set up the virtual environment, and run
|
||
|
cd "$RUN_DIR"
|
||
|
[ ! -f "$VENV" ] && echo "Virtual environment not found: ${VENV}" && cd - > /dev/null && exit 1
|
||
|
source "$VENV"
|
||
|
|
||
|
# I don't know why this doesn't work without the "python3" call, but whatever
|
||
|
python3 "$ENTRY" "$@"
|
||
|
|
||
|
# Return code
|
||
|
RETURN_CODE="$?"
|
||
|
|
||
|
# Cleanup
|
||
|
deactivate
|
||
|
cd - > /dev/null
|
||
|
|
||
|
exit "$RETURN_CODE"
|