From 48f48991c31e23bd663037bcfb168e043984ef7a Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Sat, 9 Dec 2017 08:20:29 +0100 Subject: [PATCH] travelmate: update 0.9.6 * fix incomplete bssid logic * add missing package dependencies * Turris omnia compability fixes (LuCI, separate PR) * OpenWrt theme fixes (LuCI, separate PR) Signed-off-by: Dirk Brenken --- net/travelmate/Makefile | 4 ++-- net/travelmate/files/travelmate.sh | 31 ++++++++++++++++++++++++------ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/net/travelmate/Makefile b/net/travelmate/Makefile index 93bde5d5f..dcaa4e9ac 100644 --- a/net/travelmate/Makefile +++ b/net/travelmate/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=travelmate -PKG_VERSION:=0.9.5 +PKG_VERSION:=0.9.6 PKG_RELEASE:=1 PKG_LICENSE:=GPL-3.0+ PKG_MAINTAINER:=Dirk Brenken @@ -17,7 +17,7 @@ define Package/travelmate SECTION:=net CATEGORY:=Network TITLE:=A wlan connection manager for travel router - DEPENDS:=+iwinfo + DEPENDS:=+iwinfo +jshn +jsonfilter PKGARCH:=all endef diff --git a/net/travelmate/files/travelmate.sh b/net/travelmate/files/travelmate.sh index ae9573c77..d4daa770e 100755 --- a/net/travelmate/files/travelmate.sh +++ b/net/travelmate/files/travelmate.sh @@ -10,8 +10,8 @@ # LC_ALL=C PATH="/usr/sbin:/usr/bin:/sbin:/bin" -trm_ver="0.9.5" -trm_sysver="$(ubus -S call system board | jsonfilter -e '@.release.description')" +trm_ver="0.9.6" +trm_sysver="unknown" trm_enabled=0 trm_debug=0 trm_automatic=1 @@ -26,6 +26,23 @@ trm_rtfile="/tmp/trm_runtime.json" # f_envload() { + local sys_call sys_desc sys_model sys_ver + + # get system information + # + sys_call="$(ubus -S call system board 2>/dev/null)" + if [ -n "${sys_call}" ] + then + sys_desc="$(printf '%s' "${sys_call}" | jsonfilter -e '@.release.description')" + sys_model="$(printf '%s' "${sys_call}" | jsonfilter -e '@.model')" + sys_ver="$(cat /etc/turris-version 2>/dev/null)" + if [ -n "${sys_ver}" ] + then + sys_desc="${sys_desc}/${sys_ver}" + fi + trm_sysver="${sys_model}, ${sys_desc}" + fi + # initialize lists # trm_devlist="" @@ -123,7 +140,7 @@ f_check() # f_jsnupdate() { - local iface="${1}" radio="${2}" essid="${3:-"n/a"}" bssid="${4:-"n/a"}" + local iface="${1}" radio="${2}" essid="${3:-"-"}" bssid="${4:-"-"}" json_init json_add_object "data" @@ -216,8 +233,10 @@ f_main() sta_essid="$(uci -q get wireless."${config}".ssid)" sta_bssid="$(uci -q get wireless."${config}".bssid)" sta_iface="$(uci -q get wireless."${config}".network)" - if ([ -n "$(printf "%s" "${essid_list}" | grep -Fo "\"${sta_essid}\"")" ] ||\ - [ -n "$(printf "%s" "${bssid_list}" | grep -Fo "${sta_bssid}")" ]) && [ "${dev}" = "${sta_radio}" ] + if (([ -n "$(printf "%s" "${essid_list}" | grep -Fo "\"${sta_essid}\"")" ] && [ -z "${sta_bssid}" ]) || \ + ([ -n "$(printf "%s" "${bssid_list}" | grep -Fo "${sta_bssid}")" ] && [ -z "$(printf "%s" "${essid_list}" | grep -Fo "\"${sta_essid}\"")" ]) || \ + ([ -n "$(printf "%s" "${essid_list}" | grep -Fo "\"${sta_essid}\"")" ] && [ -n "$(printf "%s" "${bssid_list}" | grep -Fo "${sta_bssid}")" ])) && \ + [ "${dev}" = "${sta_radio}" ] then uci -q set wireless."${config}".disabled=0 f_check "sta" @@ -261,7 +280,7 @@ f_main() if [ ! -s "${trm_rtfile}" ] then trm_ifstatus="false" - f_jsnupdate "n/a" "n/a" "n/a" "n/a" + f_jsnupdate "n/a" "n/a" fi else if [ ! -s "${trm_rtfile}" ]