fix(felhom-wipe): detect sys_drive and other backups-only storage paths

Two bugs prevented /mnt/sys_drive (and similar drives) from being detected:

1. controller.yaml is root-owned (permission denied from host), so data_dir
   could not be read. Settings.json was never loaded, falling back to /mnt/*
   scan only. Fix: also try `docker volume inspect felhom-controller_controller-data`
   to locate the actual settings.json in the Docker volume.

2. Fallback /mnt/* scan only checked for felhom-data/ or appdata/, missing
   drives that only have backups/ (e.g. sys_drive pre-v0.26.0). Fix: also
   check for backups/ in the scan condition.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-22 10:31:12 +01:00
parent a5f8c7a76c
commit 4a9ed71b7a
+16 -4
View File
@@ -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