| 1 | #!/sbin/openrc-run |
| 2 | |
| 3 | name="Music Player Daemon" |
| 4 | description="A daemon for playing music" |
| 5 | |
| 6 | # M_USER and M_GROUP is for backward compatibility (Alpine <3.17) |
| 7 | : ${command_user:="${M_USER:-mpd}:${M_GROUP:-audio}"} |
| 8 | |
| 9 | command=/usr/bin/mpd |
| 10 | # MPD_OPTS is for backward compatibility (Alpine <3.17) |
| 11 | command_args="${command_args:-$MPD_OPTS}" |
| 12 | command_args_foreground="--no-daemon" |
| 13 | |
| 14 | # Allow mpd to configure real-time scheduling. |
| 15 | # See https://www.musicpd.org/doc/html/user.html#real-time-scheduling. |
| 16 | # (This is supported since OpenRC 0.45) |
| 17 | capabilities="^cap_sys_nice" |
| 18 | |
| 19 | depend() { |
| 20 | need localmount |
| 21 | use net netmount nfsmount esound pulseaudio |
| 22 | after firewall |
| 23 | } |
| 24 | |
| 25 | start_pre() { |
| 26 | checkpath --directory --quiet \ |
| 27 | --owner "${command_user%:*}" --mode 0775 /run/mpd |
| 28 | } |