mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
travelmate: update 0.7.2
backend: * remove redundant 'iwinfo' support & add 'iw' package dependency * refine stop action & json runtime housekeeping * various small fixes * documentation update frontend (see LuCI repo): * simplify uplink interface setup (just one Click! ;-), now part of the overview tab * cosmetics Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
#
|
||||
LC_ALL=C
|
||||
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
trm_ver="0.7.1"
|
||||
trm_ver="0.7.2"
|
||||
trm_sysver="$(ubus -S call system board | jsonfilter -e '@.release.description')"
|
||||
trm_enabled=0
|
||||
trm_debug=0
|
||||
@@ -18,7 +18,7 @@ trm_automatic=1
|
||||
trm_maxretry=3
|
||||
trm_maxwait=30
|
||||
trm_timeout=60
|
||||
trm_iw=1
|
||||
trm_iw="$(command -v iw)"
|
||||
trm_rtfile="/tmp/trm_runtime.json"
|
||||
|
||||
# source required system library
|
||||
@@ -57,17 +57,11 @@ f_envload()
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# check for preferred wireless tool
|
||||
# check for wireless tool
|
||||
#
|
||||
if [ ${trm_iw} -eq 1 ]
|
||||
if [ -z "${trm_iw}" ]
|
||||
then
|
||||
trm_scanner="$(which iw)"
|
||||
else
|
||||
trm_scanner="$(which iwinfo)"
|
||||
fi
|
||||
if [ -z "${trm_scanner}" ]
|
||||
then
|
||||
f_log "error" "no wireless tool for wlan scanning found, please install 'iw' or 'iwinfo'"
|
||||
f_log "error" "no wireless tool found, please install package 'iw'"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -169,7 +163,7 @@ f_status()
|
||||
json_get_keys keylist
|
||||
for key in ${keylist}
|
||||
do
|
||||
json_get_var value ${key}
|
||||
json_get_var value "${key}"
|
||||
printf " %-18s : %s\n" "${key}" "${value}"
|
||||
done
|
||||
fi
|
||||
@@ -220,21 +214,15 @@ f_main()
|
||||
cnt=1
|
||||
ap_radio="${ap##*_}"
|
||||
ap="${ap%%_*}"
|
||||
if [ -z "$(printf "${trm_stalist}" | grep -Fo "_${ap_radio}")" ]
|
||||
if [ -z "$(printf "%s" "${trm_stalist}" | grep -Fo "_${ap_radio}")" ]
|
||||
then
|
||||
continue
|
||||
fi
|
||||
while [ ${cnt} -le ${trm_maxretry} ]
|
||||
do
|
||||
if [ ${trm_iw} -eq 1 ]
|
||||
then
|
||||
ssid_list="$(${trm_scanner} dev "${ap}" scan 2>/dev/null | \
|
||||
awk '/SSID: /{if(!seen[$0]++){printf "\"";for(i=2; i<=NF; i++)if(i==2)printf $i;else printf " "$i;printf "\" "}}')"
|
||||
else
|
||||
ssid_list="$(${trm_scanner} "${ap}" scan | \
|
||||
awk '/ESSID: ".*"/{ORS=" ";if (!seen[$0]++) for(i=2; i<=NF; i++) print $i}')"
|
||||
fi
|
||||
f_log "debug" "scanner: ${trm_scanner}, ap: ${ap}, ssids: ${ssid_list}"
|
||||
ssid_list="$(${trm_iw} dev "${ap}" scan 2>/dev/null | \
|
||||
awk '/SSID: /{if(!seen[$0]++){printf "\"";for(i=2; i<=NF; i++)if(i==2)printf $i;else printf " "$i;printf "\" "}}')"
|
||||
f_log "debug" "iw: ${trm_iw}, ap: ${ap}, ssids: ${ssid_list}"
|
||||
if [ -n "${ssid_list}" ]
|
||||
then
|
||||
for sta in ${trm_stalist}
|
||||
@@ -243,7 +231,7 @@ f_main()
|
||||
sta_radio="${sta##*_}"
|
||||
sta_ssid="$(uci -q get wireless."${config}".ssid)"
|
||||
sta_iface="$(uci -q get wireless."${config}".network)"
|
||||
if [ -n "$(printf "${ssid_list}" | grep -Fo "\"${sta_ssid}\"")" ] && [ "${ap_radio}" = "${sta_radio}" ]
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user