mirror of
https://github.com/NVIDIA/dgx-spark-playbooks.git
synced 2026-04-22 18:13:52 +00:00
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.
This commit is contained in:
parent
a680d0472b
commit
3e9a50b48c
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user