# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=pingu
pkgver=1.5.1
pkgrel=0
pkgdesc="Small daemon that pings hosts and executes a script when status change"
url="https://github.com/ncopa/pingu"
arch="all"
license="GPL"
makedepends="libev-dev lua-dev asciidoc linux-headers"
subpackages="$pkgname-doc $pkgname-openrc lua-pingu:_lua mtu"
options="!check"
source="pingu-$pkgver.tar.gz::https://github.com/ncopa/pingu/archive/v$pkgver.tar.gz
	pingu.initd
	"

build() {
	./configure \
		--prefix=/usr \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--with-luapc=lua
	make
}

package() {
	make DESTDIR="$pkgdir" install
	install -m644 -D pingu.conf "$pkgdir"/etc/pingu/pingu.conf
	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

mtu() {
	pkgdesc="Utility to detect MTU"
	amove usr/bin
}

_lua() {
	pkgdesc="lua module for pingu client"
	amove usr/lib usr/share
}

sha512sums="
1ec50ad5a1cb7318dc6ffb8ab8454f85dda9d31ea13503eaf001109b7255b6e93e165769e9b3c7fd95f2449f079e107f81a974b148b6f00f50f13ee8124d92fb  pingu-1.5.1.tar.gz
b8df9b7bec561e234a2f74514a3513ceac222477f28b9306f40aed6398f65b4e2ce84dfbbf95c0ffaedd526c4283739bf88248d699bbf7d9dac7e27e5cc5a62b  pingu.initd
"
