mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 23:12:32 +00:00
6b14a73f4f
Like many other packages, an option to disable can be practical. Signed-off-by: Bruno Randolf <br1@einfach.org>
32 lines
624 B
Bash
32 lines
624 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
|
|
|
|
[ -c "$tty" ] || {
|
|
tty="/dev/$tty"
|
|
[ -c "$tty" ] || return
|
|
}
|
|
|
|
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
|
|
}
|