noddos: introduction of noddos package
[feed/packages.git] / net / noddos / Makefile
1 #
2 # Copyright (C) 2017 Steven Hessing
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 # Name and release number of this package
11 PKG_NAME:=noddos
12 PKG_RELEASE:=1
13 PKG_LICENSE:=GPLv3
14
15 PKG_SOURCE_VERSION:=0.4.1
16 PKG_SOURCE_URL:=https://github.com/noddos/noddos/releases/download/v$(PKG_SOURCE_VERSION)/
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.xz
18 PKG_HASH:=f676b1c7d9aa6496184b73eacbbfe27b4f54e53c726769ef9ceeeda9c31a7fa3
19
20 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
21
22 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
23
24 CMAKE_INSTALL:=1
25 include $(INCLUDE_DIR)/package.mk
26 include $(INCLUDE_DIR)/cmake.mk
27
28 define Package/noddos
29 SECTION:=net
30 CATEGORY:=Network
31 TITLE:=noddos -- device-aware cloud-powered firewall
32 URL:=https://www.noddos.io/
33 DEPENDS:=+libstdcpp +libnetfilter-conntrack +libcurl +libopenssl +openssl-util +ca-bundle +ca-certificates +wget +bzip2 +libtins +ipset
34 endef
35
36 define Package/noddos/description
37 Noddos discovers what devices you have in your network and tailors the firewall rules based on whitelisted flows for that device. Noddos downloads the firewall rules periodically from the cloud. In order to support creating these firewall rules, noddos can optionally upload anonimized traffic statistics for each device to the cloud.
38 endef
39
40 define Package/noddos/conffiles
41 /etc/config/noddos
42 endef
43
44 define Package/noddos/install
45 $(INSTALL_DIR) $(1)/usr/bin
46 $(INSTALL_DIR) $(1)/usr/sbin
47 $(INSTALL_DIR) $(1)/etc/config
48 $(INSTALL_DIR) $(1)/etc/init.d
49 $(INSTALL_DIR) $(1)/etc/noddos
50 $(INSTALL_DIR) $(1)/var/lib/noddos
51 $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/noddos $(1)/usr/sbin/
52 $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/getnoddosdeviceprofiles $(1)/usr/bin
53 $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/makenoddoscert.sh $(1)/usr/bin
54 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/noddos.init $(1)/etc/init.d/noddos
55 $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/noddos.uciconfig $(1)/etc/config/noddos
56 $(INSTALL_DATA) $(PKG_BUILD_DIR)/files/noddos.conf-base $(1)/etc/noddos
57 $(INSTALL_DATA) $(PKG_BUILD_DIR)/files/noddosconfig.pem $(1)/etc/noddos
58 $(INSTALL_DATA) $(PKG_BUILD_DIR)/files/noddos.conf-base $(1)/etc/noddos
59 endef
60
61 define Package/noddos/prerm
62 #!/bin/sh
63 # check if we are on real system
64 if [ -z "$${IPKG_INSTROOT}" ]; then
65 /etc/init.d/noddos stop
66 echo "Removing rc.d symlink for noddos"
67 /etc/init.d/noddos disable
68 fi
69 exit 0
70 endef
71
72 define Package/noddos/postrm
73 #!/bin/sh
74 # check if we are on real system
75 if [ -z "$${IPKG_INSTROOT}" ]; then
76 echo "Removing noddos data directory"
77 rm -rf /var/lib/noddos
78 if [ -f /var/etc/noddos.conf ]; then
79 rm /var/etc/noddos.conf
80 fi
81 fi
82 exit 0
83 endef
84
85 $(eval $(call BuildPackage,noddos))