~alpine/aports

[alpine-aports] [PATCH v2] testing/flow-tools: new aport

Details
Message ID
<20170426123523.4392-1-valery.kartel@gmail.com>
Sender timestamp
1493210123
DKIM signature
missing
Download raw message
Patch: +151 -0
Tool set for working with NetFlow data
https://code.google.com/p/flow-tools

---
v1 -> v2: split to subpackages
---
 testing/flow-tools/APKBUILD                 | 106 ++++++++++++++++++++++++++++
 testing/flow-tools/flow-capture.confd       |  27 +++++++
 testing/flow-tools/flow-capture.initd       |  12 ++++
 testing/flow-tools/flow-capture.pre-install |   6 ++
 4 files changed, 151 insertions(+)
 create mode 100644 testing/flow-tools/APKBUILD
 create mode 100644 testing/flow-tools/flow-capture.confd
 create mode 100644 testing/flow-tools/flow-capture.initd
 create mode 100644 testing/flow-tools/flow-capture.pre-install

diff --git a/testing/flow-tools/APKBUILD b/testing/flow-tools/APKBUILD
new file mode 100644
index 0000000000..01abc35291
--- /dev/null
+++ b/testing/flow-tools/APKBUILD
@@ -0,0 +1,106 @@
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
pkgname=flow-tools
pkgver=0.68.5.1
pkgrel=0
_pkgreal=flow
pkgdesc="Tool set for working with NetFlow data"
url="https://code.google.com/p/flow-tools"
arch="all"
license="BSD"
options="!check"
install="$_pkgreal-capture.pre-install"
pkgusers=$_pkgreal
pkggroups=$_pkgreal
depends_dev="perl"
makedepends="zlib-dev"
subpackages="$pkgname-doc libft-dev libft:libs
	$_pkgreal-capture $_pkgreal-log2rrd::noarch
	$_pkgreal-rptfmt::noarch $_pkgreal-rpt2rrd::noarch
	"
_tools="cat dscan expire export fanout filter gen header import
	mask merge nfilter print receive report send split stat tag xlate"
_tools_list="$_pkgreal-capture"
for _tool in $_tools; do
	subpackages="$subpackages $_pkgreal-$_tool:_tool"
	_tools_list="$_tools_list $_pkgreal-$_tool"
done
source="https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/$pkgname/$pkgname-$pkgver.tar.bz2
	$_pkgreal-capture.initd
	$_pkgreal-capture.confd"
builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	default_prepare || return 1

	cd "$builddir"
	local file
	for file in bin/flow-rpt*; do
		sed -i -e "s:/usr/local/netflow/var:/etc/$_pkgreal:" $file || return 1
	done
	update_config_sub
}

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--target=$CTARGET \
		--prefix=/usr \
		--sysconfdir=/etc/$_pkgreal \
		--localstatedir=/var/lib/$_pkgreal \
		|| return 1
	make
}

package() {
	depends=$_tools_list
	make -C "$builddir" DESTDIR="$pkgdir" install
}

dev() {
	default_dev || return 1

	mkdir -p "$subpkgdir"/usr || return 1
	mv "$pkgdir"/usr/share "$subpkgdir"/usr || return 1
}

libs() {
	default_libs || return 1
	mv "$pkgdir"/etc "$subpkgdir" || return 1
}

_tool() {
	pkgdesc="$pkgdesc (${subpkgname#$_pkgreal-} tool)"
	mkdir -p "$subpkgdir"/usr/bin || return 1
	mv "$pkgdir"/usr/bin/$subpkgname "$subpkgdir"/usr/bin || return 1
}

capture() {
	_tool || return 1
	install -Dm644 "$srcdir"/$subpkgname.confd \
		"$subpkgdir"/etc/conf.d/$subpkgname || return 1
	install -Dm755 "$srcdir"/$subpkgname.initd \
		"$subpkgdir"/etc/init.d/$subpkgname || return 1
	install -Dm750 -o $_pkgreal -g $_pkgreal -d "$subpkgdir"/var/lib/$_pkgreal
}

rptfmt() {
	_tool || return 1
	depends="python2"
}

rpt2rrd() {
	_tool || return 1
	depends="python2 py-rrd"
}

log2rrd() {
	_tool || return 1
	depends="python2 py-rrd"
}

sha512sums="ae17ba39854daa8ef3deecd3a554bb6d1fa47648cb791d8225a40bec13f65bf0692871660b2c3490d133b1251875c323d066bb0c0483eceb0707cec9b7714c57  flow-tools-0.68.5.1.tar.bz2
abfaffeaceef2ec6c2145e3777770f053c8f7cd5148fe23fde87dfbc86bb0127abb341619cd2f81139ba87e29c585667a011cf44a594dacd68f1b20c10abe244  flow-capture.initd
ef2053d679e968aa1ae963a721f301669e6183d33461f378bdab826109b15fb5ac4f7816f3f4a3d426e56ba3b616377d2f0b0a3d129e4111b223a28459a94c0d  flow-capture.confd"
diff --git a/testing/flow-tools/flow-capture.confd b/testing/flow-tools/flow-capture.confd
new file mode 100644
index 0000000000..2e2ece877e
--- /dev/null
+++ b/testing/flow-tools/flow-capture.confd
@@ -0,0 +1,27 @@
# local ip. if configured flow-capture will only ps flows sent to this ip.
#FLOW_LOCAL_IP=0

# remote ip. If this is configured only flows from this exporter will be accepted
# by default we will accept any flows sent to us
#FLOW_REMOTE_IP=0

# port to listen on
#FLOW_PORT=2055

# This is the default and should be left unless you know what you are doing
#FLOW_VER=5

# You probably don't want to change this, but in case you do - nest level
#FLOW_NEST=0

# Retain the maximum number of files so that the total storage is less than SIZE
# The letters b,K,M,G can be used as multipliers, ie 16 Megabytes is 16M.
#FLOW_SIZE=1G

# number of rotations per day
#FLOW_ROTATIONS=287

# program used to rotate 
#FLOW_ROTATE_PROG="/var/lib/flow/rotate.sh"

FLOW_ARGS="${FLOW_VER:+-V $FLOW_VER} ${FLOW_NEST:+-N $FLOW_NEST} ${FLOW_SIZE:+-E $FLOW_SIZE} ${FLOW_ROTATIONS:+-n $FLOW_ROTATIONS} ${FLOW_ROTATE_PROG:+-R $FLOW_ROTATE_PROG}"
diff --git a/testing/flow-tools/flow-capture.initd b/testing/flow-tools/flow-capture.initd
new file mode 100644
index 0000000000..87270e40a0
--- /dev/null
+++ b/testing/flow-tools/flow-capture.initd
@@ -0,0 +1,12 @@
#!/sbin/openrc-run

name="NetFlow capture"
command=/usr/bin/flow-capture
command_args="-D -w ${FLOW_WORKDIR:-/var/lib/flow} ${FLOW_LOCAL_IP:-0}/${FLOW_REMOTE_IP:-0}/${FLOW_PORT:-2055} $FLOW_ARGS"
command_background=yes
pidfile=/run/$RC_SVCNAME.pid
start_stop_daemon_args="-u ${FLOW_USER:-flow}"

depend() {
	need net localmount
}
diff --git a/testing/flow-tools/flow-capture.pre-install b/testing/flow-tools/flow-capture.pre-install
new file mode 100644
index 0000000000..316e61ba4f
--- /dev/null
+++ b/testing/flow-tools/flow-capture.pre-install
@@ -0,0 +1,6 @@
#!/bin/sh

addgroup -S flow 2>/dev/null
adduser -S -D -H -h /var/lib/flow -s /sbin/nologin -G flow -g flow flow 2>/dev/null

exit 0
-- 
2.12.2



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)