# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=fprobe
pkgver=1.1
pkgrel=7
pkgdesc="libpcap-based tool that collect network traffic"
url="http://fprobe.sourceforge.net/"
arch="all"
license="GPL"
depends=
makedepends="libpcap-dev"
install=""
subpackages="$pkgname-doc"
source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.bz2
	fprobe-1.1-pidfile-sanity.patch
	fprobe-1.1-setgroups.patch
	$pkgname.initd
	$pkgname.confd"

_builddir="$srcdir"/$pkgname-$pkgver

prepare() {
	cd $_builddir
	update_config_sub || return 1
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		|| return 1
	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="65850d0470078269b33eee58cba77ac2  fprobe-1.1.tar.bz2
265c9d9c434df46fc224a1ce7051e27a  fprobe-1.1-pidfile-sanity.patch
ba8632d883fb49e83ea16db67c50a69b  fprobe-1.1-setgroups.patch
61b943e2114609d272759809ecc1feaa  fprobe.initd
ba9c9327456e4db897b60481705df282  fprobe.confd"
sha256sums="3a1cedf5e7b0d36c648aa90914fa71a158c6743ecf74a38f4850afbac57d22a0  fprobe-1.1.tar.bz2
e55dd0810b4311f507b498f2da31934e8989e244c7a013a126c67fc1681d453f  fprobe-1.1-pidfile-sanity.patch
24047a7bdf60c78b4e290e3e6e36b5a2f3b3adedd3138ae8cd243f6c350028f4  fprobe-1.1-setgroups.patch
97e76079ab51ad86bcb7907dac26957a5419bac716d80f3fc9730b9764d46bcf  fprobe.initd
b43b07e971fccad26f3caee9e7ee929aae29a2094b723d5a8d970b051f44d4a1  fprobe.confd"
sha512sums="35fa4bedf2c615093b6637630322115e12f005bc43186b86c55c6bdc76ae5308dd31e1d05632e26e07a30fba88d76b9acc98632bee4f372edcf9df5da3e32210  fprobe-1.1.tar.bz2
429d863547901564abfbd4e9629213f517797a98024c78394f9e89242cf06fba640b3c969e9ef58361a51c2ce0b82e0d79759e92634e31ec51c7016351cb8770  fprobe-1.1-pidfile-sanity.patch
6433b39d6612581b393064385aa206313a2a359d2373fffb64463b748392eb64c69737d4dec55cdfa51a21c1c01f1a123fdddb344cd9faed23c79d64cad00dcb  fprobe-1.1-setgroups.patch
f934b0ffe79e2a9429ff6fe4505e9ee77a4a736765dfba1be29ba79d81535f77c54a01acd360c5ea873fe85ddd7e4fa56cb2db1fc8a48f978d10dc864e4ee14a  fprobe.initd
fd6e7cfc50d3962ab41f0109f87690b50d7b2852d5f613117421747c4451589f625a3a3a4405e20a57c2d56ef8a4c8659942564c02862e8906b5b75f56972bed  fprobe.confd"
