ugps: start also in case device is absent
authorDaniel Golle <daniel@makrotopia.org>
Thu, 27 May 2021 10:34:38 +0000 (12:34 +0200)
committerDaniel Golle <daniel@makrotopia.org>
Tue, 15 Jun 2021 11:16:10 +0000 (12:16 +0100)
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 3d026d24257a0e2f3170538d8a54d520315699a1)

package/utils/ugps/files/ugps.init

index 3cd1ca1b8d2da7960ded8e4c3c2a222705350d08..77c36030667e5493ab64e31d6350bcb1cf383014 100644 (file)
@@ -16,11 +16,16 @@ start_service() {
        local disabled="$(uci get gps.@gps[-1].disabled || echo 0)"
 
        [ "$disabled" == "0" ] || return
+       [ "$tty" ] || return
 
-       [ -c "$tty" ] || {
-               tty="/dev/$tty"
-               [ -c "$tty" ] || return
-       }
+       case "$tty" in
+               "/"*)
+                       true
+                       ;;
+               *)
+                       tty="/dev/$tty"
+                       ;;
+       esac
 
        procd_open_instance
        procd_set_param command "$PROG"