From bf6636517a917f3386a429b9dd5cf1590165926c Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Wed, 17 May 2017 21:24:07 +0200 Subject: [PATCH] travelmate: maintenance update 0.7.4 * always update the connection status, even in case of an error * merge multiple ubus network calls in central check routine Signed-off-by: Dirk Brenken --- net/travelmate/Makefile | 2 +- net/travelmate/files/travelmate.init | 5 +---- net/travelmate/files/travelmate.sh | 16 ++++++++++------ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/net/travelmate/Makefile b/net/travelmate/Makefile index 67b49d0918..fd7d2b85cc 100644 --- a/net/travelmate/Makefile +++ b/net/travelmate/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=travelmate -PKG_VERSION:=0.7.3 +PKG_VERSION:=0.7.4 PKG_RELEASE:=1 PKG_LICENSE:=GPL-3.0+ PKG_MAINTAINER:=Dirk Brenken diff --git a/net/travelmate/files/travelmate.init b/net/travelmate/files/travelmate.init index 4d1ecc8696..aac132969b 100755 --- a/net/travelmate/files/travelmate.init +++ b/net/travelmate/files/travelmate.init @@ -32,10 +32,7 @@ stop_service() local rtfile="$(uci -q get travelmate.global.trm_rtfile)" rtfile="${rtfile:="/tmp/trm_runtime.json"}" - if [ -s "${rtfile}" ] - then - > "${rtfile}" - fi + > "${rtfile}" rc_procd start_service } diff --git a/net/travelmate/files/travelmate.sh b/net/travelmate/files/travelmate.sh index f176226880..01da617031 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.7.3" +trm_ver="0.7.4" trm_sysver="$(ubus -S call system board | jsonfilter -e '@.release.description')" trm_enabled=0 trm_debug=0 @@ -19,9 +19,10 @@ trm_maxretry=3 trm_maxwait=30 trm_timeout=60 trm_iw="$(command -v iw)" +trm_radio="" trm_rtfile="/tmp/trm_runtime.json" -# source required system library +# source required system libraries # if [ -r "/lib/functions.sh" ] && [ -r "/usr/share/libubox/jshn.sh" ] then @@ -94,8 +95,9 @@ f_prepare() f_check() { local ifname radio status cnt=1 mode="${1}" - trm_ifstatus="false" + ubus call network reload + trm_ifstatus="false" while [ ${cnt} -le ${trm_maxwait} ] do status="$(ubus -S call network.wireless status 2>/dev/null)" @@ -200,12 +202,12 @@ f_main() f_check "initial" if [ "${trm_ifstatus}" != "true" ] then + > "${trm_rtfile}" config_load wireless config_foreach f_prepare wifi-iface if [ -n "$(uci -q changes wireless)" ] then uci -q commit wireless - ubus call network restart fi f_check "ap" f_log "debug" "ap-list: ${trm_aplist}, sta-list: ${trm_stalist}" @@ -234,7 +236,6 @@ f_main() if [ -n "$(printf "%s" "${ssid_list}" | grep -Fo "\"${sta_ssid}\"")" ] && [ "${ap_radio}" = "${sta_radio}" ] then uci -q set wireless."${config}".disabled=0 - ubus call network reload f_check "sta" if [ "${trm_ifstatus}" = "true" ] then @@ -244,7 +245,6 @@ f_main() return 0 else uci -q revert wireless - ubus call network reload f_log "info " "interface '${sta_iface}' on '${sta_radio}' can't connect to uplink '${sta_ssid}' (${trm_sysver})" f_jsnupdate "${sta_iface}" "${sta_radio}" "${sta_ssid}" fi @@ -255,6 +255,10 @@ f_main() sleep 5 done done + if [ ! -s "${trm_rtfile}" ] + then + f_jsnupdate "n/a" "n/a" "n/a" + fi else if [ ! -s "${trm_rtfile}" ] then -- 2.30.2