Revert package feed back
[librecmc/package-feed.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 PKG_MAINTAINER:=Steven Hessing <steven.hessing@gmail.com>
15
16 PKG_SOURCE_VERSION:=0.5.2
17 PKG_SOURCE_URL:=https://github.com/noddos/noddos/releases/download/v$(PKG_SOURCE_VERSION)/
18 PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.xz
19 PKG_HASH:=63fe85fc4a588da2d71b7b7db68f1c80ba19520467a3800bdb43bc516a6cff72
20
21 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
22
23 CMAKE_INSTALL:=1
24 include $(INCLUDE_DIR)/package.mk
25 include $(INCLUDE_DIR)/cmake.mk
26
27 define Package/noddos
28         SECTION:=net
29         CATEGORY:=Network
30         TITLE:=noddos -- device-aware cloud-powered firewall
31         URL:=https://www.noddos.io/
32         DEPENDS:=+libstdcpp +libnetfilter-conntrack +libcurl +libopenssl +openssl-util +ca-bundle +ca-certificates +wget +bzip2 +libtins +ipset +libpthread
33 endef
34
35 define Package/noddos/description
36 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.
37 endef
38
39 define Package/noddos/conffiles
40         /etc/config/noddos      
41 endef
42
43 define Package/noddos/install
44         $(INSTALL_DIR) $(1)/usr/bin
45         $(INSTALL_DIR) $(1)/usr/sbin
46         $(INSTALL_DIR) $(1)/etc/config
47         $(INSTALL_DIR) $(1)/etc/init.d
48         $(INSTALL_DIR) $(1)/etc/noddos
49         $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/noddos $(1)/usr/sbin/
50         $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/getnoddosdeviceprofiles $(1)/usr/bin
51         $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/makenoddoscert.sh $(1)/usr/bin
52         $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/noddos.init $(1)/etc/init.d/noddos
53         $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/noddos.uciconfig $(1)/etc/config/noddos
54         $(INSTALL_DATA) $(PKG_BUILD_DIR)/files/noddos.conf-base $(1)/etc/noddos
55         $(INSTALL_DATA) $(PKG_BUILD_DIR)/files/noddosconfig.pem $(1)/etc/noddos
56         $(INSTALL_DATA) $(PKG_BUILD_DIR)/files/noddos.conf-base $(1)/etc/noddos
57 endef
58
59 define Package/noddos/prerm
60         #!/bin/sh
61         # check if we are on real system
62         if [ -z "$${IPKG_INSTROOT}" ]; then
63                 /etc/init.d/noddos stop
64                 echo "Removing rc.d symlink for noddos"
65                 /etc/init.d/noddos disable
66         fi
67         exit 0
68 endef
69
70 define Package/noddos/postrm
71         #!/bin/sh
72         # check if we are on real system
73         if [ -z "$${IPKG_INSTROOT}" ]; then
74                 echo "Removing noddos data directory"
75                 rm -rf /var/lib/noddos
76                 if [ -f /var/etc/noddos.conf ]; then
77                         rm /var/etc/noddos.conf
78                 fi
79         fi
80         exit 0
81 endef
82
83 $(eval $(call BuildPackage,noddos))