# Contributor: Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=vnstat
pkgver=1.18
pkgrel=0
pkgdesc="Console-based network traffic monitor"
url="http://humdi.net/vnstat"
arch="all"
license="GPL-2.0-or-later"
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
	make
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install

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

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

sha512sums="4f9f08a57586bc57ede3d66802ee977c69b5f76ab42aa36e942e8d827dfce806dfc04916646fac01f57b026742a639fc5f7395b141a1c03ad11a1f977d02aa68  vnstat-1.18.tar.gz
cc3183b8d42eff1e0a876420612dd8892ba5ac10810e7de7ca1076eb5e5867145a0d7e605773f39157e91da29aa68ae5c350d120f60292578fcaba44603b2b92  vnstatd.initd
d645817913d5b52e928561b3d6a0e869d8ae5db81b97af91c1ebfc6a8cd2df666c1653e6dc5f91c0a890033a89692f77eaf081c1cae5590446c69a70ea263946  vnstatd.confd"
