Wire mcltspice into the backend image: WineHQ 11.10 (matching the dev host), i386 multiarch, Mesa software GL, a build-time Wine prefix seeded with the LTspice.ini first-run config, and an entrypoint that starts Xvfb. The LTspice install (exe/lib/examples) mounts from the host; the engine reads LTSPICE_DIR. Gated for now: LTspice v26 stalls at graphics init under headless Wine in the slim image (runs fine on a full desktop). The mount + LTSPICE_DIR are commented in docker-compose.prod.yml so the engine fails fast as 'unavailable' rather than hanging. ngspice is unaffected.
35 lines
1.2 KiB
Bash
35 lines
1.2 KiB
Bash
#!/bin/bash
|
|
# Wire the host-mounted LTspice binaries into the writable LTSPICE_DIR (which
|
|
# holds the Wine prefix baked at image build), start a virtual display for
|
|
# Wine, then hand off to the CMD.
|
|
set -e
|
|
|
|
src=/opt/ltspice-src
|
|
dst=${LTSPICE_DIR:-/opt/ltspice}
|
|
|
|
# The LTspice install is mounted read-only from the host; symlink the three
|
|
# things mcltspice's config references (exe, lib, examples) next to the prefix.
|
|
if [ -d "$src" ]; then
|
|
for item in LTspice.exe lib examples; do
|
|
if [ -e "$src/$item" ]; then
|
|
ln -sfn "$src/$item" "$dst/$item"
|
|
fi
|
|
done
|
|
fi
|
|
|
|
# LTspice opens an X connection even in batch (-b) mode, so give Wine a
|
|
# headless display. Clear any stale lock first -- the build-time Xvfb on the
|
|
# same display can leave /tmp/.X99-lock baked into the image, which would make
|
|
# a naive "already running?" check skip startup (one container = one Xvfb).
|
|
if [ -n "$DISPLAY" ]; then
|
|
rm -f "/tmp/.X${DISPLAY#:}-lock"
|
|
Xvfb "$DISPLAY" -screen 0 1024x768x16 -nolisten tcp >/tmp/xvfb.log 2>&1 &
|
|
# Give the server a moment to come up before the app can ask for it.
|
|
for _ in 1 2 3 4 5 6 7 8 9 10; do
|
|
[ -e "/tmp/.X11-unix/X${DISPLAY#:}" ] && break
|
|
sleep 0.3
|
|
done
|
|
fi
|
|
|
|
exec "$@"
|