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.

53 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. if [ -n "$val" ] || [ -n "$def" ]; then
  15. procd_append_param command "$opt" "${val:-$def}"
  16. fi
  17. }
  18. start_instance() {
  19. local cfg="$1"
  20. local interface
  21. procd_open_instance
  22. procd_set_param command "${UPMPD_BIN}"
  23. # config_get interface "$cfg" interface
  24. # procd_add_reload_interface_trigger $interface
  25. append_arg "$cfg" interface "-i"
  26. append_arg "$cfg" mpd_host "-h"
  27. append_arg "$cfg" mpd_port "-p"
  28. append_arg "$cfg" upmpd_port "-P"
  29. append_arg "$cfg" config "-c"
  30. append_arg "$cfg" friendly_name "-f"
  31. procd_close_instance
  32. }
  33. service_triggers() {
  34. procd_add_reload_trigger "${NAME}"
  35. }
  36. start_service() {
  37. config_load ${NAME}
  38. config_foreach start_instance ${NAME}
  39. }