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:
+16
-4
@@ -80,8 +80,8 @@ parse_args() {
|
|||||||
|
|
||||||
# --- Detect Paths ---
|
# --- Detect Paths ---
|
||||||
detect_paths() {
|
detect_paths() {
|
||||||
# Auto-detect from controller.yaml if present
|
# Auto-detect from controller.yaml if readable (may be root-owned)
|
||||||
if [ -f "$CONTROLLER_YAML" ]; then
|
if [ -f "$CONTROLLER_YAML" ] && [ -r "$CONTROLLER_YAML" ]; then
|
||||||
local sd
|
local sd
|
||||||
sd=$(grep -oP 'stacks_dir:\s*\K\S+' "$CONTROLLER_YAML" 2>/dev/null || true)
|
sd=$(grep -oP 'stacks_dir:\s*\K\S+' "$CONTROLLER_YAML" 2>/dev/null || true)
|
||||||
[ -n "$sd" ] && STACKS_DIR="$sd"
|
[ -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)
|
dd=$(grep -oP 'data_dir:\s*\K\S+' "$CONTROLLER_YAML" 2>/dev/null || true)
|
||||||
[ -n "$dd" ] && DATA_DIR="$dd" && SETTINGS_JSON="$dd/settings.json"
|
[ -n "$dd" ] && DATA_DIR="$dd" && SETTINGS_JSON="$dd/settings.json"
|
||||||
fi
|
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 ---
|
# --- Detect Storage Paths ---
|
||||||
@@ -109,9 +121,9 @@ except: pass
|
|||||||
" 2>/dev/null || true)
|
" 2>/dev/null || true)
|
||||||
fi
|
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
|
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
|
local already=false
|
||||||
for sp in "${STORAGE_PATHS[@]:-}"; do
|
for sp in "${STORAGE_PATHS[@]:-}"; do
|
||||||
[ "$sp" = "${d%/}" ] && already=true && break
|
[ "$sp" = "${d%/}" ] && already=true && break
|
||||||
|
|||||||
Reference in New Issue
Block a user