# Contributor: Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=vnstat
pkgver=1.17
pkgrel=0
pkgdesc="A console-based network traffic monitor"
url="http://humdi.net/vnstat/"
arch="all"
license="GPL"
install="$pkgname.pre-install"
makedepends="gd-dev"
subpackages="$pkgname-doc"
source="http://humdi.net/vnstat/$pkgname-$pkgver.tar.gz
	vnstatd.initd
	vnstatd.confd"
builddir="$srcdir/vnstat-$pkgver"

build() {
	cd "$builddir"
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		|| return 1
	make || return 1
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install || return 1

	install -D -m0755 "$srcdir"/vnstatd.initd \
		"$pkgdir"/etc/init.d/vnstatd || return 1
	install -D -m0644 "$srcdir"/vnstatd.confd \
		"$pkgdir"/etc/conf.d/vnstatd || return 1

	install -D -m0755 examples/vnstat.cgi \
		"$pkgdir"/usr/share/doc/vnstat/examples/vnstat.cgi || return 1
}

sha512sums="c9c119a89054dacdc15026c766a20d88336d7689dd4264530d0347fcc58f3cbfc806b271e0f83e76c3b4a31ab793a628ee7d7b696943da919ee4cd2fdb481cc3  vnstat-1.17.tar.gz
cc3183b8d42eff1e0a876420612dd8892ba5ac10810e7de7ca1076eb5e5867145a0d7e605773f39157e91da29aa68ae5c350d120f60292578fcaba44603b2b92  vnstatd.initd
d645817913d5b52e928561b3d6a0e869d8ae5db81b97af91c1ebfc6a8cd2df666c1653e6dc5f91c0a890033a89692f77eaf081c1cae5590446c69a70ea263946  vnstatd.confd"
