ugps: Add option disabled
authorBruno Randolf <br1@einfach.org>
Thu, 23 Aug 2018 20:59:58 +0000 (21:59 +0100)
committerJohn Crispin <john@phrozen.org>
Wed, 29 Aug 2018 06:31:10 +0000 (08:31 +0200)
Like many other packages, an option to disable can be practical.

Signed-off-by: Bruno Randolf <br1@einfach.org>
package/utils/ugps/files/gps.config
package/utils/ugps/files/ugps.init

index d4bd69afff3386dadb83d48f1a461fcaab77bc4d..01559f7a9c90e733e386b4c23a832991518f803e 100644 (file)
@@ -1,3 +1,4 @@
 config gps
        option  'tty'   'ttyACM0'
        option  'adjust_time'   '1'
+       option  'disabled'      '1'
index 157043cc283ee1be77a0f6393e02baf89b64bd3b..3cd1ca1b8d2da7960ded8e4c3c2a222705350d08 100644 (file)
@@ -13,6 +13,9 @@ service_triggers() {
 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"