From 63d83385e2c02cbb3d8e8b335d28b3b5ae77a29a Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sun, 31 Jul 2022 21:47:01 -0500 Subject: [PATCH] feat: set some defintions at root level --- install.bash | 6 ++++++ installers/zsh.bash | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/install.bash b/install.bash index c87f6a3..1d857de 100644 --- a/install.bash +++ b/install.bash @@ -87,6 +87,12 @@ main() { exit 1 fi + # shellcheck disable=2155 + export SOURCE_DIR="$( + # shellcheck disable=2046,2164 + cd $(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)/dots + pwd + )" for installer in "${installers[@]}"; do log "info" "Running installer: ${M_COLOR}${installer}${RESET_BOLD}" if ! bash "${installer}"; then diff --git a/installers/zsh.bash b/installers/zsh.bash index 7974013..bd632cc 100755 --- a/installers/zsh.bash +++ b/installers/zsh.bash @@ -2,7 +2,7 @@ set -eo pipefail DEPS_PATH="${HOME}/.local/share" -SCRIPT_DIR="$( cd $(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)/../dots; pwd)" +SOURCE_DIR="$( cd $(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)/../dots; pwd)" PKG_INSTALL_CMD="" BOLD=$(tput bold) @@ -211,7 +211,7 @@ deploy-config() { ) for install_key in "${!install_paths[@]}"; do - local src_path="${SCRIPT_DIR}/${install_paths[${install_key}]}" + local src_path="${SOURCE_DIR}/${install_paths[${install_key}]}" local dest_path="${HOME}/${install_paths[${install_key}]}" if [[ -e "${dest_path}" ]]; then @@ -230,7 +230,7 @@ deploy-config() { main() { local tasks_done=() - log "info" "Set source directory as ${M_COLOR}${SCRIPT_DIR}${RESET_BOLD}" + log "info" "Set source directory as ${M_COLOR}${SOURCE_DIR}${RESET_BOLD}" log "info" "Dependencies directory set to ${M_COLOR}${DEPS_PATH}${RESET_BOLD}" log "info" "Packager install command set to ${M_COLOR}${PKG_INSTALL_CMD}${RESET_BOLD}" mkdir -p "${DEPS_PATH}"