forked from hifiberry/extension_shairport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare
executable file
·34 lines (28 loc) · 1.1 KB
/
prepare
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
cd `dirname $0`
. /etc/hifiberry.state
if [ ! -f /etc/dbus-1/system.d/shairport-sync.conf ]; then
cat <<EOF >/etc/dbus-1/system.d/shairport-sync.conf
<!-- This configuration file specifies the required security policies
for Bluetooth core daemon to work. -->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
<allow own="org.mpris.MediaPlayer2.ShairportSync"/>
<allow own="org.gnome.ShairportSync"/>
</policy>
<policy user="player">
<allow own="org.mpris.MediaPlayer2.ShairportSync"/>
<allow own="org.gnome.ShairportSync"/>
</policy>
</busconfig>
EOF
systemctl restart dbus
fi
# Create default configuration
if [ ! -f /etc/shairport-sync.conf ]; then
cp /data/extensions/shairport/shairport-sync.conf.default /etc/shairport-sync.conf
fi
# Make sure the use the correct command to pause other players
sed -i 's|\(run_this_before_play_begins = \).*|\1"curl -X POST http://172.17.0.1:81/api/player/stop-all/shairport-sync";|' /etc/shairport-sync.conf