ugps.init 528 B

12345678910111213141516171819202122232425262728
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (c) 2014 OpenWrt.org
  3. START=80
  4. USE_PROCD=1
  5. PROG=/usr/sbin/ugps
  6. service_triggers() {
  7. procd_add_reload_trigger gps
  8. }
  9. start_service() {
  10. local tty="$(uci get gps.@gps[-1].tty)"
  11. local atime="$(uci get gps.@gps[-1].adjust_time)"
  12. [ -c "$tty" ] || {
  13. tty="/dev/$tty"
  14. [ -c "$tty" ] || return
  15. }
  16. procd_open_instance
  17. procd_set_param command "$PROG"
  18. [ "$atime" -eq 0 ] || procd_append_param command "-a"
  19. procd_append_param command "$tty"
  20. procd_set_param respawn
  21. procd_close_instance
  22. }