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)"
|
2018-08-23 20:59:58 +00:00
|
|
|
local disabled="$(uci get gps.@gps[-1].disabled || echo 0)"
|
|
|
|
|
|
|
|
[ "$disabled" == "0" ] || return
|
2021-05-27 10:34:38 +00:00
|
|
|
[ "$tty" ] || return
|
2014-08-01 09:37:49 +00:00
|
|
|
|
2021-05-27 10:34:38 +00:00
|
|
|
case "$tty" in
|
|
|
|
"/"*)
|
|
|
|
true
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
tty="/dev/$tty"
|
|
|
|
;;
|
|
|
|
esac
|
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
|
|
|
|
}
|