2026-05-09 16:04:32 +00:00
|
|
|
#!/bin/bash
|
2026-05-09 17:39:23 +00:00
|
|
|
# Startup permission fix + TTS patch.
|
2026-05-09 16:04:32 +00:00
|
|
|
# Runs as root before the entrypoint drops to the hermes user.
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
HERMES_HOME="${HERMES_HOME:-/opt/data}"
|
|
|
|
|
|
2026-05-09 17:39:23 +00:00
|
|
|
# Fix ownership on critical writable directories
|
2026-05-09 16:04:32 +00:00
|
|
|
chown -R hermes:hermes \
|
|
|
|
|
"$HERMES_HOME/sessions" \
|
|
|
|
|
"$HERMES_HOME/checkpoints" \
|
|
|
|
|
"$HERMES_HOME/skills" \
|
|
|
|
|
"$HERMES_HOME/memories" \
|
|
|
|
|
"$HERMES_HOME/workspace" \
|
|
|
|
|
"$HERMES_HOME/pastes" \
|
|
|
|
|
"$HERMES_HOME/logs" \
|
|
|
|
|
"$HERMES_HOME/cron" \
|
|
|
|
|
"$HERMES_HOME/plans" \
|
|
|
|
|
"$HERMES_HOME/hooks" \
|
|
|
|
|
"$HERMES_HOME/cache" \
|
|
|
|
|
2>/dev/null || true
|
|
|
|
|
|
2026-05-09 17:39:23 +00:00
|
|
|
# Fix data volume root ownership
|
2026-05-09 16:04:32 +00:00
|
|
|
if [ "$(stat -c %u "$HERMES_HOME" 2>/dev/null)" != "$(id -u hermes)" ]; then
|
|
|
|
|
chown hermes:hermes "$HERMES_HOME" 2>/dev/null || true
|
|
|
|
|
fi
|
|
|
|
|
|
2026-05-09 17:36:26 +00:00
|
|
|
# ---------- Patch tts_tool.py: replace Edge TTS with Piper ----------
|
2026-05-09 17:39:23 +00:00
|
|
|
# Fallback runtime patch in case the volume's site-packages differ from the image.
|
|
|
|
|
# Idempotent: if already patched, the script does nothing.
|
2026-05-09 17:36:26 +00:00
|
|
|
PATCH_SCRIPT="/opt/hermes/patch_tts_tool.py"
|
|
|
|
|
if [ -f "$PATCH_SCRIPT" ]; then
|
|
|
|
|
echo "Applying TTS patch (Piper only, no Edge fallback)..."
|
|
|
|
|
/opt/hermes/.venv/bin/python3 "$PATCH_SCRIPT" 2>&1 || true
|
|
|
|
|
fi
|
|
|
|
|
|
2026-05-09 17:39:23 +00:00
|
|
|
# Chain to the official Hermes entrypoint
|
2026-05-09 16:04:32 +00:00
|
|
|
exec /opt/hermes/docker/entrypoint.sh "$@"
|