mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 22:23:27 +00:00
072d0afb8f
Don't bail out from init script in case the GPS device is missing.
Some modems take time to come up, and some people may use things like
'kplex' to feed ugpsd. Hence it is better to always start ugpsd
unconditionally and let procd's respawn take care of retrying.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
(cherry picked from commit 3d026d2425
)
37 lines
653 B
Bash
37 lines
653 B
Bash
#!/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)"
|
|
local atime="$(uci get gps.@gps[-1].adjust_time)"
|
|
local disabled="$(uci get gps.@gps[-1].disabled || echo 0)"
|
|
|
|
[ "$disabled" == "0" ] || return
|
|
[ "$tty" ] || return
|
|
|
|
case "$tty" in
|
|
"/"*)
|
|
true
|
|
;;
|
|
*)
|
|
tty="/dev/$tty"
|
|
;;
|
|
esac
|
|
|
|
procd_open_instance
|
|
procd_set_param command "$PROG"
|
|
[ "$atime" -eq 0 ] || procd_append_param command "-a"
|
|
procd_append_param command "$tty"
|
|
procd_set_param respawn
|
|
procd_close_instance
|
|
}
|