You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.4 KiB

  1. # Copyright 2017-2018 Stan Grishin (stangri@melmac.net)
  2. # This is free software, licensed under the GNU General Public License v3.
  3. include $(TOPDIR)/rules.mk
  4. PKG_NAME:=vpnbypass
  5. PKG_VERSION:=1.3.1
  6. PKG_RELEASE:=4
  7. PKG_LICENSE:=GPL-3.0-or-later
  8. PKG_MAINTAINER:=Stan Grishin <stangri@melmac.net>
  9. include $(INCLUDE_DIR)/package.mk
  10. define Package/vpnbypass
  11. SECTION:=net
  12. CATEGORY:=Network
  13. DEPENDS:=+ipset +iptables
  14. CONFLICTS:=vpn-policy-routing
  15. TITLE:=VPN Bypass Service
  16. PKGARCH:=all
  17. endef
  18. define Package/vpnbypass/description
  19. This service can be used to enable simple VPN split tunnelling.
  20. Supports accessing domains, IP ranges outside of your VPN tunnel.
  21. Also supports dedicating local ports/IP ranges for direct
  22. internet access (outside of your VPN tunnel).
  23. Please see the README for further information.
  24. endef
  25. define Package/vpnbypass/conffiles
  26. /etc/config/vpnbypass
  27. endef
  28. define Build/Prepare
  29. mkdir -p $(PKG_BUILD_DIR)/files/
  30. $(CP) ./files/vpnbypass.init $(PKG_BUILD_DIR)/files/vpnbypass.init
  31. sed -i "s|^\(PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(PKG_BUILD_DIR)/files/vpnbypass.init
  32. endef
  33. define Build/Configure
  34. endef
  35. define Build/Compile
  36. endef
  37. define Package/vpnbypass/install
  38. $(INSTALL_DIR) $(1)/etc/init.d
  39. $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/vpnbypass.init $(1)/etc/init.d/vpnbypass
  40. $(INSTALL_DIR) $(1)/etc/config
  41. $(INSTALL_CONF) ./files/vpnbypass.conf $(1)/etc/config/vpnbypass
  42. $(INSTALL_DIR) $(1)/etc/hotplug.d/firewall
  43. $(INSTALL_DATA) ./files/vpnbypass.hotplug $(1)/etc/hotplug.d/firewall/94-vpnbypass
  44. endef
  45. define Package/vpnbypass/postinst
  46. #!/bin/sh
  47. # check if we are on real system
  48. if [ -z "$${IPKG_INSTROOT}" ]; then
  49. /etc/init.d/vpnbypass enable
  50. while uci -q del ucitrack.@vpnbypass[-1]; do :; done
  51. uci -q batch <<-EOF >/dev/null
  52. add ucitrack vpnbypass
  53. set ucitrack.@vpnbypass[0].init='vpnbypass'
  54. del_list ucitrack.@firewall[0].affects='vpnbypass'
  55. add_list ucitrack.@firewall[0].affects='vpnbypass'
  56. commit ucitrack
  57. EOF
  58. fi
  59. exit 0
  60. endef
  61. define Package/vpnbypass/prerm
  62. #!/bin/sh
  63. # check if we are on real system
  64. if [ -z "$${IPKG_INSTROOT}" ]; then
  65. while uci -q delete ucitrack.@vpnbypass[-1]; do :; done
  66. uci -q del_list ucitrack.@firewall[0].affects='vpnbypass'
  67. echo "Stopping service and removing rc.d symlink for vpnbypass"
  68. /etc/init.d/vpnbypass stop || true
  69. /etc/init.d/vpnbypass disable || true
  70. fi
  71. exit 0
  72. endef
  73. $(eval $(call BuildPackage,vpnbypass))