# Contributor: Leonardo Arena <rnalrd@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=ipvsadm
pkgver=1.29
pkgrel=0
pkgdesc="The IP Virtual Server administration utility"
url="http://www.linuxvirtualserver.org/software/ipvs.html"
arch="all"
license="GPL-2.0"
depends=
depends_dev="libnl-dev popt-dev"
makedepends="$depends_dev linux-headers"
install=
subpackages="$pkgname-doc"
source="https://kernel.org/pub/linux/utils/kernel/ipvsadm/$pkgname-$pkgver.tar.xz
	$pkgname.initd"

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

build() {
	cd "$builddir"
	make libs && make BUILD_ROOT="$pkgdir" \
		MANDIR=usr/share/man \
		SBIN="$pkgdir/usr/sbin" \
		INIT="$pkgdir/etc/init.d" \
		|| return 1
}

package() {
	cd "$builddir"
	make -j1 BUILD_ROOT="$pkgdir" \
		MANDIR=usr/share/man \
		SBIN="$pkgdir/usr/sbin" \
		INIT="$pkgdir/etc/init.d" \
		install

	# remove the 2 lines below (and this) if there is no init.d script
	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	# install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}

md5sums="12f0d3b4d436e941d0c4dbe358144bfd  ipvsadm-1.29.tar.xz
bebb015ea02ead2a84be2bd5af4eb74c  ipvsadm.initd"
sha256sums="c3de4a21d90a02c621f0c72ee36a7aa27374b6f29fd4178f33fbf71b4c66c149  ipvsadm-1.29.tar.xz
d18d70c39d5dff6325b7e21fbd61485384b642b15a0dfee935ec9b7d4b9f0b66  ipvsadm.initd"
sha512sums="1fcb5acad6be3a97efc57f594062ad2cd84632f17bd8abbe444fb989ebbb307337a854f3635a695665d7b72039c547946c3931dca61ae1cae9c6ef78b6ba8e8b  ipvsadm-1.29.tar.xz
43b2186f48f17d43524c1f4e9de06227c6d491845c466cf6f00214b74fcd5e181e8b855fef8c6fa78c62a924ee3cc3317099278f9656183de8678440bb070625  ipvsadm.initd"
