From fa42066a6ebefb9e6afb0406112296115948aa93 Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Sun, 26 Mar 2017 07:41:04 +0200 Subject: [PATCH] travelmate: update 0.5.0 * fix stop action in "active" mode * fix race condition in "active" mode Signed-off-by: Dirk Brenken --- net/travelmate/Makefile | 2 +- net/travelmate/files/travelmate.conf | 1 + net/travelmate/files/travelmate.init | 21 +++++++++++---------- net/travelmate/files/travelmate.sh | 9 ++++++--- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/net/travelmate/Makefile b/net/travelmate/Makefile index 8df09db7d3..9b3048080e 100644 --- a/net/travelmate/Makefile +++ b/net/travelmate/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=travelmate -PKG_VERSION:=0.4.2 +PKG_VERSION:=0.5.0 PKG_RELEASE:=1 PKG_LICENSE:=GPL-3.0+ PKG_MAINTAINER:=Dirk Brenken diff --git a/net/travelmate/files/travelmate.conf b/net/travelmate/files/travelmate.conf index d02fffba9a..53c62218d4 100644 --- a/net/travelmate/files/travelmate.conf +++ b/net/travelmate/files/travelmate.conf @@ -4,6 +4,7 @@ config travelmate 'global' option trm_enabled '0' option trm_debug '0' + option trm_iface 'wan wwan' option trm_active '0' option trm_maxwait '30' option trm_maxretry '3' diff --git a/net/travelmate/files/travelmate.init b/net/travelmate/files/travelmate.init index 90b8071e81..f17aa1a9e8 100755 --- a/net/travelmate/files/travelmate.init +++ b/net/travelmate/files/travelmate.init @@ -3,6 +3,7 @@ START=85 USE_PROCD=1 +trm_init="/etc/init.d/travelmate" trm_script="/usr/bin/travelmate.sh" boot() @@ -23,18 +24,18 @@ start_service() fi } +stop_service() +{ + killall -q -TERM "travelmate.sh" +} + service_triggers() { local iface="$(uci -q get travelmate.global.trm_iface)" - if [ -z "${iface}" ] - then - procd_add_raw_trigger "interface.*.down" 1000 /etc/init.d/travelmate start - else - for name in ${iface} - do - procd_add_interface_trigger "interface.*.down" "${name}" /etc/init.d/travelmate start - done - fi - procd_add_config_trigger "config.change" "travelmate" /etc/init.d/travelmate start + for name in ${iface} + do + procd_add_interface_trigger "interface.*.down" "${name}" "${trm_init}" start + done + procd_add_config_trigger "config.change" "travelmate" "${trm_init}" start } diff --git a/net/travelmate/files/travelmate.sh b/net/travelmate/files/travelmate.sh index 78bc5df8b8..3e277def75 100755 --- a/net/travelmate/files/travelmate.sh +++ b/net/travelmate/files/travelmate.sh @@ -10,7 +10,7 @@ # LC_ALL=C PATH="/usr/sbin:/usr/bin:/sbin:/bin" -trm_ver="0.4.2" +trm_ver="0.5.0" trm_sysver="$(ubus -S call system board | jsonfilter -e '@.release.description')" trm_enabled=1 trm_debug=0 @@ -233,6 +233,9 @@ f_main() } f_envload -f_main -f_active +if [ ${trm_active} -eq 0 ] || ([ ${trm_active} -eq 1 ] && [ $(pgrep -f "/usr/bin/travelmate.sh" | wc -l) -eq 3 ]) +then + f_main + f_active +fi exit 0 -- 2.30.2