spacepaste

  1.  
  2. #!/sbin/openrc-run
  3. # Copyright 1999-2014 Gentoo Foundation
  4. # Distributed under the terms of the GNU General Public License v2
  5. # $Id$
  6. depend() {
  7. need localmount
  8. use net netmount nfsmount alsasound esound pulseaudio
  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. if ! grep -q ^pid_file /etc/mpd.conf; then
  16. eerror "Invalid configuration: pid_file needs to be set."
  17. return 1
  18. fi
  19. return 0
  20. }
  21. start() {
  22. checkconfig || return 1
  23. ebegin "Starting Music Player Daemon"
  24. start-stop-daemon --start --quiet --exec /usr/bin/mpd -- /etc/mpd.conf 2>/dev/null
  25. eend $?
  26. }
  27. stop() {
  28. ebegin "Stopping Music Player Daemon"
  29. /usr/bin/mpd --kill
  30. eend $?
  31. }
  32.