ugps: fix and improve init script
authorPiotr Dymacz <pepe2k@gmail.com>
Sun, 5 Mar 2017 18:30:44 +0000 (19:30 +0100)
committerPiotr Dymacz <pepe2k@gmail.com>
Sun, 2 Apr 2017 13:09:09 +0000 (15:09 +0200)
The ugps tool expects device path in last argument. If it's provided
before other options, they won't be processed at all.

Additionally, make it possible to use absolute path for gps character
device in related uci configuration.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
package/utils/ugps/Makefile
package/utils/ugps/files/ugps.init

index 9dc33ca9ebfa35c654357fc696e2afe556b92dec..0243b773e07da505477e3a45c0bfae4aa4aecb48 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ugps
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ugps
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE_URL=$(LEDE_GIT)/project/ugps.git
 PKG_SOURCE_PROTO:=git
 
 PKG_SOURCE_URL=$(LEDE_GIT)/project/ugps.git
 PKG_SOURCE_PROTO:=git
index a7a88c225827dc31424d1f729c4700ef0925bdf1..157043cc283ee1be77a0f6393e02baf89b64bd3b 100644 (file)
@@ -14,11 +14,15 @@ start_service() {
        local tty="$(uci get gps.@gps[-1].tty)"
        local atime="$(uci get gps.@gps[-1].adjust_time)"
 
        local tty="$(uci get gps.@gps[-1].tty)"
        local atime="$(uci get gps.@gps[-1].adjust_time)"
 
-       [ -d "/sys/class/tty/$tty/" ] || return
+       [ -c "$tty" ] || {
+               tty="/dev/$tty"
+               [ -c "$tty" ] || return
+       }
 
        procd_open_instance
 
        procd_open_instance
-       procd_set_param command "$PROG" "/dev/$tty"
+       procd_set_param command "$PROG"
        [ "$atime" -eq 0 ] || procd_append_param command "-a"
        [ "$atime" -eq 0 ] || procd_append_param command "-a"
+       procd_append_param command "$tty"
        procd_set_param respawn
        procd_close_instance
 }
        procd_set_param respawn
        procd_close_instance
 }