1 # Copyright 2017-2018 Stan Grishin (stangri@melmac.net)
2 # This is free software, licensed under the GNU General Public License v3.
4 include $(TOPDIR
)/rules.mk
6 PKG_NAME
:=vpn-policy-routing
9 PKG_LICENSE
:=GPL-3.0
-or-later
10 PKG_MAINTAINER
:=Stan Grishin
<stangri@melmac.net
>
12 include $(INCLUDE_DIR
)/package.mk
14 define Package
/vpn-policy-routing
17 TITLE
:=VPN Policy-Based Routing Service
18 DEPENDS
:=+ipset
+iptables
+resolveip
+kmod-ipt-ipset
+iptables-mod-ipopt
+!BUSYBOX_CONFIG_IP
:ip-full
22 define Package
/vpn-policy-routing
/description
23 This service allows policy-based routing for L2TP
, Openconnect
, OpenVPN
, PPTP and Wireguard tunnels and WAN interface.
24 Policies can specify domains
, local IPs
/subnets and ports
, as well
as remote IPs
/subnets and ports.
27 define Package
/vpn-policy-routing
/conffiles
28 /etc
/config
/vpn-policy-routing
32 mkdir
-p
$(PKG_BUILD_DIR
)/files
/
33 $(CP
) .
/files
/vpn-policy-routing.init
$(PKG_BUILD_DIR
)/files
/vpn-policy-routing.init
34 sed
-i
"s|^\(PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(PKG_BUILD_DIR
)/files
/vpn-policy-routing.init
37 define Build
/Configure
43 define Package
/vpn-policy-routing
/install
44 $(INSTALL_DIR
) $(1)/etc
/init.d
45 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/files
/vpn-policy-routing.init
$(1)/etc
/init.d
/vpn-policy-routing
46 $(INSTALL_DIR
) $(1)/etc
/config
47 $(INSTALL_CONF
) .
/files
/vpn-policy-routing.conf
$(1)/etc
/config
/vpn-policy-routing
48 $(INSTALL_DIR
) $(1)/etc
/hotplug.d
/firewall
49 $(INSTALL_DATA
) .
/files
/vpn-policy-routing.firewall.hotplug
$(1)/etc
/hotplug.d
/firewall
/99-vpn-policy-routing
50 $(INSTALL_DIR
) $(1)/etc
/hotplug.d
/iface
51 $(INSTALL_DATA
) .
/files
/vpn-policy-routing.iface.hotplug
$(1)/etc
/hotplug.d
/iface
/70-vpn-policy-routing
52 $(INSTALL_DIR
) $(1)/etc
/
53 $(INSTALL_DATA
) .
/files
/vpn-policy-routing.aws.user
$(1)/etc
/vpn-policy-routing.aws.user
54 $(INSTALL_DIR
) $(1)/etc
/
55 $(INSTALL_DATA
) .
/files
/vpn-policy-routing.netflix.user
$(1)/etc
/vpn-policy-routing.netflix.user
58 define Package
/vpn-policy-routing
/postinst
60 # check if we are on real system
61 if
[ -z
"$${IPKG_INSTROOT}" ]; then
62 /etc
/init.d
/vpn-policy-routing enable
63 if
! /bin
/ubus
-S call system board |
/bin
/grep
'Turris' |
/bin
/grep
-q
'15.05' ; then
64 rm -rf
/etc
/hotplug.d
/iface
/70-vpn-policy-routing
70 define Package
/vpn-policy-routing
/prerm
72 # check if we are on real system
73 if
[ -z
"$${IPKG_INSTROOT}" ]; then
74 echo
"Stopping service and removing rc.d symlink for vpn-policy-routing"
75 /etc
/init.d
/vpn-policy-routing stop || true
76 /etc
/init.d
/vpn-policy-routing disable || true
81 $(eval
$(call BuildPackage
,vpn-policy-routing
))