Files
dotfiles/install.d/23-stow.sh
Andrejus 7d2825f9d1 profile: invalidate PATH cache when base PATH changes
Store the base PATH alongside the cached result so the cache is
only used when the pre-modification PATH still matches.  This
prevents stale entries when the shell inherits a different base
PATH (e.g. inside tmux or after system updates).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-24 16:10:12 +00:00

46 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# Install and run stow.
#
if ! command -v stow &> /dev/null; then
case "$DOTS_PKG" in
apt)
sudo apt-get install -qq stow
;;
pacman)
sudo pacman -S --noconfirm stow
;;
brew)
brew install stow
;;
*)
log_warn "Skipping stow install: no supported package manager found"
return 0
;;
esac
fi
stow --version | log_quote
root_dir=${DOTFILES:-$(dirname "$(dirname "$(dirname "$(realpath "$0")")")")}
rm -f "$HOME/.bash_profile"
rm -f "$HOME/.bashrc"
rm -f "$HOME/.gitconfig"
rm -f "$HOME/.profile"
rm -f "$HOME/.zshrc"
rm -f "$HOME/.p10k.zsh"
rm -f "$HOME/.ssh/config"
mkdir -p "$HOME/.config"
mkdir -p "$HOME/.ssh"
stow --dir="$root_dir" --target="$HOME" home
# Bust PATH cache to force rebuild with new profile
rm -f "${XDG_CACHE_HOME:-$HOME/.cache}/dots/path"