1
0
mirror of https://git.openwrt.org/feed/packages.git synced 2024-06-25 00:57:48 +02:00

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 <dev@brenken.org>
This commit is contained in:
Dirk Brenken 2017-05-17 21:24:07 +02:00
parent b059c59d86
commit bf6636517a
3 changed files with 12 additions and 11 deletions

View 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>

View File

@ -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
}

View File

@ -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