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.

68 lines
2.2 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:=vpn-policy-routing
  5. PKG_VERSION:=0.3.2
  6. PKG_RELEASE:=20
  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/vpn-policy-routing
  11. SECTION:=net
  12. CATEGORY:=Network
  13. TITLE:=VPN Policy-Based Routing Service
  14. URL:=https://docs.openwrt.melmac.net/vpn-policy-routing/
  15. DEPENDS:=+jshn +ipset +iptables +resolveip +kmod-ipt-ipset +iptables-mod-ipopt +ip-full
  16. PKGARCH:=all
  17. endef
  18. define Package/vpn-policy-routing/description
  19. This service allows policy-based routing for L2TP, Openconnect, OpenVPN, PPTP and Wireguard tunnels and WAN interface.
  20. Policies can specify domains, local IPs/subnets and ports, as well as remote IPs/subnets and ports.
  21. endef
  22. define Package/vpn-policy-routing/conffiles
  23. /etc/config/vpn-policy-routing
  24. endef
  25. define Build/Configure
  26. endef
  27. define Build/Compile
  28. endef
  29. define Package/vpn-policy-routing/install
  30. $(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/config $(1)/etc/hotplug.d/firewall $(1)/etc/
  31. $(INSTALL_BIN) ./files/vpn-policy-routing.init $(1)/etc/init.d/vpn-policy-routing
  32. $(SED) "s|^\(PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(1)/etc/init.d/vpn-policy-routing
  33. $(INSTALL_CONF) ./files/vpn-policy-routing.conf $(1)/etc/config/vpn-policy-routing
  34. $(INSTALL_DATA) ./files/vpn-policy-routing.firewall.hotplug $(1)/etc/hotplug.d/firewall/99-vpn-policy-routing
  35. $(INSTALL_DATA) ./files/vpn-policy-routing.aws.user $(1)/etc/vpn-policy-routing.aws.user
  36. $(INSTALL_DATA) ./files/vpn-policy-routing.netflix.user $(1)/etc/vpn-policy-routing.netflix.user
  37. endef
  38. define Package/vpn-policy-routing/postinst
  39. #!/bin/sh
  40. # check if we are on real system
  41. if [ -z "$${IPKG_INSTROOT}" ]; then
  42. /etc/init.d/vpn-policy-routing enable
  43. fi
  44. exit 0
  45. endef
  46. define Package/vpn-policy-routing/prerm
  47. #!/bin/sh
  48. # check if we are on real system
  49. if [ -z "$${IPKG_INSTROOT}" ]; then
  50. echo "Stopping service and removing rc.d symlink for vpn-policy-routing"
  51. /etc/init.d/vpn-policy-routing stop || true
  52. /etc/init.d/vpn-policy-routing disable || true
  53. fi
  54. exit 0
  55. endef
  56. $(eval $(call BuildPackage,vpn-policy-routing))