From 81190c051aadb61e0667f5afd03da03e75f067cd Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Thu, 5 Feb 2026 22:53:04 +0200 Subject: [PATCH] fix(scripts): standardize source paths and quoting - install-composer.sh: use $DOTFILES instead of $HOME/.dotfiles - install-macos-defaults.sh: use $DOTFILES, replace which with command -v - install-xcode-cli-tools.sh: quote command substitution - create-nvim-keymaps.sh: quote $DEST in nvim redir command --- scripts/create-nvim-keymaps.sh | 2 +- scripts/install-composer.sh | 2 +- scripts/install-macos-defaults.sh | 6 +++--- scripts/install-xcode-cli-tools.sh | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/create-nvim-keymaps.sh b/scripts/create-nvim-keymaps.sh index 9e2b400..ad31a7f 100755 --- a/scripts/create-nvim-keymaps.sh +++ b/scripts/create-nvim-keymaps.sh @@ -16,7 +16,7 @@ main() printf "\`\`\`txt" } > "$DEST" - nvim -c "redir! >> $DEST" -c 'silent verbose map' -c 'redir END' -c 'q' + nvim -c "redir! >> \"$DEST\"" -c 'silent verbose map' -c 'redir END' -c 'q' printf "\n\`\`\`\n\n- Generated on %s\n" "$(date)" >> "$DEST" diff --git a/scripts/install-composer.sh b/scripts/install-composer.sh index abca678..b708b00 100755 --- a/scripts/install-composer.sh +++ b/scripts/install-composer.sh @@ -3,7 +3,7 @@ set -euo pipefail # @description Install PHP Package Manager Composer # # shellcheck source="shared.sh" -source "$HOME/.dotfiles/config/shared.sh" +source "$DOTFILES/config/shared.sh" if ! command -v php &> /dev/null; then msg_err "PHP Not Available, cannot install composer" diff --git a/scripts/install-macos-defaults.sh b/scripts/install-macos-defaults.sh index 291b048..6e7fef2 100755 --- a/scripts/install-macos-defaults.sh +++ b/scripts/install-macos-defaults.sh @@ -8,7 +8,7 @@ set -uo pipefail [ "$(uname)" != "Darwin" ] && echo "Not a macOS system" && exit 0 # shellcheck source=shared.sh -source "$HOME/.dotfiles/config/shared.sh" +source "$DOTFILES/config/shared.sh" msgr run "Starting to set macOS defaults, these require sudo privileges:" @@ -24,12 +24,12 @@ while true; do done 2> /dev/null & # Skip when shell is fish -if [[ $SHELL != $(which fish) ]]; then +if [[ $SHELL != "$(command -v fish)" ]]; then msgr nested "Change user shell to zsh if it is available and not the current" # Change user shell to zsh if not that already. if hash zsh 2> /dev/null; then - [[ $SHELL != $(which zsh) ]] && chsh -s "$(which zsh)" + [[ $SHELL != "$(command -v zsh)" ]] && chsh -s "$(command -v zsh)" fi fi diff --git a/scripts/install-xcode-cli-tools.sh b/scripts/install-xcode-cli-tools.sh index ed9b7fb..a4c803f 100755 --- a/scripts/install-xcode-cli-tools.sh +++ b/scripts/install-xcode-cli-tools.sh @@ -32,7 +32,7 @@ keep_alive_sudo() done 2> /dev/null & } -XCODE_TOOLS_PATH=$(xcode-select -p) +XCODE_TOOLS_PATH="$(xcode-select -p)" XCODE_SWIFT_PATH="$XCODE_TOOLS_PATH/usr/bin/swift" # Function to prompt for XCode CLI Tools installation