travelmate: refine logical interface selection
authorDirk Brenken <dev@brenken.org>
Fri, 24 Apr 2020 06:28:16 +0000 (08:28 +0200)
committerDirk Brenken <dev@brenken.org>
Fri, 24 Apr 2020 06:28:16 +0000 (08:28 +0200)
Signed-off-by: Dirk Brenken <dev@brenken.org>
net/travelmate/Makefile
net/travelmate/files/travelmate.sh

index 764c2a48261c36e3dde358c335f7e6c7cf7ccead..2c3be78392f7424e84461b394c6fadb98463e2d7 100644 (file)
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=travelmate
 PKG_VERSION:=1.5.4
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_LICENSE:=GPL-3.0-or-later
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
 
index 169e199a3170886c8d4faf392f7a4bda93c7104c..4a5f583bd623415a676aedf332e6794a3cb1c097 100755 (executable)
@@ -1,13 +1,10 @@
 #!/bin/sh
 # travelmate, a wlan connection manager for travel router
-# written by Dirk Brenken (dev@brenken.org)
-
+# Copyright (c) 2016-2020 Dirk Brenken (dev@brenken.org)
 # This is free software, licensed under the GNU General Public License v3.
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
 
-# (s)hellcheck exceptions
-# shellcheck disable=1091 disable=2039 disable=2143 disable=2181 disable=2188
+# set (s)hellcheck exceptions
+# shellcheck disable=1091,2016,2039,2059,2086,2143,2181,2188
 
 # set initial defaults
 #
@@ -572,7 +569,7 @@ f_main()
                                f_log "debug" "f_main    ::: sta_radio: ${sta_radio}, sta_essid: \"${sta_essid}\", sta_bssid: ${sta_bssid:-"-"}"
                                if [ -z "${scan_list}" ]
                                then
-                                       scan_dev="$(ubus -S call network.wireless status 2>/dev/null | jsonfilter -l1 -e "@.${dev}.interfaces.*.ifname")"
+                                       scan_dev="$(ubus -S call network.wireless status 2>/dev/null | jsonfilter -l1 -e "@.${dev}.interfaces[@.config.mode=\"sta\"].ifname")"
                                        scan_list="$("${trm_iwinfo}" "${scan_dev:-${dev}}" scan 2>/dev/null | \
                                                awk 'BEGIN{FS="[[:space:]]"}/Address:/{var1=$NF}/ESSID:/{var2="";for(i=12;i<=NF;i++)if(var2==""){var2=$i}else{var2=var2" "$i};
                                                gsub(/,/,".",var2)}/Quality:/{split($NF,var0,"/")}/Encryption:/{if($NF=="none"){var3="+"}else{var3="-"};printf "%i,%s,%s,%s\n",(var0[1]*100/var0[2]),var1,var2,var3}' | \
@@ -580,7 +577,7 @@ f_main()
                                        f_log "debug" "f_main    ::: scan_radio: ${dev}, scan_device: ${scan_dev:-"-"}, scan_buffer: ${trm_scanbuffer}, scan_list: ${scan_list:-"-"}"
                                        if [ -z "${scan_list}" ]
                                        then
-                                               f_log "debug" "f_main    ::: no scan results on '${dev}' - continue"
+                                               f_log "debug" "f_main    ::: no scan results on '${dev}/${scan_dev:-"-"}' - continue"
                                                continue 2
                                        fi
                                fi