From 2fb2cf80694b67583a01d9b36293b2d8f9af5782 Mon Sep 17 00:00:00 2001 From: andwati Date: Mon, 16 Nov 2026 09:07:34 +0300 Subject: [PATCH] fix(install): only install missing packages, skip backup of folded stow targets --- install.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 9b57c7b..0e153f4 100755 --- a/install.sh +++ b/install.sh @@ -8,10 +8,15 @@ set -euo pipefail DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ZSH_CUSTOM="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}" -# Arch packages the dotfiles rely on. -yay -S --needed \ - stow git curl zsh gnupg pinentry \ - neovim ripgrep fd fzf zoxide eza fnm wl-clipboard gcc make jdk21-openjdk +# Arch packages the dotfiles rely on; yay only runs if something is missing. +pkgs=( + stow git curl zsh gnupg pinentry + neovim ripgrep fd fzf zoxide eza wl-clipboard gcc make jdk21-openjdk +) +mapfile -t missing < <(pacman -T "${pkgs[@]}" || true) +if [ "${#missing[@]}" -gt 0 ]; then + yay -S --needed "${missing[@]}" +fi clone_if_missing() { local url="$1" dst="$2" @@ -40,6 +45,9 @@ stow_package() { while IFS= read -r -d '' f; do rel="${f#"$DOTFILES_DIR/$pkg/"}" target="$HOME/$rel" + case "$(realpath -m "$target")" in + "$DOTFILES_DIR"/*) continue ;; + esac if [ -L "$target" ]; then rm "$target" elif [ -e "$target" ]; then