From 3e9a50b48cd858c2a99da77f4fa32199081d758b Mon Sep 17 00:00:00 2001 From: Jason Kneen Date: Sun, 19 Apr 2026 10:23:09 +0100 Subject: [PATCH] fix(install): use nullglob so cleanup doesn't trip set -e on empty install The cleanup loop iterated over the literal "dgx-spark-*" when no existing install was present, causing [ -L ] to fail and set -e to kill the script before the install step. Enable nullglob so unmatched globs disappear, and use explicit if/fi blocks instead of && for the test-then-rm pattern. --- scripts/install.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 3651c46..d32a70a 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -52,14 +52,20 @@ fi # Clean previous installs from BOTH targets so switching modes stays clean. cleanup_skills() { [ -d "$SKILLS_DIR" ] || return 0 - for link in "$SKILLS_DIR/dgx-spark" "$SKILLS_DIR/dgx-spark-"*; do - [ -L "$link" ] && rm "$link" + shopt -s nullglob + local links=("$SKILLS_DIR/dgx-spark" "$SKILLS_DIR/dgx-spark-"*) + shopt -u nullglob + for link in "${links[@]}"; do + if [ -L "$link" ]; then + rm "$link" + fi done } cleanup_plugin() { local link="$PLUGINS_DIR/dgx-spark-playbooks" - [ -L "$link" ] && rm "$link" - return 0 + if [ -L "$link" ]; then + rm "$link" + fi } cleanup_skills cleanup_plugin