extra.setup: make the fzf install repeatable and keep an existing zshrc

git clone failed on every run after the first, and ~/.fzf/install asks
three questions - both stop an unattended run. The rc file is not touched
because extra/zshrc sources ~/.fzf.zsh itself.

~/.zshrc was overwritten without a copy; the first one seen is kept as
~/.zshrc.bak.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-14 10:55:20 +02:00
co-authored by Claude Opus 5
parent ada2de1f24
commit 5381c20411
+11 -3
View File
@@ -26,9 +26,17 @@ system("curl -s https://ohmyposh.dev/install.sh | bash -s -- -d /db/bin");
system("mkdir -p /db/etc");
system("cp extra/omp.json /db/etc/");
system("git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf");
system("~/.fzf/install");
if (-d "$HOME/.fzf") {
system("cd $HOME/.fzf && git pull --ff-only");
} else {
system("git clone --depth 1 https://github.com/junegunn/fzf.git $HOME/.fzf");
}
# The flags are what makes it run without asking. No --update-rc: the zshrc
# below sources ~/.fzf.zsh itself.
system("$HOME/.fzf/install --key-bindings --completion --no-update-rc");
system("cp -r extra/zshrc $HOME/.zshrc");
# Whatever zshrc is already there belongs to someone - keep the first one.
system("cp $HOME/.zshrc $HOME/.zshrc.bak") if (-f "$HOME/.zshrc" && !-f "$HOME/.zshrc.bak");
system("cp extra/zshrc $HOME/.zshrc");
########################################################################################################### END