diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/softflowd/APKBUILD | 52 | ||||
-rw-r--r-- | testing/softflowd/softflowd.confd | 10 | ||||
-rw-r--r-- | testing/softflowd/softflowd.initd | 55 |
3 files changed, 117 insertions, 0 deletions
diff --git a/testing/softflowd/APKBUILD b/testing/softflowd/APKBUILD new file mode 100644 index 0000000000..fc0a2fe499 --- /dev/null +++ b/testing/softflowd/APKBUILD @@ -0,0 +1,52 @@ +# Contributor: Leonardo Arena <rnalrd@alpinelinux.org> +# Maintainer: +pkgname=softflowd +pkgver=0.9.9 +pkgrel=0 +pkgdesc="Flow-based network traffic analyser " +url="http://www.mindrot.org/projects/softflowd/" +arch="all" +license="BSD" +depends= +depends_dev= +makedepends="$depends_dev libpcap-dev" +install= +subpackages="$pkgname-doc" +source="https://softflowd.googlecode.com/files/$pkgname-$pkgver.tar.gz + softflowd.initd + softflowd.confd + " + + +_builddir="$srcdir"/$pkgname-$pkgver + +prepare() { + cd "$_builddir" + grep -l "#include <sys/poll.h>" * | xargs sed -i 's|sys/poll.h|poll.h|g' +} + +build() { + cd "$_builddir" + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + make || return 1 +} + +package() { + cd "$_builddir" + make DESTDIR="$pkgdir" install + install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname + install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname +} + +md5sums="ba83e2715e6250e6645ebcaa9ae1009d softflowd-0.9.9.tar.gz +1dc4e097474bfa6bcf471f5b6ed6e2e1 softflowd.initd +7eab9e84a8711613d83efbaa79cda3fe softflowd.confd" +sha256sums="2313f2c50ea9b3f2db3524e38ec7cd71f9a6e885ac2e3b55ab037bccf8173612 softflowd-0.9.9.tar.gz +1cb28ef2fd8d0ff0082c856812a26cce728332293115aa6e4fd8e877083a3568 softflowd.initd +f8368e88d248d420dfb8b877c53f666116c195763f40323868b52d2345b2c45c softflowd.confd" +sha512sums="4d579c2a087c0f3cd4d2020bcfbddf9dab73254e40678b3509c93bec212bf8b5692f76bfb4e766577e431ff508f0bce0a2cf326184f192e3c5dc8ddf38514dbd softflowd-0.9.9.tar.gz +40b671b5dc126e3b58761156eadb7b172fe8cd23f04e43c90270fbfba9c7542a7adc9a496da557143fa025af3ee6644e4732a74096a66bbaf98d3cadd6d01149 softflowd.initd +3e9ff7efb2f63519ed710af8b744a264c0ce97f22af1e1d2d4ec8e071276ff42e482183715eebba8b25ff6270afac1fe9620a9c69dc5dbda889d44b141d8cb09 softflowd.confd" diff --git a/testing/softflowd/softflowd.confd b/testing/softflowd/softflowd.confd new file mode 100644 index 0000000000..3823c80c4d --- /dev/null +++ b/testing/softflowd/softflowd.confd @@ -0,0 +1,10 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# Copy conf file to softflowd.interface + +# SOFTFLOWD_COLLECTOR=host:port +# SOFTFLOWD_TIMEOUTS="maxlife=600" +# SOFTFLOWD_MAXFLOWS=17000 +# SOFTFLOWD_EXTRA= +# SOFTFLOWD_INTERFACE_IDX= + diff --git a/testing/softflowd/softflowd.initd b/testing/softflowd/softflowd.initd new file mode 100644 index 0000000000..3cf1e4231b --- /dev/null +++ b/testing/softflowd/softflowd.initd @@ -0,0 +1,55 @@ +#!/sbin/openrc-run +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/softflowd/files/softflowd.initd,v 1.2 2012/03/21 07:52:49 robbat2 Exp $ + +depend() { + need net +} + +softflowd_checkconfig() { + SOFTFLOWD_INTERFACE=${SVCNAME#*.} + if [ ${SOFTFLOWD_INTERFACE} = ${SVCNAME} ]; then + eerror "You have to create an init script for each interface:" + eerror "ln -s softflowd /etc/init.d/softflowd.eth0" + return 1 + fi + + if [ -z "${SOFTFLOWD_COLLECTOR}" ]; then + eerror "Specify the host and port that the accounting datagrams are to be" + eerror "sent to in /etc/conf.d/${SVCNAME}." + eerror "Example: SOFTFLOWD_COLLECTOR=collector.example.com:9995" + return 1 + fi + SOFTFLOWD_PIDFILE="/var/run/softflowd.${SOFTFLOWD_INTERFACE}.pid" + SOFTFLOWD_CTLFILE="/var/run/softflowd.${SOFTFLOWD_INTERFACE}.ctl" +} + + +start() { + softflowd_checkconfig || return 1 + + ebegin "Starting softflowd on interface ${SOFTFLOWD_INTERFACE}" + iface_arg=${SOFTFLOWD_INTERFACE} + [ -n "${SOFTFLOWD_INTERFACE_IDX}" ] && iface_arg="${SOFTFLOWD_INTERFACE_IDX}:${iface_arg}" + start-stop-daemon --start \ + --exec /usr/sbin/softflowd \ + -- -i "${iface_arg}" \ + -n "${SOFTFLOWD_COLLECTOR}" \ + -p "${SOFTFLOWD_PIDFILE}" \ + -c "${SOFTFLOWD_CTLFILE}" \ + -t "${SOFTFLOWD_TIMEOUTS-maxlife=600}" \ + -m "${SOFTFLOWD_MAXFLOWS-17000}" \ + ${SOFTFLOWD_EXTRA} + eend $? +} + +stop() { + softflowd_checkconfig || return 1 + + ebegin "Stopping softflowd on interface ${SOFTFLOWD_INTERFACE}" + # use softflowd's own way to shut it down + /usr/sbin/softflowctl -c ${SOFTFLOWD_CTLFILE} shutdown + eend $? +} + |