Skip to content

Commit bce65bb

Browse files
committed
Refactor AirPlay receiver command for improved readability and execution flow
1 parent 3b7c5ad commit bce65bb

1 file changed

Lines changed: 1 addition & 45 deletions

File tree

docker-compose.yml

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -63,51 +63,7 @@ services:
6363
- PULSE_SERVER=unix:/run/user/1000/pulse/native
6464
- PULSE_RUNTIME_PATH=/run/user/1000/pulse
6565
- AIRPLAY_NAME=${AIRPLAY_NAME:-HomeSpeaker}
66-
command:
67-
- /bin/sh
68-
- -c
69-
- |
70-
set -e
71-
echo "=== Bypassing s6 init and starting manually ==="
72-
echo "Using AirPlay name: $${AIRPLAY_NAME}"
73-
echo "Hostname: $(hostname)"
74-
75-
# Kill any existing s6 processes to ensure clean start
76-
pkill -f s6 || true
77-
78-
# Copy template and replace placeholder with actual name
79-
cp /tmp/shairport-sync-template.conf /etc/shairport-sync.conf
80-
sed -i "s/AIRPLAY_NAME_PLACEHOLDER/$${AIRPLAY_NAME}/g" /etc/shairport-sync.conf
81-
82-
echo "=== Config file generated ==="
83-
cat /etc/shairport-sync.conf
84-
85-
echo ""
86-
echo "=== Starting required services manually ==="
87-
88-
# Start D-Bus system daemon
89-
echo "Starting D-Bus..."
90-
mkdir -p /var/run/dbus
91-
dbus-daemon --system --fork --print-pid > /var/run/dbus.pid || true
92-
sleep 2
93-
94-
# Start Avahi daemon for mDNS
95-
echo "Starting Avahi daemon..."
96-
avahi-daemon --daemonize --no-drop-root || true
97-
sleep 3
98-
99-
echo ""
100-
echo "=== Audio setup debugging ==="
101-
echo "PULSE_SERVER: $${PULSE_SERVER}"
102-
echo "PULSE_RUNTIME_PATH: $${PULSE_RUNTIME_PATH}"
103-
ls -la /run/user/1000/pulse/ || echo "PulseAudio socket not found"
104-
105-
# Test PulseAudio connection
106-
which pactl && pactl info || echo "PulseAudio not accessible, will fall back to ALSA"
107-
108-
echo ""
109-
echo "=== Starting shairport-sync ==="
110-
exec /usr/local/bin/shairport-sync -c /etc/shairport-sync.conf -v
66+
command: ["/bin/sh", "-c", "set -e && echo '=== Bypassing s6 init and starting manually ===' && echo 'Using AirPlay name: $${AIRPLAY_NAME}' && echo 'Hostname: $$(hostname)' && pkill -f s6 || true && cp /tmp/shairport-sync-template.conf /etc/shairport-sync.conf && sed -i 's/AIRPLAY_NAME_PLACEHOLDER/$${AIRPLAY_NAME}/g' /etc/shairport-sync.conf && echo '=== Config file generated ===' && cat /etc/shairport-sync.conf && echo '' && echo '=== Starting required services manually ===' && echo 'Starting D-Bus...' && mkdir -p /var/run/dbus && (dbus-daemon --system --fork --print-pid > /var/run/dbus.pid || true) && sleep 2 && echo 'Starting Avahi daemon...' && (avahi-daemon --daemonize --no-drop-root || true) && sleep 3 && echo '' && echo '=== Audio setup debugging ===' && echo 'PULSE_SERVER: $${PULSE_SERVER}' && echo 'PULSE_RUNTIME_PATH: $${PULSE_RUNTIME_PATH}' && (ls -la /run/user/1000/pulse/ || echo 'PulseAudio socket not found') && (which pactl && pactl info || echo 'PulseAudio not accessible, will fall back to ALSA') && echo '' && echo '=== Starting shairport-sync ===' && exec /usr/local/bin/shairport-sync -c /etc/shairport-sync.conf -v"]
11167
depends_on:
11268
- homespeaker.server2
11369

0 commit comments

Comments
 (0)