From 0daa9fb1dd48ee63024a5fc24dd3c85e112f7ed6 Mon Sep 17 00:00:00 2001 From: Stan Grishin Date: Mon, 21 Sep 2020 18:15:40 +0000 Subject: [PATCH] vpnbypass: README update, code cleanup Signed-off-by: Stan Grishin update Signed-off-by: Stan Grishin --- net/vpnbypass/Makefile | 3 +-- net/vpnbypass/files/README.md | 9 +++++++-- net/vpnbypass/files/vpnbypass.init | 30 ++++++++++++++++++++---------- net/vpnbypass/test.sh | 3 +++ 4 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 net/vpnbypass/test.sh diff --git a/net/vpnbypass/Makefile b/net/vpnbypass/Makefile index d2090f28ee..41a8c99a28 100644 --- a/net/vpnbypass/Makefile +++ b/net/vpnbypass/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=vpnbypass PKG_VERSION:=1.3.1 -PKG_RELEASE:=7 +PKG_RELEASE:=9 PKG_LICENSE:=GPL-3.0-or-later PKG_MAINTAINER:=Stan Grishin @@ -52,7 +52,6 @@ define Package/vpnbypass/install $(INSTALL_DATA) ./files/vpnbypass.hotplug $(1)/etc/hotplug.d/firewall/94-vpnbypass endef - define Package/vpnbypass/postinst #!/bin/sh # check if we are on real system diff --git a/net/vpnbypass/files/README.md b/net/vpnbypass/files/README.md index 9925bed3f1..50fdb8c927 100644 --- a/net/vpnbypass/files/README.md +++ b/net/vpnbypass/files/README.md @@ -1,5 +1,8 @@ + # VPN Bypass +[![HitCount](http://hits.dwyl.com/stangri/openwrt/vpnbypass.svg)](http://hits.dwyl.com/stangri/openwrt/vpnbypass) + A simple [procd](https://openwrt.org/docs/techref/procd)-based ```vpnbypass``` service for OpenWrt/LEDE Project. This is useful if your router accesses Internet through a VPN client/tunnel, but you want specific traffic (ports, IP ranges, domains or local IP ranges) to be routed outside of this tunnel. ## Features @@ -14,7 +17,7 @@ A simple [procd](https://openwrt.org/docs/techref/procd)-based ```vpnbypass``` s ## Screenshot (luci-app-vpnbypass) -![screenshot](https://raw.githubusercontent.com/stangri/openwrt_packages/master/screenshots/vpnbypass/screenshot02.png "screenshot") +![screenshot](https://cdn.jsdelivr.net/gh/stangri/openwrt_packages/screenshots/vpnbypass/screenshot02.png "screenshot") ## Requirements @@ -57,7 +60,9 @@ opkg update opkg install vpnbypass luci-app-vpnbypass ``` -If these packages are not found in the official feed/repo for your version of OpenWrt/LEDE Project, you will need to [add a custom repo to your router](https://github.com/stangri/openwrt_packages/blob/master/README.md#on-your-router) first. +If these packages are not found in the official feed/repo for your version of OpenWrt/LEDE Project, you will need to add a custom repo to your router following instructions on [GitHub](https://github.com/stangri/openwrt_packages/blob/master/README.md#on-your-router)/[jsDelivr](https://cdn.jsdelivr.net/gh/stangri/openwrt_packages/README.md#on-your-router) first. + +These packages have been designed to be backwards compatible with OpenWrt 19.07, OpenWrt 18.06, LEDE Project 17.01 and OpenWrt 15.05. However, on systems older than OpenWrt 18.06.6 and/or a system which has deviated too far (or haven't been updated to keep in-sync) with official OpenWrt release you may get a message about missing ```luci-compat``` dependency, which (and only which) you can safely ignore and force-install the luci app using ```opkg install --force-depends``` command instead of ```opkg install```. ## Default Settings diff --git a/net/vpnbypass/files/vpnbypass.init b/net/vpnbypass/files/vpnbypass.init index a5b4f15655..c64654a8a4 100644 --- a/net/vpnbypass/files/vpnbypass.init +++ b/net/vpnbypass/files/vpnbypass.init @@ -3,17 +3,27 @@ # shellcheck disable=SC2039,SC1091,SC2086 PKG_VERSION='dev-test' -export START=94 -export USE_PROCD=1 +# shellcheck disable=SC2034 +START=94 +# shellcheck disable=SC2034 +USE_PROCD=1 -readonly _OK_='\033[0;32m\xe2\x9c\x93\033[0m' -readonly _FAIL_='\033[0;31m\xe2\x9c\x97\033[0m' -readonly __OK__='\033[0;32m[\xe2\x9c\x93]\033[0m' -readonly __FAIL__='\033[0;31m[\xe2\x9c\x97]\033[0m' -readonly __PASS__='\033[0;33m[-]\033[0m' -readonly _ERROR_='\033[0;31mERROR\033[0m' +# shellcheck disable=SC2034 +EXTRA_COMMANDS='version' +version() { echo "$PKG_VERSION"; } + +readonly __ERROR__='\033[0;31mERROR\033[0m' + +# shellcheck disable=SC2034 +serviceEnabled=0 +verbosity=2 +TID='200' +IPSET='vpnbypass' +FW_MARK='0x010000' +FW_MASK='0xff0000' +wan_if4='' +wan_gw='' -export serviceEnabled verbosity=2 TID='200' IPSET='vpnbypass' FW_MARK='0x010000' FW_MASK='0xff0000' wan_if4 wan_gw readonly packageName='vpnbypass' readonly serviceName="$packageName $PKG_VERSION" readonly sharedMemoryOutput="/dev/shm/$packageName-output" @@ -122,6 +132,6 @@ service_triggers() { procd_add_reload_trigger 'firewall' 'openvpn' 'vpnbypass' procd_open_trigger for n in $ifaces; do procd_add_reload_interface_trigger "$n"; procd_add_interface_trigger "interface.*" "$n" /etc/init.d/vpnbypass reload; done; - output "$serviceName monitoring interfaces: $ifaces $_OK_\\n" + output "$serviceName monitoring interfaces: $ifaces\\n" procd_close_trigger } diff --git a/net/vpnbypass/test.sh b/net/vpnbypass/test.sh new file mode 100644 index 0000000000..e51c480568 --- /dev/null +++ b/net/vpnbypass/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +/etc/init.d/"$1" version 2>&1 | grep "$2" \ No newline at end of file -- 2.30.2