Merge pull request #8302 from dibdot/travelmate

travelmate: release 1.4.0
This commit is contained in:
Dirk Brenken 2019-02-27 15:28:22 +01:00 committed by GitHub
commit 37e170aba6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 20 deletions

View file

@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=travelmate PKG_NAME:=travelmate
PKG_VERSION:=1.3.7 PKG_VERSION:=1.4.0
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0+ PKG_LICENSE:=GPL-3.0+
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org> PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>

View file

@ -10,7 +10,7 @@
# #
LC_ALL=C LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin" PATH="/usr/sbin:/usr/bin:/sbin:/bin"
trm_ver="1.3.7" trm_ver="1.4.0"
trm_sysver="unknown" trm_sysver="unknown"
trm_enabled=0 trm_enabled=0
trm_debug=0 trm_debug=0
@ -145,17 +145,12 @@ f_prep()
# #
f_check() f_check()
{ {
local IFS ifname radio dev_status config sta_essid sta_bssid result cp_domain wait=1 mode="${1}" status="${2:-"false"}" local IFS ifname radio dev_status last_status config sta_essid sta_bssid result cp_domain wait=1 mode="${1}" status="${2:-"false"}"
trm_ifquality=0 trm_ifquality=0
if [ "${mode}" = "initial" ] if [ "${mode}" != "initial" ] && [ "${status}" = "false" ]
then then
trm_ifstatus="false" ubus call network reload
else
if [ "${status}" = "false" ]
then
ubus call network reload
fi
fi fi
while [ ${wait} -le ${trm_maxwait} ] while [ ${wait} -le ${trm_maxwait} ]
do do
@ -197,7 +192,7 @@ f_check()
if [ ${trm_ifquality} -ge ${trm_minquality} ] if [ ${trm_ifquality} -ge ${trm_minquality} ]
then then
trm_ifstatus="$(ubus -S call network.interface dump 2>/dev/null | jsonfilter -l1 -e "@.interface[@.device=\"${ifname}\"].up")" trm_ifstatus="$(ubus -S call network.interface dump 2>/dev/null | jsonfilter -l1 -e "@.interface[@.device=\"${ifname}\"].up")"
elif [ "${mode}" = "initial" ] && [ ${trm_ifquality} -lt ${trm_minquality} ] elif [ "${mode}" = "initial" ] && [ ${trm_ifquality} -lt ${trm_minquality} ] && [ "${trm_ifstatus}" != "${status}" ]
then then
trm_ifstatus="${status}" trm_ifstatus="${status}"
sta_essid="$(printf "%s" "${dev_status}" | jsonfilter -l1 -e '@.*.interfaces[@.config.mode="sta"].*.ssid')" sta_essid="$(printf "%s" "${dev_status}" | jsonfilter -l1 -e '@.*.interfaces[@.config.mode="sta"].*.ssid')"
@ -208,16 +203,17 @@ f_check()
fi fi
if [ "${mode}" = "initial" ] || [ "${trm_ifstatus}" = "true" ] if [ "${mode}" = "initial" ] || [ "${trm_ifstatus}" = "true" ]
then then
if ([ "${trm_ifstatus}" != "true" ] && [ "${trm_ifstatus}" != "${status}" ]) || \ json_get_var last_status "travelmate_status"
if ([ "${trm_ifstatus}" = "false" ] && [ "${trm_ifstatus}" != "${status}" ]) || \
([ "${trm_ifstatus}" = "true" ] && [ "${mode}" = "sta" ] && [ -n "${trm_active_sta}" ]) || \ ([ "${trm_ifstatus}" = "true" ] && [ "${mode}" = "sta" ] && [ -n "${trm_active_sta}" ]) || \
[ ${trm_ifquality} -lt ${trm_minquality} ] [ -z "${last_status}" ] || [ "${last_status}" = "running / not connected" ] || [ ${trm_ifquality} -lt ${trm_minquality} ]
then then
f_jsnup f_jsnup
fi fi
if [ "${mode}" = "initial" ] && [ ${trm_captive} -eq 1 ] && [ "${trm_ifstatus}" = "true" ] if [ "${mode}" = "initial" ] && [ ${trm_captive} -eq 1 ] && [ "${trm_ifstatus}" = "true" ]
then then
result="$(${trm_fetch} --timeout=$(( ${trm_maxwait} / 3 )) "${trm_captiveurl}" -O /dev/null 2>&1 | \ result="$(${trm_fetch} --timeout=$(( ${trm_maxwait} / 3 )) "${trm_captiveurl}" -O /dev/null 2>&1 | \
awk '/^Redirected/{printf "%s" "net cp \047"$NF"\047";exit}/^Download completed/{printf "%s" "net ok";exit}/^Failed|^Connection error/{printf "%s" "net nok";exit}')" awk '/^Failed to redirect|^Redirected/{printf "%s" "net cp \047"$NF"\047";exit}/^Download completed/{printf "%s" "net ok";exit}/^Failed|^Connection error/{printf "%s" "net nok";exit}')"
if [ -n "${result}" ] && ([ -z "${trm_connection}" ] || [ "${result}" != "${trm_connection%/*}" ]) if [ -n "${result}" ] && ([ -z "${trm_connection}" ] || [ "${result}" != "${trm_connection%/*}" ])
then then
cp_domain="$(printf "%s" "${result}" | awk -F "['| ]" '/^net cp/{printf "%s" $4}')" cp_domain="$(printf "%s" "${result}" | awk -F "['| ]" '/^net cp/{printf "%s" $4}')"
@ -411,7 +407,7 @@ f_main()
then then
uci_commit wireless uci_commit wireless
f_log "info" "connected to uplink '${sta_radio}/${sta_essid}/${sta_bssid:-"-"}' (${trm_sysver})" f_log "info" "connected to uplink '${sta_radio}/${sta_essid}/${sta_bssid:-"-"}' (${trm_sysver})"
return 0 return
else else
uci -q revert wireless uci -q revert wireless
f_check "rev" f_check "rev"
@ -436,8 +432,8 @@ f_main()
done done
cnt=$(( cnt + 1 )) cnt=$(( cnt + 1 ))
sleep $(( ${trm_maxwait} / 6 )) sleep $(( ${trm_maxwait} / 6 ))
unset scan_list
done done
unset scan_list
done done
fi fi
} }
@ -469,14 +465,20 @@ while true
do do
if [ -z "${trm_action}" ] if [ -z "${trm_action}" ]
then then
rc=0
while true while true
do do
f_check "initial" if [ ${rc} -eq 0 ]
if [ "${trm_ifstatus}" = "true" ]
then then
sleep ${trm_timeout} 0 f_check "initial"
fi fi
if [ $? -eq 0 ] || [ "${trm_ifstatus}" = "false" ] sleep ${trm_timeout} 0
rc=${?}
if [ ${rc} -ne 0 ]
then
f_check "initial"
fi
if [ ${rc} -eq 0 ] || ([ ${rc} -ne 0 ] && [ "${trm_ifstatus}" = "false" ])
then then
break break
fi fi