ugps: Add option disabled

Like many other packages, an option to disable can be practical.

Signed-off-by: Bruno Randolf <br1@einfach.org>
This commit is contained in:
Bruno Randolf 2018-08-23 21:59:58 +01:00 committed by John Crispin
parent 01793e8752
commit 6b14a73f4f
2 changed files with 4 additions and 0 deletions

View file

@ -1,3 +1,4 @@
config gps config gps
option 'tty' 'ttyACM0' option 'tty' 'ttyACM0'
option 'adjust_time' '1' option 'adjust_time' '1'
option 'disabled' '1'

View file

@ -13,6 +13,9 @@ service_triggers() {
start_service() { start_service() {
local tty="$(uci get gps.@gps[-1].tty)" local tty="$(uci get gps.@gps[-1].tty)"
local atime="$(uci get gps.@gps[-1].adjust_time)" local atime="$(uci get gps.@gps[-1].adjust_time)"
local disabled="$(uci get gps.@gps[-1].disabled || echo 0)"
[ "$disabled" == "0" ] || return
[ -c "$tty" ] || { [ -c "$tty" ] || {
tty="/dev/$tty" tty="/dev/$tty"