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. START=90
  4. USE_PROCD=1
  5. append_arg() {
  6. local cfg="$1"
  7. local var="$2"
  8. local opt="$3"
  9. local def="$4"
  10. local val
  11. config_get val "$cfg" "$var"
  12. [ -n "$val" -o -n "$def" ] && procd_append_param command $opt="${val:-$def}"
  13. }
  14. start_instance() {
  15. local cfg="$1"
  16. local aux
  17. config_get_bool aux "$cfg" 'disabled' '0'
  18. [ "$aux" = 1 ] && return 1
  19. procd_open_instance
  20. procd_set_param command /usr/bin/shairplay
  21. append_arg "$cfg" apname "--apname" "AirPlay"
  22. append_arg "$cfg" port "--server_port"
  23. append_arg "$cfg" password "--password"
  24. append_arg "$cfg" hwaddr "--hwaddr"
  25. append_arg "$cfg" ao_driver "--ao_driver"
  26. append_arg "$cfg" ao_devicename "--ao_devicename"
  27. append_arg "$cfg" ao_deviceid "--ao_deviceid"
  28. config_get_bool aux "$cfg" 'respawn' '0'
  29. [ "$aux" = 1 ] && procd_set_param respawn
  30. procd_close_instance
  31. }
  32. service_triggers() {
  33. procd_add_reload_trigger "shairplay"
  34. }
  35. start_service() {
  36. config_load shairplay
  37. config_foreach start_instance shairplay
  38. }