travelmate: update 2.1.2-5
authorDirk Brenken <dev@brenken.org>
Thu, 29 Feb 2024 20:00:21 +0000 (21:00 +0100)
committerDirk Brenken <dev@brenken.org>
Thu, 29 Feb 2024 20:01:16 +0000 (21:01 +0100)
* final vpn tweaks

Signed-off-by: Dirk Brenken <dev@brenken.org>
net/travelmate/Makefile
net/travelmate/files/travelmate.sh

index 25e38d122ead86d98faacd394eaf4009eaacb841..971144b12a9dc7eeea29befde89d50212bb24795 100644 (file)
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=travelmate
 PKG_VERSION:=2.1.2
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 PKG_LICENSE:=GPL-3.0-or-later
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
 
index 7dbb357ca5c8cc1e9b89eaea842fe6e607cbc6fa..35a12c3305f037436334a4c0f87d2e14f2eb3451 100755 (executable)
@@ -205,43 +205,37 @@ f_vpn() {
                if [ ! -f "${trm_vpnfile}" ] || { [ -f "${trm_vpnfile}" ] && [ "${vpn_action}" = "enable" ]; }; then
                        for info in ${trm_vpninfolist}; do
                                iface="${info%%&&*}"
-                               if [ "${iface}" = "${info}" ]; then
-                                       vpn_instance=""
-                               else
-                                       vpn_instance="${info##*&&}"
-                               fi
                                vpn_status="$(ifstatus "${iface}" | "${trm_jsoncmd}" -ql1 -e '@.up')"
                                if [ "${vpn_status}" = "true" ]; then
                                        /sbin/ifdown "${iface}"
                                        "${trm_ubuscmd}" -S call network.interface."${iface}" remove >/dev/null 2>&1
-                                       f_log "info" "take down vpn interface '${iface}/${vpn_instance:-"-"}' (initial)"
+                                       f_log "info" "take down vpn interface '${iface}' (initial)"
                                fi
+                               [ "${iface}" = "${info}" ] && vpn_instance="" || vpn_instance="${info##*&&}"
                                if [ -x "/etc/init.d/openvpn" ] && [ -n "${vpn_instance}" ] && /etc/init.d/openvpn running "${vpn_instance}"; then
                                        /etc/init.d/openvpn stop "${vpn_instance}"
-                                       f_log "info" "take down openvpn instance '${vpn_instance:-"-"}' (initial)"
+                                       f_log "info" "take down openvpn instance '${vpn_instance}' (initial)"
                                fi
                        done
                        rm -f "${trm_vpnfile}"
                elif [ "${vpn}" = "1" ] && [ -n "${vpn_iface}" ] && [ "${vpn_action}" = "enable_keep" ]; then
                        for info in ${trm_vpninfolist}; do
                                iface="${info%%&&*}"
-                               if [ "${iface}" = "${info}" ]; then
-                                       vpn_instance=""
-                               else
-                                       vpn_instance="${info##*&&}"
-                               fi
                                vpn_status="$(ifstatus "${iface}" | "${trm_jsoncmd}" -ql1 -e '@.up')"
                                if [ "${vpn_status}" = "true" ] && [ "${iface}" != "${vpn_iface}" ]; then
                                        /sbin/ifdown "${iface}"
-                                       f_log "info" "take down vpn interface '${iface}/${vpn_instance:-"-"}' (switch)"
-                                       rm -f "${trm_vpnfile}"
-                                       break
+                                       f_log "info" "take down vpn interface '${iface}' (switch)"
+                                       rc="1"
                                fi
+                               [ "${iface}" = "${info}" ] && vpn_instance="" || vpn_instance="${info##*&&}"
                                if [ -x "/etc/init.d/openvpn" ] && [ -n "${vpn_instance}" ] && /etc/init.d/openvpn running "${vpn_instance}"; then
                                        /etc/init.d/openvpn stop "${vpn_instance}"
-                                       f_log "info" "take down openvpn instance '${vpn_instance:-"-"}' (switch)"
+                                       f_log "info" "take down openvpn instance '${vpn_instance}' (switch)"
+                                       rc="1"
                                fi
+                               [ "${rc}" = "1" ] && break
                        done
+                       rm -f "${trm_vpnfile}"
                fi
                if [ -x "${trm_vpnpgm}" ] && [ -n "${vpn_service}" ] && [ -n "${vpn_iface}" ]; then
                        if { [ "${vpn_action}" = "disable" ] && [ -f "${trm_vpnfile}" ]; } ||
@@ -251,11 +245,7 @@ f_vpn() {
                                                for info in ${trm_vpninfolist}; do
                                                        iface="${info%%&&*}"
                                                        if [ "${iface}" = "${vpn_iface}" ]; then 
-                                                               if [ "${iface}" = "${info}" ]; then
-                                                                       vpn_instance=""
-                                                               else
-                                                                       vpn_instance="${info##*&&}"
-                                                               fi
+                                                               [ "${iface}" = "${info}" ] && vpn_instance="" || vpn_instance="${info##*&&}"
                                                                break
                                                        fi
                                                done