Skip to content

Commit 53bea53

Browse files
committed
Refactor AirPlay receiver entrypoint for improved command structure and readability
1 parent 7427109 commit 53bea53

1 file changed

Lines changed: 29 additions & 45 deletions

File tree

docker-compose.yml

Lines changed: 29 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -63,51 +63,35 @@ 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-
entrypoint: ["/bin/sh"]
67-
command:
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+
entrypoint: ["/bin/sh", "-c"]
67+
command: >
68+
set -e;
69+
echo "=== Bypassing s6 init and starting manually ===";
70+
echo "Using AirPlay name: $$AIRPLAY_NAME";
71+
echo "Hostname: $$(hostname)";
72+
pkill -f s6 || true;
73+
cp /tmp/shairport-sync-template.conf /etc/shairport-sync.conf;
74+
sed -i "s/AIRPLAY_NAME_PLACEHOLDER/$$AIRPLAY_NAME/g" /etc/shairport-sync.conf;
75+
echo "=== Config file generated ===";
76+
cat /etc/shairport-sync.conf;
77+
echo "";
78+
echo "=== Starting required services manually ===";
79+
echo "Starting D-Bus...";
80+
mkdir -p /var/run/dbus;
81+
dbus-daemon --system --fork --print-pid > /var/run/dbus.pid || true;
82+
sleep 2;
83+
echo "Starting Avahi daemon...";
84+
avahi-daemon --daemonize --no-drop-root || true;
85+
sleep 3;
86+
echo "";
87+
echo "=== Audio setup debugging ===";
88+
echo "PULSE_SERVER: $$PULSE_SERVER";
89+
echo "PULSE_RUNTIME_PATH: $$PULSE_RUNTIME_PATH";
90+
ls -la /run/user/1000/pulse/ || echo "PulseAudio socket not found";
91+
which pactl && pactl info || echo "PulseAudio not accessible, will fall back to ALSA";
92+
echo "";
93+
echo "=== Starting shairport-sync ===";
94+
exec /usr/local/bin/shairport-sync -c /etc/shairport-sync.conf -v
11195
depends_on:
11296
- homespeaker.server2
11397

0 commit comments

Comments
 (0)