travelmate: maintenance update 0.7.4 4366/head
authorDirk Brenken <dev@brenken.org>
Wed, 17 May 2017 19:24:07 +0000 (21:24 +0200)
committerDirk Brenken <dev@brenken.org>
Wed, 17 May 2017 19:24:07 +0000 (21:24 +0200)
* 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 <dev@brenken.org>
net/travelmate/Makefile
net/travelmate/files/travelmate.init
net/travelmate/files/travelmate.sh

index 67b49d0918162268ec0108a3deb150f954222a4d..fd7d2b85cc862ba8a236eedd7bee9ae8bbeca485 100644 (file)
@@ -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 <dev@brenken.org>
index 4d1ecc8696be0adc8eb5b638b67fc05495979137..aac132969b248973f5d32a770bb18de9908c566f 100755 (executable)
@@ -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
 }
 
index f176226880c1667bd0664da73b2674e7b0e10d95..01da61703194082ac68aafe13fcb225fad607b7a 100755 (executable)
@@ -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