ugps.init 479 B

123456789101112131415161718192021222324
  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. [ -d "/sys/class/tty/$tty/" ] || return
  13. procd_open_instance
  14. procd_set_param command "$PROG" "/dev/$tty"
  15. [ "$atime" -eq 0 ] || procd_append_param command "-a"
  16. procd_set_param respawn
  17. procd_close_instance
  18. }