|
Lines 1-36
Link Here
|
| 1 |
#!/sbin/openrc-run |
|
|
| 2 |
# Copyright 1999-2016 Gentoo Foundation |
| 3 |
# Distributed under the terms of the GNU General Public License v2 |
| 4 |
|
| 5 |
depend() { |
| 6 |
need localmount |
| 7 |
use net netmount nfsmount alsasound esound pulseaudio |
| 8 |
} |
| 9 |
|
| 10 |
checkconfig() { |
| 11 |
if ! [ -f /etc/mpd.conf ]; then |
| 12 |
eerror "Configuration file /etc/mpd.conf does not exist." |
| 13 |
return 1 |
| 14 |
fi |
| 15 |
|
| 16 |
if ! grep -q '^\s*pid_file' /etc/mpd.conf; then |
| 17 |
eerror "Invalid configuration: pid_file needs to be set." |
| 18 |
return 1 |
| 19 |
fi |
| 20 |
|
| 21 |
return 0 |
| 22 |
} |
| 23 |
|
| 24 |
start() { |
| 25 |
checkconfig || return 1 |
| 26 |
|
| 27 |
ebegin "Starting Music Player Daemon" |
| 28 |
start-stop-daemon --start --quiet --exec /usr/bin/mpd -- /etc/mpd.conf 2>/dev/null |
| 29 |
eend $? |
| 30 |
} |
| 31 |
|
| 32 |
stop() { |
| 33 |
ebegin "Stopping Music Player Daemon" |
| 34 |
/usr/bin/mpd --kill |
| 35 |
eend $? |
| 36 |
} |