Files
hassio-addons/maintainerr/rootfs/ha_entrypoint.sh
copilot-swe-agent[bot] 51bb0fdceb 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>
2026-03-31 08:32:12 +00:00

51 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# shellcheck shell=bash
set -e
###############################################################################
# Home Assistant Addon entrypoint for Maintainerr
# Runs cont-init.d scripts then drops privileges and starts the app.
###############################################################################
# ─── Source standalone bashio if available ───────────────────────────────────
if [ -f /usr/local/lib/bashio-standalone.sh ]; then
# shellcheck disable=SC1091
source /usr/local/lib/bashio-standalone.sh
fi
# ─── Run cont-init.d scripts ─────────────────────────────────────────────────
if [ -d /etc/cont-init.d ]; then
for script in /etc/cont-init.d/*.sh; do
[ -f "$script" ] || continue
echo "[Maintainerr] Running init script: $script"
# Use bash directly (no S6 with-contenv available)
bash "$script"
done
fi
# ─── Setup persistent data directory ─────────────────────────────────────────
# /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
# 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}..."
exec gosu node /opt/app/start.sh