diff --git a/net/travelmate/Makefile b/net/travelmate/Makefile index 8df09db7d..9b3048080 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 d02fffba9..53c62218d 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 90b8071e8..f17aa1a9e 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 78bc5df8b..3e277def7 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