You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
883 B

  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2007-2014 OpenWrt.org
  3. START=93
  4. USE_PROCD=1
  5. PROG=/usr/bin/mpd
  6. CONFIGFILE=/etc/mpd.conf
  7. NICEPRIO=-10
  8. USER="mpd"
  9. GROUP="mpd"
  10. #TODO: Add uci config - nice, config
  11. start_service() {
  12. local pld lport
  13. #create mpd directories from config
  14. pld=$(grep ^playlist_directory "$CONFIGFILE" | cut -d "\"" -f 2 | sed "s/~/\/root/g")
  15. if [ ! -d "$pld" ]; then
  16. mkdir -m 0755 -p "$pld"
  17. chown $USER:$GROUP $pld
  18. fi
  19. lport=$(grep ^port "$CONFIGFILE" | cut -d "\"" -f 2)
  20. [ -z "$lport" ] && lport=6600
  21. procd_open_instance
  22. procd_add_mdns "mpd" "tcp" "$lport"
  23. procd_set_param command "$PROG" --no-daemon "$CONFIGFILE"
  24. procd_set_param user "$USER"
  25. procd_set_param group "$GROUP"
  26. procd_set_param stderr 1
  27. # Give MPD some real-time priority
  28. procd_set_param nice "$NICEPRIO"
  29. procd_close_instance
  30. }
  31. reload_service() {
  32. procd_send_signal "$PROG"
  33. }