nfdump: add new package
authorW. Michael Petullo <redacted>
Tue, 4 Feb 2020 01:33:55 +0000 (20:33 -0500)
committerW. Michael Petullo <redacted>
Thu, 13 Feb 2020 03:12:33 +0000 (22:12 -0500)
Signed-off-by: W. Michael Petullo <redacted>
net/nfdump/Makefile [new file with mode: 0644]
net/nfdump/files/nfcapd.config [new file with mode: 0644]
net/nfdump/files/nfcapd.init [new file with mode: 0644]

diff --git a/net/nfdump/Makefile b/net/nfdump/Makefile
new file mode 100644 (file)
index 0000000..171983d
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=nfdump
+PKG_VERSION:=1.6.18
+PKG_RELEASE:=1
+
+PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
+
+PKG_LICENSE:=BSD-3-Clause
+PKG_LICENSE_FILES:=COPYING
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://codeload.github.com/phaag/nfdump/tar.gz/v$(PKG_VERSION)?
+PKG_HASH:=5d6046bf7faa34713b004c6cf8b3d30027c761c5ac22a3195d49388342e8147e
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/nfdump
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:= +libbz2
+  TITLE:= nfdump
+  URL:=https://github.com/phaag/nfdump/
+endef
+
+define Package/nfdump/description
+       NetFlow collecting and processing tools
+endef
+
+define Package/nfdump/conffiles
+/etc/config/nfcapd
+endef
+
+define Package/nfdump/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libnfdump-$(PKG_VERSION).so $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/nfcapd.config $(1)/etc/config/nfcapd
+
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/nfcapd.init $(1)/etc/init.d/nfcapd
+endef
+
+$(eval $(call BuildPackage,nfdump))
diff --git a/net/nfdump/files/nfcapd.config b/net/nfdump/files/nfcapd.config
new file mode 100644 (file)
index 0000000..54293c8
--- /dev/null
@@ -0,0 +1,4 @@
+config nfcapd nfcapd
+       option enabled 0
+       option port 9995
+       option logdir /var/log
diff --git a/net/nfdump/files/nfcapd.init b/net/nfdump/files/nfcapd.init
new file mode 100644 (file)
index 0000000..f603e58
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009-2012 OpenWrt.org
+
+START=60
+USE_PROCD=1
+pidfile=/var/run/nfcapd.pid
+PROG=/usr/bin/nfcapd
+
+validate_nfcapd_section() {
+       uci_validate_section nfcapd nfcapd "${1}" \
+               'enabled:bool' \
+               'port:string' \
+               'logdir:string'
+}
+
+start_service() {
+       validate_nfcapd_section nfcapd || {
+               echo "validation failed"
+               return 1
+       }
+
+       [ "$enabled" -gt 0 ] && {
+               procd_open_instance
+               procd_set_param stdout 1
+               procd_set_param stderr 1
+               procd_set_param command "$PROG"
+               procd_append_param command -S 1 -P "$pidfile" -p "$port" -l "$logdir"
+               procd_close_instance
+       }
+}
git clone https://git.99rst.org/PROJECT