diff --git a/net/travelmate/Makefile b/net/travelmate/Makefile index 73c162541..5361bbc5c 100644 --- a/net/travelmate/Makefile +++ b/net/travelmate/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=travelmate PKG_VERSION:=2.0.9 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=GPL-3.0-or-later PKG_MAINTAINER:=Dirk Brenken diff --git a/net/travelmate/files/travelmate.sh b/net/travelmate/files/travelmate.sh index 17cb27a0d..c1b52fd80 100755 --- a/net/travelmate/files/travelmate.sh +++ b/net/travelmate/files/travelmate.sh @@ -213,10 +213,10 @@ f_vpn() { fi done fi - if [ -x "${trm_vpnpgm}" ] && [ -n "${vpn_service}" ] && [ -n "${vpn_iface}" ] && [ -f "${trm_ntpfile}" ]; then + if [ -x "${trm_vpnpgm}" ] && [ -n "${vpn_service}" ] && [ -n "${vpn_iface}" ]; then if { [ "${vpn_action}" = "disable" ] && [ -f "${trm_vpnfile}" ]; } || - { [ "${vpn}" = "1" ] && [ "${vpn_action%_*}" = "enable" ] && [ ! -f "${trm_vpnfile}" ]; } || - { [ "${vpn}" != "1" ] && [ "${vpn_action%_*}" = "enable" ] && [ -f "${trm_vpnfile}" ]; }; then + { [ -f "${trm_ntpfile}" ] && { [ "${vpn}" = "1" ] && [ "${vpn_action%_*}" = "enable" ] && [ ! -f "${trm_vpnfile}" ]; } || + { [ "${vpn}" != "1" ] && [ "${vpn_action%_*}" = "enable" ] && [ -f "${trm_vpnfile}" ]; }; }; then result="$(f_net)" if [ "${result}" = "net ok" ] || [ "${vpn_action}" = "disable" ]; then f_log "info" "vpn call '${vpn:-"0"}/${vpn_action}/${vpn_service}/${vpn_iface}'" @@ -224,11 +224,6 @@ f_vpn() { rc="${?}" fi fi - if [ "${vpn}" = "1" ] && [ "${vpn_action%_*}" = "enable" ] && [ "${rc}" = "0" ]; then - : >"${trm_vpnfile}" - elif [ "${vpn}" != "1" ] || [ "${vpn_action}" = "disable" ]; then - rm -f "${trm_vpnfile}" - fi [ -n "${rc}" ] && f_jsnup fi f_log "debug" "f_vpn ::: enabled: ${vpn:-"-"}, action: ${vpn_action}, service: ${vpn_service:-"-"}, iface: ${vpn_iface:-"-"}, rc: ${rc:-"-"}" @@ -519,7 +514,7 @@ f_addsta() { # check net status # f_net() { - local err_msg raw html_raw html_cp json_raw json_ec json_rc json_cp json_ed result="net nok" + local err_msg raw json_raw html_raw html_cp js_cp json_ec json_rc json_cp json_ed result="net nok" raw="$(${trm_fetch} --user-agent "${trm_useragent}" --referer "http://www.example.com" --header "Cache-Control: no-cache, no-store, must-revalidate, max-age=0" --write-out "%{json}" --silent --max-time $((trm_maxwait / 6)) "${trm_captiveurl}")" json_raw="${raw#*\{}" @@ -534,8 +529,11 @@ f_net() { else if [ "${json_rc}" = "200" ] || [ "${json_rc}" = "204" ]; then html_cp="$(printf "%s" "${html_raw}" | awk 'match(tolower($0),/^.*"${trm_vpnfile}" "${trm_logger}" -p "info" -t "trm-vpn [${$}]" "${vpn_service} client connection enabled" 2>/dev/null break fi @@ -55,6 +57,7 @@ if [ "${vpn}" = "1" ] && [ "${vpn_action}" = "enable" ] && [ "${vpn_status}" != if [ "${vpn_service}" = "openvpn" ] && [ -x "/etc/init.d/openvpn" ]; then /etc/init.d/openvpn stop fi + rm -f "${trm_vpnfile}" "${trm_logger}" -p "info" -t "trm-vpn [${$}]" "${vpn_service} client connection can't be established" 2>/dev/null exit 1 fi @@ -66,5 +69,6 @@ elif { [ "${vpn}" != "1" ] && [ "${vpn_action}" = "enable" ]; } || [ "${vpn_acti if [ "${vpn_service}" = "openvpn" ] && [ -x "/etc/init.d/openvpn" ]; then /etc/init.d/openvpn stop fi + rm -f "${trm_vpnfile}" "${trm_logger}" -p "info" -t "trm-vpn [${$}]" "${vpn_service} client connection disabled" 2>/dev/null fi