2014-08-01 09:37:49 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
# Copyright (c) 2014 OpenWrt.org
|
|
|
|
|
|
|
|
START=80
|
|
|
|
|
|
|
|
USE_PROCD=1
|
|
|
|
PROG=/usr/sbin/ugps
|
|
|
|
|
|
|
|
service_triggers() {
|
|
|
|
procd_add_reload_trigger gps
|
|
|
|
}
|
|
|
|
|
|
|
|
start_service() {
|
|
|
|
local tty="$(uci get gps.@gps[-1].tty)"
|
2016-10-22 20:13:06 +00:00
|
|
|
local atime="$(uci get gps.@gps[-1].adjust_time)"
|
2014-08-01 09:37:49 +00:00
|
|
|
|
2017-03-05 18:30:44 +00:00
|
|
|
[ -c "$tty" ] || {
|
|
|
|
tty="/dev/$tty"
|
|
|
|
[ -c "$tty" ] || return
|
|
|
|
}
|
2014-08-01 09:37:49 +00:00
|
|
|
|
|
|
|
procd_open_instance
|
2017-03-05 18:30:44 +00:00
|
|
|
procd_set_param command "$PROG"
|
2016-10-22 20:13:06 +00:00
|
|
|
[ "$atime" -eq 0 ] || procd_append_param command "-a"
|
2017-03-05 18:30:44 +00:00
|
|
|
procd_append_param command "$tty"
|
2014-08-01 09:37:49 +00:00
|
|
|
procd_set_param respawn
|
|
|
|
procd_close_instance
|
|
|
|
}
|