aboutsummaryrefslogtreecommitdiffstats
path: root/community/mpd/mpd.initd
blob: 2ba56a9cb27b331df93b0e9ab3bbbb8993cf15b6 (plain)
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
#!/sbin/openrc-run

name="Music Player Daemon"
description="A daemon for playing music"

# M_USER and M_GROUP is for backward compatibility (Alpine <3.17)
: ${command_user:="${M_USER:-mpd}:${M_GROUP:-audio}"}

command=/usr/bin/mpd
# MPD_OPTS is for backward compatibility (Alpine <3.17)
command_args="${command_args:-$MPD_OPTS}"
command_args_foreground="--no-daemon"

# Allow mpd to configure real-time scheduling.
# See https://www.musicpd.org/doc/html/user.html#real-time-scheduling.
# (This is supported since OpenRC 0.45)
capabilities="^cap_sys_nice"

depend() {
	need localmount
	use net netmount nfsmount esound pulseaudio
	after firewall
} 

start_pre() {
	checkpath --directory --quiet \
		--owner "${command_user%:*}" --mode 0775 /run/mpd
}