support local scripts & env in run script

This commit is contained in:
ducklet 2021-08-06 12:18:21 +02:00
parent 792806f304
commit b8fab34418

17
run
View file

@ -3,13 +3,18 @@
RUN_BIN=$(realpath "$0") RUN_BIN=$(realpath "$0")
RUN_DIR=$(dirname "$RUN_BIN") RUN_DIR=$(dirname "$RUN_BIN")
export RUN_BIN
export RUN_DIR
task="$1" task="$1"
shift shift
# export DEBUG=1 : "${RUN_TASK:=$task}"
# export UNWIND_LOGLEVEL=DEBUG
exec "$RUN_DIR"/scripts/"$task" "$@" export RUN_BIN
export RUN_DIR
export RUN_TASK
script="$RUN_DIR"/scripts.local/"$task"
[ -f "$script" ] || script="$RUN_DIR"/scripts/"$task"
[ -f "$RUN_DIR"/.env.local ] && . "$RUN_DIR"/.env.local
exec "$script" "$@"