-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
153 lines (132 loc) · 3.82 KB
/
Copy pathMakefile
File metadata and controls
153 lines (132 loc) · 3.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright 2026 MOSSDeF, Stan Grishin (stangri@melmac.ca).
# Based on original mwan3 by Florian Eckert <fe@dev.tdt.de>
include $(TOPDIR)/rules.mk
PKG_NAME:=mwan4
PKG_VERSION:=0.1.1
PKG_RELEASE:=4
PKG_LICENSE:=AGPL-3.0-or-later
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
include $(INCLUDE_DIR)/package.mk
define Package/mwan4
SECTION:=net
CATEGORY:=Network
SUBMENU:=Routing and Redirection
TITLE:=Multiwan with nftables support
URL:=https://github.com/mossdef-org/mwan4/
CONFLICTS:=mwan3
DEPENDS:= \
+conntrack \
+ip-full \
+jsonfilter \
+!BUSYBOX_DEFAULT_PING:iputils-ping \
+kmod-nft-core \
+kmod-nft-nat \
+ucode \
+ucode-mod-fs \
+ucode-mod-uci \
+ucode-mod-ubus \
+ucode-mod-uloop \
+nftables-json \
+rpcd-mod-ucode
SUGGESTS:= \
iputils-arping \
httping \
nping
endef
define Package/mwan4/description
Multiwan hotplug script with connection tracking support using nftables.
Supports loadbalancing/failover for up to 254 WAN interfaces with
firewall4/nftables integration.
endef
define Package/mwan4/conffiles
/etc/config/mwan4
/etc/mwan4.user
endef
define Build/Configure
endef
define Build/Compile
$(TARGET_CC) $(CFLAGS) $(LDFLAGS) $(FPIC) \
-shared \
-o $(PKG_BUILD_DIR)/libwrap_mwan4_sockopt.so.1.0 \
-DCONFIG_IPV6 \
$(PKG_BUILD_DIR)/sockopt_wrap.c \
-ldl
endef
define Package/mwan4/install
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/etc/config/mwan4 \
$(1)/etc/config/
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
$(INSTALL_DATA) ./files/etc/hotplug.d/iface/15-mwan4 \
$(1)/etc/hotplug.d/iface/
$(INSTALL_DATA) ./files/etc/hotplug.d/iface/16-mwan4-user \
$(1)/etc/hotplug.d/iface/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/etc/init.d/mwan4 \
$(1)/etc/init.d/
$(SED) "s|^\(readonly PKG_VERSION\).*|\1='$(PKG_VERSION)-r$(PKG_RELEASE)'|" $(1)/etc/init.d/mwan4
$(INSTALL_DIR) $(1)/lib/mwan4
$(INSTALL_DATA) ./files/lib/mwan4/mwan4.uc \
$(1)/lib/mwan4/
$(INSTALL_DATA) ./files/lib/mwan4/cli.uc \
$(1)/lib/mwan4/
$(INSTALL_DATA) ./files/lib/mwan4/hotplug_iface.uc \
$(1)/lib/mwan4/
$(INSTALL_DATA) ./files/lib/mwan4/init_setup.uc \
$(1)/lib/mwan4/
$(INSTALL_DATA) ./files/lib/mwan4/init_teardown.uc \
$(1)/lib/mwan4/
$(INSTALL_DATA) ./files/lib/mwan4/mwan4track.uc \
$(1)/lib/mwan4/
$(INSTALL_DATA) ./files/lib/mwan4/mwan4rtmon.uc \
$(1)/lib/mwan4/
$(INSTALL_DIR) $(1)/usr/share/rpcd/ucode/
$(INSTALL_BIN) ./files/usr/share/rpcd/ucode/mwan4 \
$(1)/usr/share/rpcd/ucode/
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) ./files/usr/sbin/mwan4 \
$(1)/usr/sbin/
$(INSTALL_BIN) ./files/usr/sbin/mwan4track \
$(1)/usr/sbin/
$(INSTALL_BIN) ./files/usr/sbin/mwan4rtmon \
$(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc
$(INSTALL_BIN) ./files/etc/mwan4.user \
$(1)/etc/
$(CP) $(PKG_BUILD_DIR)/libwrap_mwan4_sockopt.so.1.0 $(1)/lib/mwan4/
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/etc/uci-defaults/90-mwan4 \
$(1)/etc/uci-defaults/
endef
define Package/mwan4/postinst
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo -n "Installing rc.d symlink for mwan4... "
/etc/init.d/mwan4 enable && echo "OK" || echo "FAIL"
/etc/init.d/rpcd restart >/dev/null 2>&1
fi
exit 0
endef
define Package/mwan4/prerm
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo -n "Stopping mwan4 service... "
/etc/init.d/mwan4 stop >/dev/null 2>&1 && echo "OK" || echo "FAIL"
echo -n "Removing rc.d symlink for mwan4... "
/etc/init.d/mwan4 disable && echo "OK" || echo "FAIL"
fi
exit 0
endef
define Package/mwan4/postrm
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
fw4 -q reload || true
/etc/init.d/rpcd restart >/dev/null 2>&1
fi
exit 0
endef
$(eval $(call BuildPackage,mwan4))