luci-app-olsrd2: upgrade uci-defaults for ucitrack handling to use json
[feed/routing.git] / hnetd / Makefile
1 #
2 # Copyright (C) 2012-2014 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6
7 include $(TOPDIR)/rules.mk
8
9 PKG_NAME:=hnetd
10 PKG_SOURCE_DATE:=2018-12-21
11 PKG_SOURCE_VERSION:=c43766610ed30194b048bc070a3c433aec731c40
12 PKG_RELEASE:=1
13
14 PKG_SOURCE_PROTO:=git
15 PKG_SOURCE_URL:=https://github.com/sbyx/hnetd
16 PKG_MIRROR_HASH:=3b3bfff16b99dfd23b74932ac6a74af18cb9f8fd029980f1bd3788ddfb0414bb
17
18 PKG_MAINTAINER:=Steven Barth <cyrus@openwrt.org>
19 PKG_LICENSE:=GPL-2.0-only
20 PKG_LICENSE_FILES:=LICENSE
21
22 PKG_BUILD_PARALLEL:=1
23
24 include $(INCLUDE_DIR)/package.mk
25 include $(INCLUDE_DIR)/cmake.mk
26
27 # Spammy debug builds for now
28 CMAKE_OPTIONS += -DL_LEVEL=7
29
30 # OpenWRT target
31 CMAKE_OPTIONS += -DBACKEND=openwrt
32
33 ifeq ($(BUILD_VARIANT),openssl)
34 CMAKE_OPTIONS += -DDTLS_OPENSSL=1
35 endif
36
37 define Package/hnetd/Default
38 SECTION:=net
39 CATEGORY:=Network
40 TITLE:=HNCP Homenet daemon - $(2)
41 URL:=https://github.com/sbyx/hnetd
42 DEPENDS:=+odhcpd +odhcp6c +netifd $(3)
43 DEPENDS+=@IPV6
44 VARIANT:=$1
45 endef
46
47 Package/hnetd-nossl=$(call Package/hnetd/Default,nossl,no authentication)
48 Package/hnetd-openssl=$(call Package/hnetd/Default,openssl,authentication via OpenSSL,+libopenssl)
49
50 define Package/hnet-full
51 SECTION:=net
52 CATEGORY:=Network
53 TITLE:=HNCP Homenet metapackage
54 URL:=https://github.com/sbyx/hnetd
55 DEPENDS:=+hnetd-nossl +luci-app-hnet +ip
56 # Routing
57 DEPENDS+=+babeld
58 # Service discovery
59 DEPENDS+=+ohybridproxy +zonestitcher
60 # Distributed PCP support
61 DEPENDS+=+miniupnpd +minimalist-pcproxy
62 endef
63
64 define Package/hnet-full-secure
65 SECTION:=net
66 CATEGORY:=Network
67 TITLE:=HNCP Homenet metapackage (w/ SSL)
68 URL:=https://github.com/sbyx/hnetd
69 DEPENDS:=+hnetd-openssl +luci-app-hnet +ip
70 # Routing
71 DEPENDS+=+babeld
72 # Service discovery
73 DEPENDS+=+ohybridproxy +zonestitcher
74 # Distributed PCP support
75 DEPENDS+=+miniupnpd +minimalist-pcproxy
76 endef
77
78 define Package/hnet-full-l2tp
79 SECTION:=net
80 CATEGORY:=Network
81 TITLE:=HNCP Homenet metapackage (w/ L2TP)
82 URL:=https://github.com/sbyx/hnetd
83 DEPENDS:=+hnetd-nossl +luci-app-hnet +ip-full +kmod-l2tp-eth
84 # Routing
85 DEPENDS+=+babeld
86 # Service discovery
87 DEPENDS+=+ohybridproxy +zonestitcher
88 # Distributed PCP support
89 DEPENDS+=+miniupnpd +minimalist-pcproxy
90 endef
91
92 define Package/luci-app-hnet
93 SECTION:=luci
94 CATEGORY:=LuCI
95 SUBMENU:=3. Applications
96 TITLE:=HNCP Homenet configuration and visualization
97 # DEPENDS:=+hnetd
98 # TBD - how to express dependency on 'some' hnetd?
99 endef
100
101 define Package/hnetd-$(BUILD_VARIANT)/description
102 This package provides a daemon which implementats distributed prefix assignment
103 and service discovery for a home network consisting of multiple routers
104 connected to multiple service providers. It provides a netifd protocol "hnet"
105 for use in /etc/config/network.
106 endef
107
108 define Package/hnetd-$(BUILD_VARIANT)/install
109 $(INSTALL_DIR) $(1)/usr/sbin/
110 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hnetd $(1)/usr/sbin/
111 $(INSTALL_DIR) $(1)/lib/netifd/proto
112 $(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/hnet.sh $(1)/lib/netifd/proto
113 ln -s hnetd $(1)/usr/sbin/hnet-ifresolve
114 ln -s hnetd $(1)/usr/sbin/hnet-trust
115 ln -s hnetd $(1)/usr/sbin/hnet-dump
116 $(INSTALL_DIR) $(1)/etc/init.d
117 $(INSTALL_BIN) ./files/hnetd.init $(1)/etc/init.d/hnetd
118 $(INSTALL_DIR) $(1)/etc/config
119 $(INSTALL_DATA) ./files/hnet.config $(1)/etc/config/hnet
120 $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/ohp.script $(1)/usr/sbin/hnetd-ohp-script
121 $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/ddz.script $(1)/usr/sbin/hnetd-ddz-script
122 $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/pcp.script $(1)/usr/sbin/hnetd-pcp-script
123 $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/hnetd-routing $(1)/usr/sbin/hnetd-routing
124 $(INSTALL_DIR) $(1)/etc/uci-defaults
125 $(INSTALL_BIN) ./files/hnetd.defaults $(1)/etc/uci-defaults/x-hnetd.defaults
126 $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/multicast.script $(1)/usr/sbin/hnet-multicast
127 $(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/autowifi.script $(1)/usr/sbin/autowifi
128 endef
129
130 define Package/hnet-full/install
131 true
132 endef
133
134 define Package/hnet-full-secure/install
135 true
136 endef
137
138 define Package/hnet-full-l2tp/install
139 $(INSTALL_DIR) $(1)/usr/sbin/
140 $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/tunnel.script $(1)/usr/sbin/hnetd-tunnel
141 endef
142
143 define Package/luci-app-hnet/install
144 $(INSTALL_DIR) $(1)/usr/lib/lua/luci
145 $(INSTALL_DIR) $(1)/www
146 $(CP) -R $(PKG_BUILD_DIR)/openwrt/luci/luasrc/* $(1)/usr/lib/lua/luci/
147 $(CP) -R $(PKG_BUILD_DIR)/openwrt/luci/htdocs/* $(1)/www/
148 endef
149
150 define Package/hnetd-$(BUILD_VARIANT)/postinst
151 #!/bin/sh
152 [ -n "$${IPKG_INSTROOT}" ] || {
153 (. /etc/uci-defaults/x-hnetd.defaults) && rm -f /etc/uci-defaults/x-hnetd.defaults
154 [ -x /etc/init.d/dnsmasq ] && /etc/init.d/dnsmasq restart
155 /etc/init.d/hnetd enable
156 /etc/init.d/hnetd start
157 }
158 endef
159
160 $(eval $(call BuildPackage,hnetd-nossl))
161 $(eval $(call BuildPackage,hnetd-openssl))
162 $(eval $(call BuildPackage,hnet-full))
163 $(eval $(call BuildPackage,hnet-full-secure))
164 $(eval $(call BuildPackage,hnet-full-l2tp))
165 $(eval $(call BuildPackage,luci-app-hnet))