vpnbypass: better start/stop from Web UI and triggers

Signed-off-by: Stan Grishin <stangri@melmac.net>
This commit is contained in:
Stan Grishin
2018-01-25 19:16:35 -08:00
parent 74eecfebcc
commit d7b0dc611f
3 changed files with 93 additions and 46 deletions
+48 -5
View File
@@ -4,8 +4,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=vpnbypass
PKG_VERSION:=1.3.0
PKG_RELEASE:=6
PKG_VERSION:=1.3.1
PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0+
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.net>
@@ -15,15 +15,16 @@ define Package/vpnbypass
SECTION:=net
CATEGORY:=Network
DEPENDS:=+ipset +iptables
CONFLICTS:=openvpn-policy-routing
TITLE:=Simple VPN Bypass Service
CONFLICTS:=vpn-policy-routing
TITLE:=VPN Bypass Service
PKGARCH:=all
endef
define Package/vpnbypass/description
This service can be used to enable simple VPN split tunnelling.
Supports accessing domains, IP ranges outside of your VPN tunnel.
Also supports dedicating local ports/IP ranges for direct internet access (outside of your VPN tunnel).
Also supports dedicating local ports/IP ranges for direct
internet access (outside of your VPN tunnel).
Please see the README for further information.
endef
@@ -52,4 +53,46 @@ define Package/vpnbypass/install
$(INSTALL_DATA) ./files/vpnbypass.hotplug $(1)/etc/hotplug.d/firewall/94-vpnbypass
endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
while [ ! -z "$(uci -q get ucitrack.@vpnbypass[-1] 2>/dev/null)" ] ; do
uci -q delete ucitrack.@vpnbypass[-1]
done
while [ ! -z "$(uci -q get ucitrack.@firewall[-1].affects 2>/dev/null | awk '/vpnbypass/')" ] ; do
uci -q del_list ucitrack.@firewall[-1].affects='vpnbypass'
done
uci -q batch <<-EOF >/dev/null
add ucitrack vpnbypass
set ucitrack.@vpnbypass[-1].init='vpnbypass'
add_list ucitrack.@firewall[-1].affects='vpnbypass'
commit ucitrack
EOF
fi
exit 0
endef
define Package/$(PKG_NAME)/prerm
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Stopping service and removing rc.d symlink for vpnbypass"
/etc/init.d/vpnbypass stop || true
/etc/init.d/vpnbypass disable
while [ ! -z "$(uci -q get ucitrack.@vpnbypass[-1] 2>/dev/null)" ] ; do
uci -q delete ucitrack.@vpnbypass[-1]
done
while [ ! -z "$(uci -q get ucitrack.@firewall[-1].affects 2>/dev/null | awk '/vpnbypass/')" ] ; do
uci -q del_list ucitrack.@firewall[-1].affects='vpnbypass'
done
fi
exit 0
endef
$(eval $(call BuildPackage,vpnbypass))