33# The entrypoint (/init.sh) runs /srv/init.sh if it exists before the main command.
44#
55# Source: https://github.com/umputun/ralphex/blob/master/scripts/internal/init-docker.sh
6- # Copied as-is from umputun/ralphex. Check upstream for updates.
6+ # Copied from umputun/ralphex; local additions are marked "Local:" or cite
7+ # an issue. Check upstream for updates.
8+
9+ # ── Local: ~/.claude must exist without the host mount (#128) ───────────────
10+ # rtk init -g below writes into it (as app) and fails if it is missing. Not
11+ # recursive: only the copies below are chowned, never anything bind-mounted in.
12+ mkdir -p /home/app/.claude
13+ chown app:app /home/app/.claude
714
815# copy only essential claude files (not the entire 2GB directory)
916if [ -d /mnt/claude ]; then
10- mkdir -p /home/app/.claude
1117 # copy config files only (not cache, history, debug, todos, etc.)
1218 for f in .credentials.json settings.json settings.local.json CLAUDE.md format.sh; do
1319 [ -e " /mnt/claude/$f " ] && cp -L " /mnt/claude/$f " " /home/app/.claude/$f " 2> /dev/null || true
@@ -27,19 +33,14 @@ if [ -d /mnt/claude ]; then
2733 fi
2834
2935 chown -R app:app /home/app/.claude
36+ fi
3037
31- # ── RTK: ensure rewrite hook is configured ─────────────────────────────
32- # The host mount usually brings the hook; re-init idempotently in case the
33- # mounted ~/.claude carries none. --hook-only avoids workspace artifacts.
34- # Scope: this sits inside the /mnt/claude guard, so a container started
35- # without the host mount gets no rtk hook and rtk stays inert.
36- # RTK_TELEMETRY_DISABLED=1 is the supported opt-out, not a workaround:
37- # since rtk-ai/rtk#2477 (v0.44.0+) it short-circuits the telemetry consent
38- # prompt that would otherwise block on stdin here. timeout stays as a
39- # backstop against a future init-time hang.
40- if command -v rtk > /dev/null 2>&1 ; then
41- RTK_TELEMETRY_DISABLED=1 gosu app timeout 10 rtk init -g --hook-only --auto-patch 2> /dev/null || true
42- fi
38+ # ── Local: RTK rewrite hook, with or without the host mount (#128) ──────────
39+ # Idempotent; --hook-only avoids workspace artifacts. Telemetry prompt:
40+ # RTK_TELEMETRY_DISABLED=1 opts out (rtk-ai/rtk#2477), closed stdin stops it
41+ # blocking, and timeout backstops any other hang.
42+ if command -v rtk > /dev/null 2>&1 ; then
43+ RTK_TELEMETRY_DISABLED=1 gosu app timeout 10 rtk init -g --hook-only --auto-patch < /dev/null 2> /dev/null || true
4344fi
4445
4546# copy credentials extracted from macOS keychain (mounted separately)
0 commit comments