# Template file for 'network-ups-tools'
pkgname=network-ups-tools
version=2.7.3
revision=2
wrksrc="nut-${version}"
build_style=gnu-configure
configure_args="
 --sysconfdir=/etc/ups --without-doc --disable-static
 --datadir=/usr/share/ups --with-user=nut --with-group=nut --with-ssl
 --with-usb --without-dev --with-serial -with-avahi --with-udev-dir=/usr/lib/udev
 --without-libltdl --without-ipmi --without-freeipmi --without-systemdsystemunitdir
 --with-snmp"
hostmakedepends="pkg-config"
makedepends="avahi-libs-devel libressl-devel libusb-compat-devel neon-devel
 net-snmp-devel"
system_accounts="nut"
conf_files="
	/etc/ups/ups.conf
	/etc/ups/upsd.users
	/etc/ups/upsmon.conf
	/etc/ups/upsd.conf
	/etc/ups/upssched.conf
	/etc/ups/nut.conf"
short_desc="UPS control and monitoring features"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-2"
homepage="http://www.networkupstools.org/"
distfiles="${homepage}source/${version%.*}/nut-${version}.tar.gz"
checksum=ff44d95d06a51559a0a018eef7f8d17911c1002b6352a7d7580ff75acb12126b

post_install() {
	# remove unused stuff
	rm -rf ${DESTDIR}/usr/{html,cgi-bin}
	# Prepare configuration files
	for f in ups upsd upsmon upssched nut; do
		mv ${DESTDIR}/etc/ups/${f}.conf{.sample,}
	done
	mv ${DESTDIR}/etc/ups/upsd.users{.sample,}

	# runit services
	vsv upsd
	vsv upsmon
	vsv upsdrvctl
}

libnetwork-ups-tools_package() {
	short_desc+=" - runtime library"
	pkg_install() {
		vmove "usr/lib/*.so.*"
	}
}
network-ups-tools-devel_package() {
	short_desc+=" - development files"
	depends="lib${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove "usr/lib/*.so"
	}
}
