From a2848f6d67f40f57e201b7c73b12b837b40bb7d3 Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Sun, 22 Feb 2026 12:03:56 +0100 Subject: [PATCH] fix(felhom-wipe): nuclear wipe stops early due to set -e + missing state files [ -f "$f" ] && rm -f "$f" && info "..." returns exit code 1 when the file doesn't exist, triggering set -euo pipefail. Nuclear wipe was silently stopping after settings.json and metrics.db (the only two state files present), never reaching the controller/full/nuclear steps. Fix: if [ -f "$f" ]; then rm -f "$f" && info "..."; fi Co-Authored-By: Claude Sonnet 4.6 --- CHANGELOG.md | 1 + scripts/felhom-wipe.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c466682..9337eeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ #### `scripts/felhom-wipe.sh` - **`cleanup_scan_dir()`**: removes `/mnt/.felhom-scan/` (ephemeral DR scan directory) — called from `full` level onwards. - **`cleanup_raw_mounts()`**: removes raw helper mount infrastructure (`/mnt/.felhom-raw/`) at `nuclear` level: unmounts bind mounts first, then raw mounts, strips fstab entries, removes empty directories. Physical drive data untouched. +- **Bug fix**: `do_soft_wipe()` used `[ -f "$f" ] && rm -f "$f" && info "..."` — with `set -euo pipefail`, when a state file doesn't exist `[ -f ]` returns 1, the whole `&&` chain returns 1, and `set -e` exits the script. Nuclear wipe was silently stopping after removing only the first two state files that existed. Fixed with `if [ -f "$f" ]; then ...; fi`. #### `scripts/README.md` - Hub mode quick start simplified to one-liner diff --git a/scripts/felhom-wipe.sh b/scripts/felhom-wipe.sh index 24ebbbe..65cf078 100644 --- a/scripts/felhom-wipe.sh +++ b/scripts/felhom-wipe.sh @@ -346,7 +346,7 @@ do_soft_wipe() { info "Soft wipe: removing controller state..." local state_files=("$DATA_DIR/settings.json" "$DATA_DIR/metrics.db" "$DATA_DIR/setup-state.json" "$DATA_DIR/update-state.json" "$DATA_DIR/session-data.json" "$DATA_DIR/snapshot-history.json") for f in "${state_files[@]}"; do - [ -f "$f" ] && rm -f "$f" && info " Removed: $f" + if [ -f "$f" ]; then rm -f "$f" && info " Removed: $f"; fi done }