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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user