diff --git a/papur-addon/run.sh b/papur-addon/run.sh index 580c9e3..61052c2 100644 --- a/papur-addon/run.sh +++ b/papur-addon/run.sh @@ -30,14 +30,20 @@ export TZ="$TZNAME" # Reduce risk of secrets ending up in logs set +x -# Persist everything under /data -export HOME=/data -mkdir -p /data/.clawdbot /data/clawd /data/keys /data/secrets +# HA add-ons mount persistent storage at /config (maps to /addon_configs/ on the host). +# Use /config as HOME so Clawdbot finds its auth store and config there. +export HOME=/config +mkdir -p /config/.clawdbot /config/clawd /config/keys /config/secrets + +# Back-compat: some docs/scripts assume /data; point it at /config. +if [ ! -e /data ]; then + ln -s /config /data || true +fi # Store HA token (optional) in a local file for later use by the HA skill/tooling. if [ -n "$HA_TOKEN" ]; then umask 077 - printf '%s' "$HA_TOKEN" > /data/secrets/homeassistant.token + printf '%s' "$HA_TOKEN" > /config/secrets/homeassistant.token fi # Decide Telegram DM access policy. @@ -63,7 +69,7 @@ if [ -z "$GW_TOKEN" ]; then GW_AUTH_BLOCK="auth: { mode: \"token\" }" fi -cat > /data/.clawdbot/clawdbot.json < /config/.clawdbot/clawdbot.json < /data/.clawdbot/clawdbot.json <}" # Connectivity sanity checks (do NOT print the token) # Auth store debug (redacted): never print tokens -AUTH_STORE="/data/.clawdbot/agents/main/agent/auth-profiles.json" +AUTH_STORE="/config/.clawdbot/agents/main/agent/auth-profiles.json" if [ -f "$AUTH_STORE" ]; then echo "Auth store present at $AUTH_STORE" echo "Auth store summary (redacted):" @@ -130,8 +136,8 @@ else fi # Convenience info for later (MikroTik access path & HA token file) -cat > /data/CONNECTION_NOTES.txt < /config/CONNECTION_NOTES.txt <