travelmate: update 1.5.2
authorDirk Brenken <dev@brenken.org>
Wed, 6 Nov 2019 20:02:17 +0000 (21:02 +0100)
committerDirk Brenken <dev@brenken.org>
Fri, 8 Nov 2019 18:11:28 +0000 (19:11 +0100)
* print to stdout if 'logger' is not available
* add support to set the service nice level (default is 0)
* small fixes / polish up for forthcoming 19.07 release

Signed-off-by: Dirk Brenken <dev@brenken.org>
(cherry picked from commit 0d406b2a4236501b4aff21ed8dbd40bc191876da)

net/travelmate/Makefile
net/travelmate/files/travelmate.init
net/travelmate/files/travelmate.sh

index 714981305bccdde0a7797ae9b302cda57b001a9e..86a45725a9b63cce6a5c695d493fd5aaed067d84 100644 (file)
@@ -6,7 +6,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=travelmate
-PKG_VERSION:=1.5.1
+PKG_VERSION:=1.5.2
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-3.0-or-later
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
index c78524211a621c51bce76d150f0bd5efc68c83cb..93325559852be3e04c1d65bd821f61fb12276ba2 100755 (executable)
@@ -23,6 +23,7 @@ start_service()
                procd_open_instance "travelmate"
                procd_set_param command "${trm_script}" "${@}"
                procd_set_param pidfile "${trm_pidfile}"
+               procd_set_param nice "$(uci_get travelmate extra trm_nice "0")"
                procd_set_param stdout 1
                procd_set_param stderr 1
                procd_close_instance
index 73effbc0bc07c118c7f6b35f267938500f11cd41..411e135efd66eed030f30a5ddaee1f8f144547bb 100755 (executable)
@@ -13,7 +13,7 @@
 #
 LC_ALL=C
 PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-trm_ver="1.5.1"
+trm_ver="1.5.2"
 trm_enabled=0
 trm_debug=0
 trm_iface="trm_wwan"
@@ -34,6 +34,7 @@ trm_rtfile="/tmp/trm_runtime.json"
 trm_fetch="$(command -v uclient-fetch)"
 trm_iwinfo="$(command -v iwinfo)"
 trm_wpa="$(command -v wpa_supplicant)"
+trm_logger="$(command -v logger)"
 trm_action="${1:-"start"}"
 trm_pidfile="/var/run/travelmate.pid"
 
@@ -100,6 +101,7 @@ f_envload()
        if [ "${trm_enabled}" -ne 1 ]
        then
                f_log "info" "travelmate is currently disabled, please set 'trm_enabled' to '1' to use this service"
+               > "${trm_pidfile}"
                exit 0
        fi
 
@@ -482,12 +484,17 @@ f_log()
 
        if [ -n "${log_msg}" ] && { [ "${class}" != "debug" ] || [ "${trm_debug}" -eq 1 ]; }
        then
-               logger -p "${class}" -t "travelmate-${trm_ver}[${$}]" "${log_msg}"
+               if [ -x "${trm_logger}" ]
+               then
+                       "${trm_logger}" -p "${class}" -t "travelmate-${trm_ver}[${$}]" "${log_msg}"
+               else
+                       printf "%s %s %s\\n" "${class}" "travelmate-${trm_ver}[${$}]" "${log_msg}"
+               fi
                if [ "${class}" = "err" ]
                then
                        trm_ifstatus="error"
                        f_jsnup
-                       logger -p "${class}" -t "travelmate-${trm_ver}[${$}]" "Please check 'https://github.com/openwrt/packages/blob/master/net/travelmate/files/README.md' (${trm_sysver})"
+                       > "${trm_pidfile}"
                        exit 1
                fi
        fi
@@ -705,8 +712,9 @@ do
                done
        elif [ "${trm_action}" = "stop" ]
        then
-               > "${trm_rtfile}"
                f_log "info" "travelmate instance stopped ::: action: ${trm_action}, pid: $(cat ${trm_pidfile} 2>/dev/null)"
+               > "${trm_rtfile}"
+               > "${trm_pidfile}"
                exit 0
        else
                f_log "info" "travelmate instance started ::: action: ${trm_action}, pid: ${$}"