Compare commits

..

6 Commits

Author SHA1 Message Date
443361cddb chore(scripts): remove unused VERBOSE declarations
Remove VERBOSE="${VERBOSE:-0}" from scripts that never reference
$VERBOSE after setting it. The variable is already set in
scripts/shared.sh line 5.
2026-02-05 22:57:20 +02:00
083d30a0c3 fix(scripts): fix shared.sh guard logic and echo -e portability
- shared.sh: simplify guard logic, remove misleading warning message,
  use ${VAR:-} pattern to avoid unbound variable error
- install-cheat-purebashbible.sh: replace echo -e with printf for
  POSIX portability
2026-02-05 22:55:27 +02:00
81190c051a 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
2026-02-05 22:53:04 +02:00
de773ad68f refactor(scripts): add set -euo pipefail to all installer scripts
Add strict error handling to all scripts:
- 13 scripts get `set -euo pipefail`
- install-macos-defaults.sh gets `set -uo pipefail` (without -e) because
  defaults write commands may fail on newer macOS versions
- install-cargo-packages.sh: also add missing source of shared.sh
2026-02-05 22:51:40 +02:00
e8725c4b47 fix(scripts): use safe temp directories and fix composer exit code
- install-ntfy.sh: use mktemp -d with cleanup trap instead of /tmp/ntfy_*
- install-git-crypt.sh: use mktemp -d with cleanup trap instead of /tmp/git-crypt
- install-composer.sh: only move composer.phar if installation succeeded
2026-02-05 22:49:36 +02:00
b8070e2815 fix(scripts): add missing exit after error handlers
Critical bugs where error paths print a message but don't stop execution:
- install-fonts.sh: cd failure now exits properly
- install-ntfy.sh: unsupported OS case now exits with error
- install-git-crypt.sh: git clone and cd failures now exit properly
2026-02-05 22:44:44 +02:00
16 changed files with 48 additions and 57 deletions

View File

@@ -1 +1 @@
3.14.3
3.14.2

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
# @description Create file containing key mappings for Neovim
# Usage: ./create-nvim-keymaps.sh
#
@@ -15,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"

View File

@@ -1,5 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
# @description Install cargo/rust packages.
#
# shellcheck source=shared.sh
source "$DOTFILES/config/shared.sh"
msgr run "Starting to install rust/cargo packages"

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
# @description Update pure-bash-bible cheatsheets
# shellcheck disable=SC2231,SC2034,SC2181,SC2068
# shellcheck source=shared.sh
@@ -85,7 +86,7 @@ process_chapters()
if [ '---' != "$(head -1 < "$cheat_file")" ]; then
local metadata
metadata="$PBB_SYNTAX\n$PBB_TAGS\n$PBB_SOURCE\n"
echo -e "---\n$metadata---\n$(cat "$cheat_file")" > "$cheat_file"
printf '%s\n%b%s\n%s' "---" "$metadata" "---" "$(cat "$cheat_file")" > "$cheat_file"
fi
done
}

View File

@@ -1,8 +1,9 @@
#!/usr/bin/env bash
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"
@@ -22,5 +23,7 @@ fi
php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
mv composer.phar ~/.local/bin/composer
if [ $RESULT -eq 0 ]; then
mv composer.phar ~/.local/bin/composer
fi
exit $RESULT

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
# @description Install NerdFonts
#
# shellcheck source="shared.sh"
@@ -21,7 +22,7 @@ clone_or_update_repo()
git clone --quiet --filter=blob:none --sparse --depth=1 "$GIT_REPO" "$TMP_PATH"
fi
cd "$TMP_PATH" || msgr err "No such folder $TMP_PATH"
cd "$TMP_PATH" || { msgr err "No such folder $TMP_PATH"; exit 1; }
}
# Function to add fonts to sparse-checkout

View File

@@ -1,12 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail
# @description Install GitHub CLI extensions
#
# shellcheck source="shared.sh"
source "${DOTFILES}/config/shared.sh"
# Enable verbosity with VERBOSE=1
VERBOSE="${VERBOSE:-0}"
msgr run "Installing gh (GitHub Client) extensions"
if ! command -v gh &> /dev/null; then

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
# @description Install git-crypt
#
# NOTE: Experimental, wip
@@ -6,21 +7,17 @@
# shellcheck source=shared.sh
source "${DOTFILES}/config/shared.sh"
# Enable verbosity with VERBOSE=1
VERBOSE="${VERBOSE:-0}"
msgr run "Installing git-crypt"
if ! command -v git-crypt &> /dev/null; then
REPO_URL="https://github.com/AGWA/git-crypt.git"
CHECK_PATH="${XDG_BIN_HOME}/git-crypt"
BUILD_PATH="/tmp/git-crypt"
BUILD_PATH="$(mktemp -d)"
trap 'rm -rf "$BUILD_PATH"' EXIT
rm -rf "$BUILD_PATH"
if [ ! -d "$CHECK_PATH" ]; then
git clone --depth 1 "$REPO_URL" "$BUILD_PATH" || true
cd "$BUILD_PATH" || msg_err "$BUILD_PATH not found"
if [ ! -f "$CHECK_PATH" ]; then
git clone --depth 1 "$REPO_URL" "$BUILD_PATH" || { msgr err "Failed to clone $REPO_URL"; exit 1; }
cd "$BUILD_PATH" || { msgr err "$BUILD_PATH not found"; exit 1; }
make && make install PREFIX="$HOME/.local"
else
msgr run_done "git-crypt ($CHECK_PATH) already installed"

View File

@@ -1,12 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail
# @description Install Go packages
#
# shellcheck source=shared.sh
source "$DOTFILES/config/shared.sh"
# Enable verbosity with VERBOSE=1
VERBOSE="${VERBOSE:-0}"
msgr run "Installing go packages"
! x-have "go" && msgr err "go hasn't been installed yet." && exit 0

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -uo pipefail
# @description Sets macOS Defaults that I like
#
# This script contains large portions from following scripts:
@@ -7,7 +8,7 @@
[ "$(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:"
@@ -23,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

View File

@@ -1,12 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail
# @description Install npm packages globally.
#
# shellcheck source=shared.sh
source "$DOTFILES/config/shared.sh"
# Enable verbosity with VERBOSE=1
VERBOSE="${VERBOSE:-0}"
msgr msg "Starting to install npm packages"
if ! command -v npm &> /dev/null; then

View File

@@ -1,12 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail
# @description Install ntfy
#
# shellcheck source=shared.sh
source "$DOTFILES/config/shared.sh"
# Enable verbosity with VERBOSE=1
VERBOSE="${VERBOSE:-0}"
# Check if ntfy is already installed
if x-have "ntfy"; then
msgr "done" "ntfy already installed"
@@ -23,28 +21,31 @@ case $(dfm check arch) in
;;
*)
msgr err "Unsupported OS"
exit 1
;;
esac
NTFY_VERSION="$(x-gh-get-latest-version binwiederhier/ntfy)"
NTFY_URL="https://github.com/binwiederhier/ntfy"
NTFY_DEST="/tmp/ntfy_${NTFY_VERSION}_${NTFY_ARCH}"
NTFY_TARBALL="ntfy_${NTFY_VERSION}_${NTFY_ARCH}.tar.gz"
NTFY_DIR="ntfy_${NTFY_VERSION}_${NTFY_ARCH}"
# Download and extract ntfy
install_ntfy()
{
curl -L "$NTFY_URL/releases/download/v${NTFY_VERSION}/${NTFY_DEST}.tar.gz" -o "${NTFY_DEST}.tar.gz"
tar zxvf "${NTFY_DEST}.tar.gz"
cp -a "${NTFY_DEST}/ntfy" ~/.local/bin/ntfy
local tmpdir
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
curl -L "$NTFY_URL/releases/download/v${NTFY_VERSION}/${NTFY_TARBALL}" -o "$tmpdir/${NTFY_TARBALL}"
tar zxvf "$tmpdir/${NTFY_TARBALL}" -C "$tmpdir"
cp -a "$tmpdir/${NTFY_DIR}/ntfy" ~/.local/bin/ntfy
mkdir -p ~/.config/ntfy
# Copy config only if it does not exist
if [ ! -f "$HOME/.config/ntfy/client.yml" ]; then
cp "${NTFY_DEST}/client/client.yml" ~/.config/ntfy/client.yml
cp "$tmpdir/${NTFY_DIR}/client/client.yml" ~/.config/ntfy/client.yml
fi
# Clean up
rm -rf "${NTFY_DEST}" "${NTFY_DEST}.tar.gz"
}
main()

View File

@@ -1,12 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail
# @description Install Python packages using uv.
#
# shellcheck source=shared.sh
source "$DOTFILES/config/shared.sh"
# Enable verbosity with VERBOSE=1
VERBOSE="${VERBOSE:-0}"
msgr run "Starting to install Python packages"
# Ensure uv is available

View File

@@ -1,11 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
# @description Install XCode CLI Tools with osascript magic.
# Ismo Vuorinen <https://github.com/ivuorinen> 2018
#
# Enable verbosity with VERBOSE=1
VERBOSE="${VERBOSE:-0}"
# Check if the script is running on macOS
if [ "$(uname)" != "Darwin" ]; then
msgr warn "Not a macOS system"
@@ -31,7 +29,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

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
# @description Install z
#
# shellcheck source=shared.sh

View File

@@ -4,17 +4,8 @@
# Helper env variables. Use like this: VERBOSE=1 ./script.sh
: "${VERBOSE:=0}"
# Set variable that checks if the shared.sh script has been
# sourced only once If the script has been sourced more than once,
# the script not be sourced again.
[ -z "$SHARED_SCRIPTS_SOURCED" ] && {
# Source the main shared config if not already loaded
if [ -z "${SHARED_SCRIPTS_SOURCED:-}" ]; then
source "${DOTFILES}/config/shared.sh"
# Warn the user if the shared configuration hasn't been loaded yet
msgr warn "(!) shared.sh not sourced"
# Set variable that checks if the shared.sh script has been
# sourced only once.
# shellcheck disable=SC2034
export SHARED_SCRIPTS_SOURCED=1
}
fi