summaryrefslogtreecommitdiff
path: root/init.sh
diff options
context:
space:
mode:
authorRasmus Andersson <rasmus@notion.se>2021-06-18 20:35:53 +0300
committerRasmus Andersson <rasmus@notion.se>2021-06-18 20:35:59 +0300
commita2de1641ae8c8276961c3c7d33c0b6cb4aabe84d (patch)
treea369dcd045fb8c8384575e63e20367faa266bfdb /init.sh
parent5bf09d03d0143c39ef0a270570faac30b7d72758 (diff)
downloadinter-a2de1641ae8c8276961c3c7d33c0b6cb4aabe84d.tar.xz
init.sh fixes for zsh
Diffstat (limited to 'init.sh')
-rwxr-xr-xinit.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/init.sh b/init.sh
index f634f3c3c..b850b0fef 100755
--- a/init.sh
+++ b/init.sh
@@ -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