fix(playout): locate CasparCG 2.5 binary at /usr/bin/casparcg-server-2.5

First 2.5 build got past the deb install but the binary-discovery step
produced an empty $BIN (test -n failed): the 2.5 deb names its executable
casparcg-server-2.5, which the old case pattern (*/casparcg, */CasparCG
Server) didn't match. Broaden the match to /usr/bin/*casparcg*server*, fall
back to the known /usr/bin/casparcg-server-2.5, symlink it to
/usr/local/bin/casparcg, and make /opt/casparcg a real dir for our config
(no longer symlinked onto /usr/bin). Entrypoint launches `casparcg <config>`
from PATH instead of ./casparcg in a cwd.

Still NOT runtime-validated: 2.5 may reject the 2.3-era casparcg.config
schema (a bad config shows up as "Configuration file --version was not
found"); the deb ships a reference config at
/usr/share/casparcg-server-2.5/casparcg.config to diff against at smoke time.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Zac 2026-05-30 15:34:02 +00:00
parent 9436434599
commit 02631f7b96
2 changed files with 20 additions and 18 deletions

View file

@ -40,8 +40,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# ── CasparCG Server 2.5.0 (via .deb) ─────────────────────────────────────────
# apt resolves the server's runtime deps (GL, ffmpeg, openal, sndfile, …). The
# deb's install dir is discovered from its file list and symlinked to
# /opt/casparcg so the entrypoint + config (which run from that dir) stay valid.
# 2.5 deb installs the executable as /usr/bin/casparcg-server-2.5 and a default
# config under /usr/share/casparcg-server-2.5/. We discover the binary from the
# package file list (matching casparcg-server*, since the name is versioned),
# and symlink its dir to /opt/casparcg so the entrypoint + config stay stable.
WORKDIR /tmp/caspar
RUN set -eux; \
curl -fsSL "$CASPAR_CEF_DEB_URL" -o cef.deb; \
@ -52,14 +54,14 @@ RUN set -eux; \
echo "casparcg server package: $PKG"; \
dpkg -L "$PKG"; \
BIN=$(dpkg -L "$PKG" | while read -r f; do \
[ -x "$f" ] || continue; \
case "$f" in */casparcg|*/CasparCG\ Server) echo "$f";; esac; \
[ -f "$f" ] && [ -x "$f" ] || continue; \
case "$f" in /usr/bin/*casparcg*server*|*/casparcg|*/CasparCG\ Server) echo "$f";; esac; \
done | head -1); \
test -n "$BIN"; \
DIR=$(dirname "$BIN"); \
echo "casparcg binary=$BIN dir=$DIR"; \
if [ "$DIR" != "/opt/casparcg" ]; then rm -rf /opt/casparcg; ln -sfn "$DIR" /opt/casparcg; fi; \
test -x "/opt/casparcg/$(basename "$BIN")"; \
[ -n "$BIN" ] || BIN=/usr/bin/casparcg-server-2.5; \
test -x "$BIN"; \
echo "casparcg binary=$BIN"; \
ln -sfn "$BIN" /usr/local/bin/casparcg; \
rm -rf /opt/casparcg; mkdir -p /opt/casparcg; \
cd /; rm -rf /tmp/caspar /var/lib/apt/lists/*
# ── NDI runtime (optional) ───────────────────────────────────────────────────

View file

@ -24,16 +24,16 @@ fi
# into a possibly read-only apt location), so make sure those exist + writable.
mkdir -p /media/casparcg/log /media/casparcg/data /media/templates
# Launch CasparCG Server from its install dir (it reads ./casparcg.config and
# resolves relative media paths against the configured media folder). The deb
# install names the binary either 'casparcg' or 'CasparCG Server' depending on
# version, so probe both.
# Launch CasparCG Server. The 2.5 deb installs the binary on PATH (symlinked to
# /usr/local/bin/casparcg at build) and takes the config file as its first arg.
# Run from /opt/casparcg (symlink to the install dir) so any relative lookups in
# the server resolve against the install tree.
cd /opt/casparcg
CASPAR_BIN="./casparcg"
[ -x "$CASPAR_BIN" ] || CASPAR_BIN="./CasparCG Server"
[ -x "$CASPAR_BIN" ] || CASPAR_BIN="./casparcg-launcher"
echo "[entrypoint] launching CasparCG: $CASPAR_BIN"
"$CASPAR_BIN" &
CASPAR_BIN="casparcg"
command -v "$CASPAR_BIN" >/dev/null || CASPAR_BIN=/usr/bin/casparcg-server-2.5
CASPAR_CFG=/opt/casparcg/casparcg.config
echo "[entrypoint] launching CasparCG: $CASPAR_BIN $CASPAR_CFG"
"$CASPAR_BIN" "$CASPAR_CFG" &
CASPAR_PID=$!
# Forward termination to CasparCG so the channel closes cleanly.