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.

51 lines
1.0 KiB

  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2014 OpenWrt.org
  3. NAME=upmpdcli
  4. START=95
  5. UPMPD_BIN=/usr/bin/${NAME}
  6. USE_PROCD=1
  7. append_arg() {
  8. local cfg="$1"
  9. local var="$2"
  10. local opt="$3"
  11. local def="$4"
  12. local val
  13. config_get val "$cfg" "$var"
  14. [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}"
  15. }
  16. start_instance() {
  17. local cfg="$1"
  18. local interface
  19. procd_open_instance
  20. procd_set_param command "${UPMPD_BIN}"
  21. # config_get interface "$cfg" interface
  22. # procd_add_reload_interface_trigger $interface
  23. append_arg "$cfg" interface "-i"
  24. append_arg "$cfg" mpd_host "-h"
  25. append_arg "$cfg" mpd_port "-p"
  26. append_arg "$cfg" upmpd_port "-P"
  27. append_arg "$cfg" config "-c"
  28. append_arg "$cfg" friendly_name "-f"
  29. procd_close_instance
  30. }
  31. service_triggers() {
  32. procd_add_reload_trigger "${NAME}"
  33. }
  34. start_service() {
  35. config_load ${NAME}
  36. config_foreach start_instance ${NAME}
  37. }