Fix fisher conflicts and stale end-4 paths found by the smoke test

First real run of tests/smoke.sh surfaced three issues:

- fish.sh: repo configs/ ships fisher.fish and nvm.fish functions, so the
  new (previously always-broken) 'fisher install' hit fisher's own
  conflict check and aborted. Now: check 'type -q fisher' / 'type -q nvm'
  inside fish and only bootstrap what is actually missing.
- fish.sh: end-4 renamed hypr/hyprland/colors.conf to colors.lua and
  moved hyprlock colors under hypr/hyprlock/ - the stale paths made the
  old script abort on cp. Updated paths, warn-and-skip stays as the
  safety net if upstream moves again.
- LazyVim.sh: same fisher conflict class in its fish branch - guard the
  nvm.fish install with a 'type -q nvm' check.
- tests/smoke.sh: the zsh backup assertion was wrong (fresh container has
  no .zshrc for run 1 to back up). Pre-seed a marker config instead and
  assert both rotation (2 backups) and that neither run destroys the
  original content.

Verified: tests/smoke.sh fish.sh zsh.sh -> PASS/PASS, bat.sh -> PASS;
pre-push hook green on all 9 scripts.
This commit is contained in:
alvinlollo
2026-10-08 14:26:56 +11:00
parent f8bb57f666
commit 8320546ad4
3 changed files with 42 additions and 14 deletions
+5
View File
@@ -129,7 +129,12 @@ fish)
fish -c "source '$fisher_src' && fisher install jorgebucaran/fisher"
rm -f "$fisher_src"
fi
# fisher refuses to install over existing files - skip when already present
if fish -c 'type -q nvm' 2>/dev/null; then
echo "nvm.fish already available in fish, skipping install."
else
fish -c 'fisher install jorgebucaran/nvm.fish'
fi
else
echo "No ~/.config/fish/config.fish found, skipping fish plugin setup"
fi
+22 -7
View File
@@ -89,7 +89,7 @@ if [ -n "$SCRIPT_DIR" ] && [ -d "$SCRIPT_DIR/configs" ]; then
fish/config.fish \
fish/auto-Hypr.fish \
fish/fish_variables \
hypr/hyprland/colors.conf \
hypr/hyprland/colors.lua \
hypr/hyprlock/colors.conf; do
if [ ! -f "$SCRIPT_DIR/configs/$rel" ] && [ -f "$WORK_DIR/dots-hyprland/dots/.config/$rel" ]; then
mkdir -p "$(dirname "$SCRIPT_DIR/configs/$rel")"
@@ -152,19 +152,34 @@ if cfg_src fish/conf.d >/dev/null 2>&1 && [ ! -d "$HOME/.config/fish/conf.d" ];
cp -r "$(cfg_src fish/conf.d)" "$HOME/.config/fish/"
fi
# Copy color configs to user config if they don't exist
install_file hypr/hyprland/colors.conf "$HOME/.config/hypr/hyprland/colors.conf"
# Copy color configs to user config if they don't exist.
# end-4 renamed hyprland's colors.conf to colors.lua and keeps hyprlock's
# colors under hypr/hyprlock/ - warn and skip if upstream moves again.
install_file hypr/hyprland/colors.lua "$HOME/.config/hypr/hyprland/colors.lua"
install_file hypr/hyprlock/colors.conf "$HOME/.config/hypr/hyprlock/colors.conf"
# Install Fisher plugin manager + plugins, running inside fish (this is bash)
if ! curl -fsSL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish \
# Install the Fisher plugin manager and nvm.fish, running inside fish (this is
# bash). The repo configs may already ship these functions (copied above) -
# fisher refuses to install over existing files, so only bootstrap what is
# actually missing instead of forcing a re-install.
if fish -c 'type -q fisher' 2>/dev/null; then
echo "Fisher is already available in fish (from configs/), skipping bootstrap."
else
if ! curl -fsSL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish \
-o "$WORK_DIR/fisher.fish"; then
echo "error: failed to download the fisher.fish installer" >&2
exit 1
fi
if ! fish -c "source '$WORK_DIR/fisher.fish' && fisher install jorgebucaran/fisher"; then
echo "error: failed to install Fisher into fish" >&2
exit 1
fi
fi
if ! fish -c "source '$WORK_DIR/fisher.fish' && fisher install jorgebucaran/fisher jorgebucaran/nvm.fish"; then
echo "error: failed to install Fisher and nvm.fish into fish" >&2
if fish -c 'type -q nvm' 2>/dev/null; then
echo "nvm.fish is already available in fish, skipping install."
elif ! fish -c 'fisher install jorgebucaran/nvm.fish'; then
echo "error: failed to install nvm.fish into fish" >&2
exit 1
fi
+11 -3
View File
@@ -95,13 +95,21 @@ for script in "${SCRIPTS[@]}"; do
;;
zsh.sh)
run_test "$script" '
# pre-seed a config so BOTH runs have something to back up
printf "# preexisting zshrc marker\n" > /root/.zshrc
bash zsh.sh --skip-watermark
[ -f /root/.zshrc ] || { echo ".zshrc missing"; exit 1; }
[ -d /root/.oh-my-zsh/custom/plugins/zsh-autosuggestions ] || { echo "plugins missing"; exit 1; }
# second run must rotate the backup, not overwrite it
n=$(find /root -maxdepth 1 -name ".zshrc.bak-*" | wc -l)
[ "$n" -eq 1 ] || { echo "expected 1 backup after first run, got $n"; exit 1; }
grep -q "preexisting zshrc marker" /root/.zshrc.bak-* \
|| { echo "first backup does not hold the original config"; exit 1; }
# second run must rotate (new timestamped backup), not overwrite
bash zsh.sh --skip-watermark
[ "$(find /root -maxdepth 1 -name ".zshrc.bak-*" | wc -l)" -ge 2 ] \
|| { echo "backup rotation failed"; exit 1; }
n=$(find /root -maxdepth 1 -name ".zshrc.bak-*" | wc -l)
[ "$n" -eq 2 ] || { echo "expected 2 backups after second run (rotation), got $n"; exit 1; }
grep -q "preexisting zshrc marker" /root/.zshrc.bak-* \
|| { echo "second run destroyed an earlier backup"; exit 1; }
'
;;
fish.sh)