6c896f5165
Alpine's pipewire-pulse package ships the daemon binary but doesn't auto-load the PA bridge module on alpine. We need to start pipewire-pulse as a separate process with -a tcp:4713 so PA clients (librespot, mopidy) can connect via TCP. Layout: - pipewire: audio server (native protocol) - pipewire-pulse: PA-compat bridge, listens on tcp:4713 + unix:/tmp/pulse-socket - wireplumber: session manager (loads BT modules, hot-plug handling)
46 lines
1.5 KiB
Bash
46 lines
1.5 KiB
Bash
#!/bin/sh
|
|
# audio-bridge entrypoint
|
|
# Starts DBus (system + session), BlueZ, WirePlumber, then PipeWire.
|
|
# PA clients (librespot, mopidy) connect via pipewire-pulse bridge on TCP localhost:4713.
|
|
|
|
set -e
|
|
|
|
mkdir -p /run/dbus /run/user/0
|
|
chmod 0755 /run/dbus
|
|
chmod 0700 /run/user/0
|
|
# Clean up stale pid files from previous container runs (host volume persists).
|
|
rm -f /run/dbus/dbus.pid /run/user/0/dbus.pid
|
|
|
|
# System DBus (needed by bluetoothd, wireplumber)
|
|
dbus-daemon --system --fork
|
|
sleep 0.5
|
|
|
|
# Session DBus (needed by PipeWire for portal/jackdbus-detect modules).
|
|
# Use XDG_RUNTIME_DIR=/run/user/0 so dbus-launch puts socket there.
|
|
export XDG_RUNTIME_DIR=/run/user/0
|
|
dbus-daemon --session --address=unix:path=/run/user/0/bus --fork
|
|
sleep 0.3
|
|
|
|
# BlueZ (Bluetooth stack). --compat = legacy mode for older audio devices.
|
|
# Disabled if no /sys/class/bluetooth — wireplumber will skip BT modules.
|
|
if [ -d /sys/class/bluetooth ]; then
|
|
/usr/lib/bluetooth/bluetoothd --compat --nodetach &
|
|
sleep 0.5
|
|
echo "[audio-bridge] bluetoothd started"
|
|
else
|
|
echo "[audio-bridge] no bluetooth hardware — skipping bluetoothd"
|
|
fi
|
|
|
|
# WirePlumber first (manages PipeWire session/policy, loads BT modules on demand)
|
|
wireplumber &
|
|
sleep 1
|
|
|
|
# PipeWire (audio server). Listens on its own native socket.
|
|
pipewire &
|
|
|
|
# PipeWire-Pulse daemon: PA-compatible bridge. Listen on TCP 4713 so PA clients
|
|
# (librespot, mopidy) can connect from sibling containers without unix socket
|
|
# path coupling.
|
|
sleep 1
|
|
exec pipewire-pulse -a tcp:4713 -a unix:/tmp/pulse-socket
|