diff options
author | Rasmus Andersson <rasmus@notion.se> | 2021-06-18 20:35:53 +0300 |
---|---|---|
committer | Rasmus Andersson <rasmus@notion.se> | 2021-06-18 20:35:59 +0300 |
commit | a2de1641ae8c8276961c3c7d33c0b6cb4aabe84d (patch) | |
tree | a369dcd045fb8c8384575e63e20367faa266bfdb | |
parent | 5bf09d03d0143c39ef0a270570faac30b7d72758 (diff) | |
download | inter-a2de1641ae8c8276961c3c7d33c0b6cb4aabe84d.tar.xz |
init.sh fixes for zsh
-rwxr-xr-x | init.sh | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1,6 +1,8 @@ #!/bin/bash +SCRIPT_FILE=${BASH_SOURCE[0]} +[ -n "$SCRIPT_FILE" ] || SCRIPT_FILE=${(%):-%N} # zsh +SRCDIR=$(dirname "$(realpath "$SCRIPT_FILE")") -SRCDIR=$(dirname "${BASH_SOURCE[0]}") BUILD_DIR=$SRCDIR/build if [[ "${BUILD_DIR:0:2}" == "./" ]]; then @@ -12,7 +14,7 @@ DIST_DIR_TOK='$(FONTDIR)/' BUILD_TMP_DIR=$BUILD_DIR/tmp VENV_DIR=$BUILD_DIR/venv -if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then +if [[ "$SCRIPT_FILE" != "${0}" ]]; then # sourced if [[ -z $VIRTUAL_ENV ]] && [[ ! -f "$VENV_DIR/bin/activate" ]]; then echo "Project not configured." >&2 @@ -24,6 +26,12 @@ if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then popd >/dev/null 2>&1 export PYTHONPATH=$SRCDIR_ABS/misc/tools fi + unset SRCDIR + unset BUILD_DIR + unset SCRIPT_FILE + unset DIST_DIR_TOK + unset BUILD_TMP_DIR + unset VENV_DIR else # Subshell set -e |