[PATCH] ugps: start also in case device is absent

Daniel Golle daniel at makrotopia.org
Thu May 27 03:37:41 PDT 2021


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 at makrotopia.org>
---
 package/utils/ugps/Makefile        |  2 +-
 package/utils/ugps/files/ugps.init | 12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/package/utils/ugps/Makefile b/package/utils/ugps/Makefile
index 4ce64d9631..16cdbc41b9 100644
--- a/package/utils/ugps/Makefile
+++ b/package/utils/ugps/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ugps
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/ugps.git
 PKG_SOURCE_PROTO:=git
diff --git a/package/utils/ugps/files/ugps.init b/package/utils/ugps/files/ugps.init
index 3cd1ca1b8d..f52b19cc27 100644
--- a/package/utils/ugps/files/ugps.init
+++ b/package/utils/ugps/files/ugps.init
@@ -17,10 +17,14 @@ start_service() {
 
 	[ "$disabled" == "0" ] || 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"
-- 
2.31.1




More information about the openwrt-devel mailing list