# Template file for 'apcupsd'
pkgname=apcupsd
version=3.14.14
revision=2
build_style=gnu-configure
configure_args="
 --disable-install-distdir
 --enable-modbus-usb
 --enable-usb
 --sysconfdir=/etc/apcupsd
 --with-dev=
 --with-halpolicydir=
 --with-pwrfail-dir=/etc/apcupsd
 --with-upscable=usb
 --with-upstype=usb"
hostmakedepends="autoconf automake pkg-config"
makedepends="libusb-compat-devel net-snmp-devel"
depends="libusb-compat net-snmp nullmailer"
conf_files="/etc/apcupsd/*"
short_desc="APC UPS daemon with integrated tcp/ip remote shutdown"
maintainer="Bas Ploeger <s.c.w.ploeger@gmail.com>"
license="GPL-2.0-only"
homepage="http://www.apcupsd.org/"
distfiles="${SOURCEFORGE_SITE}/apcupsd/apcupsd-${version}.tar.gz"
checksum="db7748559b6b4c3784f9856561ef6ac6199ef7bd019b3edcd7e0a647bf8f9867"

# Avoid passing an invalid arg 'strip' to the install command for the binaries.
make_install_args="STRIP="

pre_configure() {
	export SHUTDOWN=/usr/bin/shutdown
	export WALL=/usr/bin/wall
	export APCUPSD_MAIL=/usr/bin/mail
}

post_install() {
	# This binary is not needed and conflicts with a binary from an other package.
	rm ${DESTDIR}/usr/bin/smtp
	vsv apcupsd
	vinstall ${FILESDIR}/apcupsd-powerfail.sh 644 etc/runit/shutdown.d 89-apcupsd-powerfail.sh
}
