diff --git a/scripts/felhom-wipe.sh b/scripts/felhom-wipe.sh index 90b32cf..1b14e55 100644 --- a/scripts/felhom-wipe.sh +++ b/scripts/felhom-wipe.sh @@ -121,9 +121,11 @@ except: pass " 2>/dev/null || true) fi - # Also scan /mnt/* for felhom-managed dirs not in registry + # Also scan /mnt/* for felhom-managed dirs not in registry. + # Detect by presence of felhom-data/, legacy appdata/backups/, or .felhom-infra-backup/ for d in /mnt/*/; do - [ -d "${d}felhom-data" ] || [ -d "${d}appdata" ] || [ -d "${d}backups" ] || continue + [ -d "${d}felhom-data" ] || [ -d "${d}appdata" ] || [ -d "${d}backups" ] \ + || [ -d "${d}.felhom-infra-backup" ] || continue local already=false for sp in "${STORAGE_PATHS[@]:-}"; do [ "$sp" = "${d%/}" ] && already=true && break @@ -248,7 +250,15 @@ print_plan() { echo -e " ${RED}DELETE${NC} Traefik container" echo -e " ${RED}DELETE${NC} Cloudflared container" echo -e " ${RED}DELETE${NC} Portainer container + volume" - echo -e " ${RED}DELETE${NC} .felhom-infra-backup/ (DR markers on all drives)" + echo -e " ${RED}DELETE${NC} .felhom-infra-backup/ (DR markers on detected drives):" + local dr_found=false + for sp in "${STORAGE_PATHS[@]:-}"; do + if [ -d "$sp/.felhom-infra-backup" ]; then + echo -e " ${RED}DELETE${NC} $sp/.felhom-infra-backup/" + dr_found=true + fi + done + $dr_found || echo -e " ${GREEN}(none found)${NC}" if [ -d /mnt/.felhom-raw ]; then echo -e " ${RED}UNMOUNT+DELETE${NC} /mnt/.felhom-raw/ (raw helper mounts + fstab entries)" # Show each raw mount and its bind target @@ -463,6 +473,14 @@ do_nuclear_wipe() { rm -rf "$infra_root/cloudflared" && info " Removed: $infra_root/cloudflared/" rm -rf "$STACKS_DIR" && info " Removed: $STACKS_DIR/" + # Remove any leftover empty mount point dirs under /mnt/ (e.g. /mnt/hdd_1 after + # the bind mount was already cleaned by a prior wipe run). rmdir is safe: it + # refuses to remove non-empty directories, so user data is never at risk. + for mp in /mnt/*/; do + [ -d "$mp" ] || continue + rmdir "$mp" 2>/dev/null && info " Removed empty mount point: $mp" || true + done + echo "" info "Nuclear wipe complete." echo -e "${CYAN}To redeploy, run:${NC}"