diff --git a/scripts/felhom-wipe.sh b/scripts/felhom-wipe.sh index e1634e0..a739cb1 100644 --- a/scripts/felhom-wipe.sh +++ b/scripts/felhom-wipe.sh @@ -80,8 +80,8 @@ parse_args() { # --- Detect Paths --- detect_paths() { - # Auto-detect from controller.yaml if present - if [ -f "$CONTROLLER_YAML" ]; then + # Auto-detect from controller.yaml if readable (may be root-owned) + if [ -f "$CONTROLLER_YAML" ] && [ -r "$CONTROLLER_YAML" ]; then local sd sd=$(grep -oP 'stacks_dir:\s*\K\S+' "$CONTROLLER_YAML" 2>/dev/null || true) [ -n "$sd" ] && STACKS_DIR="$sd" @@ -89,6 +89,18 @@ detect_paths() { dd=$(grep -oP 'data_dir:\s*\K\S+' "$CONTROLLER_YAML" 2>/dev/null || true) [ -n "$dd" ] && DATA_DIR="$dd" && SETTINGS_JSON="$dd/settings.json" fi + + # If settings.json not found at configured path, try the Docker volume directly. + # The controller stores data in a named volume (felhom-controller_controller-data), + # not at the container-internal path on the host filesystem. + if [ ! -f "$SETTINGS_JSON" ]; then + local vol_path + vol_path=$(docker volume inspect felhom-controller_controller-data --format '{{.Mountpoint}}' 2>/dev/null || true) + if [ -n "$vol_path" ] && [ -d "$vol_path" ]; then + DATA_DIR="$vol_path" + SETTINGS_JSON="$vol_path/settings.json" + fi + fi } # --- Detect Storage Paths --- @@ -109,9 +121,9 @@ except: pass " 2>/dev/null || true) fi - # Also scan /mnt/* for felhom-data dirs not in registry + # Also scan /mnt/* for felhom-managed dirs not in registry for d in /mnt/*/; do - [ -d "${d}felhom-data" ] || [ -d "${d}appdata" ] || continue + [ -d "${d}felhom-data" ] || [ -d "${d}appdata" ] || [ -d "${d}backups" ] || continue local already=false for sp in "${STORAGE_PATHS[@]:-}"; do [ "$sp" = "${d%/}" ] && already=true && break