From 90cc95be21bdb296580b19fab7a6c24ac24924a3 Mon Sep 17 00:00:00 2001 From: Chaos Rogers Date: Wed, 22 Oct 2025 13:24:05 +0100 Subject: [PATCH] refactor: switch PTP daemon to linuxptp/ptp4l; remove statime Co-authored-by: aider (openai/gpt-5) --- Dockerfile | 5 +++-- scripts/entrypoint.sh | 15 +++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9ae8f5b..f20b997 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ RUN rm -rf src # Copy full source and build project COPY . . -RUN cargo build --release && cargo install --locked statime +RUN cargo build --release # (Statime installation removed; container runs only haci) @@ -32,12 +32,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ tzdata \ socat \ + linuxptp \ && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY --from=builder /app/target/release/get-haci /usr/local/bin/get-haci -COPY --from=builder /usr/local/cargo/bin/statime /usr/local/bin/statime +# Using linuxptp (ptp4l) provided by apt; no statime binary copied COPY static ./static COPY scripts/entrypoint.sh /usr/local/bin/entrypoint.sh COPY scripts/ltc_gen.sh /usr/local/bin/ltc-gen.sh diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index ba6fdeb..50b30e7 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -28,17 +28,20 @@ if [ "${MOCK_TEENSY:-0}" = "1" ]; then fi fi -# Optionally start the PTP daemon (statime) for development +# Optionally start a PTP daemon for development (prefer statime, fallback to ptp4l) if [ "${RUN_STATIME:-0}" = "1" ]; then - echo "[entrypoint] Starting statime PTP daemon..." >&2 + IFACE="${PTP_INTERFACE:-eth0}" if command -v statime >/dev/null 2>&1; then - IFACE="${PTP_INTERFACE:-eth0}" - echo "[entrypoint] statime interface: ${IFACE}" >&2 - # Run statime in background; logs to container stderr/stdout + echo "[entrypoint] Starting statime on ${IFACE}..." >&2 statime -i "${IFACE}" & STATIME_PID=$! + elif command -v ptp4l >/dev/null 2>&1; then + echo "[entrypoint] Starting ptp4l on ${IFACE}..." >&2 + # -m prints messages to stdout; adjust args as needed for your environment + ptp4l -i "${IFACE}" -m & + PTP4L_PID=$! else - echo "[entrypoint] statime not found on PATH" >&2 + echo "[entrypoint] No PTP daemon found (statime or ptp4l). Skipping." >&2 fi fi