From 141f3faeea17644d13f4495e0cd4a498c2e47a91 Mon Sep 17 00:00:00 2001 From: Rezart Qelibari Date: Mon, 14 Feb 2022 14:05:57 +0100 Subject: [PATCH] Use _DIR instead of pwd --- bootstrap.sh | 7 +++++-- install.sh | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 2008d47..0c67001 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -24,8 +24,11 @@ function main() { pushd -q "${tmpdir}" cloneMacOSSystemRepo cloneZSHLibRepo - sudo ./install.sh + sudo "${tmpdir}/install.sh" popd -q } -main +if [[ "${ZSH_EVAL_CONTEXT}" == toplevel ]]; then + _DIR="${0:A:h}" + main +fi diff --git a/install.sh b/install.sh index 52425bb..bc7f936 100755 --- a/install.sh +++ b/install.sh @@ -10,7 +10,7 @@ function ensureDocopts() { } function autoloadZShLib() { - export ASTZWEIG_ZSHLIB="`pwd`/zshlib" + export ASTZWEIG_ZSHLIB="${_DIR}/zshlib" FPATH="${ASTZWEIG_ZSHLIB}:${FPATH}" local funcNames=("${(@f)$(find "${ASTZWEIG_ZSHLIB}" -type f -perm +u=x -maxdepth 1 | awk -F/ '{ print $NF }')}") autoload -Uz "${funcNames[@]}" @@ -290,12 +290,12 @@ function main() { local allModules=() modulesToInstall=() local -A answers configureLogging + lop debug "Current working dir is: `pwd`" lop debug "Called main with $# args: $@" loadModules askNecessaryQuestions [ -z "${config_only}" ] || return 0 installModules - lop debug "Current working dir is: `pwd`" } if [[ "${ZSH_EVAL_CONTEXT}" == toplevel ]]; then