Fix maintainerr config lost after restart: use persistent /addon_configs/maintainerr path

The entrypoint was setting DATA_DIR="/config" which is NOT a persistent
path in HA addon containers using addon_config:rw with init: false.
Changed to /addon_configs/maintainerr (the persistent path mapped by
addon_config:rw in config.yaml), matching the pattern used by the
cleanuparr addon.

Agent-Logs-Url: https://github.com/alexbelgium/hassio-addons/sessions/40b7927f-cd03-4b83-a80a-ad56bd6dce32

Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-31 08:32:12 +00:00
parent 4974eff216
commit 51bb0fdceb
3 changed files with 23 additions and 11 deletions

View File

@@ -24,17 +24,26 @@ if [ -d /etc/cont-init.d ]; then
fi
# ─── Setup persistent data directory ─────────────────────────────────────────
# /opt/data is a Docker VOLUME in the upstream image and cannot be removed.
# Maintainerr supports the DATA_DIR env var to redirect data storage.
DATA_DIR="/config"
echo "[Maintainerr] Setting up data directory: $DATA_DIR"
mkdir -p "$DATA_DIR"
# Only chown on first run to avoid slow startup on large directories
if [ ! -f "$DATA_DIR/.initialized" ]; then
chown -R node:node "$DATA_DIR"
touch "$DATA_DIR/.initialized"
# /opt/data is a Docker VOLUME in the upstream image; it is NOT persistent
# across addon updates/reinstalls in HA. Use the addon_config directory
# which is mapped by "addon_config:rw" in config.yaml and survives restarts.
HA_DATA_DIR="/addon_configs/maintainerr"
echo "[Maintainerr] Setting up data directory: $HA_DATA_DIR"
mkdir -p "$HA_DATA_DIR"
# Copy any seed / initial data from the upstream volume on first run
if [ -d /opt/data ] && [ ! -f "$HA_DATA_DIR/.initialized" ]; then
cp -rn /opt/data/. "$HA_DATA_DIR/" 2>/dev/null || true
fi
export DATA_DIR
# Only chown on first run to avoid slow startup on large directories
if [ ! -f "$HA_DATA_DIR/.initialized" ]; then
chown -R node:node "$HA_DATA_DIR"
touch "$HA_DATA_DIR/.initialized"
fi
# Tell Maintainerr to use the persistent directory
export DATA_DIR="$HA_DATA_DIR"
# ─── Start Maintainerr as unprivileged node user ─────────────────────────────
echo "[Maintainerr] Starting application on port ${UI_PORT:-6246}..."