2013-07-17 01:53:30 +02:00
|
|
|
{ stdenv, fetchurl, pkgconfig, systemd, utillinux, coreutils, nettools, man
|
|
|
|
, enableCgiScripts ? true, gd
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "apcupsd";
|
2014-02-13 22:52:29 +01:00
|
|
|
name = "${pname}-3.14.11";
|
2013-07-17 01:53:30 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2013-07-17 21:10:56 +02:00
|
|
|
url = "mirror://sourceforge/${pname}/${name}.tar.gz";
|
2014-02-13 22:52:29 +01:00
|
|
|
sha256 = "0wrb8vdc872f1x0gw21b5c81h0vxvsc7yks5qzbq2j3hkbl2vixd";
|
2013-07-17 01:53:30 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ pkgconfig utillinux man ] ++ stdenv.lib.optional enableCgiScripts gd;
|
|
|
|
|
|
|
|
# ./configure ignores --prefix, so we must specify some paths manually
|
|
|
|
# There is no real reason for a bin/sbin split, so just use bin.
|
|
|
|
preConfigure = ''
|
|
|
|
export ac_cv_path_SHUTDOWN=${systemd}/sbin/shutdown
|
|
|
|
export ac_cv_path_WALL=${utillinux}/bin/wall
|
|
|
|
sed -i 's|/bin/cat|${coreutils}/bin/cat|' configure
|
|
|
|
export configureFlags="\
|
|
|
|
--bindir=$out/bin \
|
|
|
|
--sbindir=$out/bin \
|
|
|
|
--sysconfdir=$out/etc/apcupsd \
|
|
|
|
--mandir=$out/share/man \
|
|
|
|
--with-halpolicydir=$out/share/halpolicy \
|
|
|
|
--localstatedir=/var/ \
|
2013-07-21 20:58:26 +02:00
|
|
|
--with-nologin=/run \
|
2013-07-17 01:53:30 +02:00
|
|
|
--with-log-dir=/var/log/apcupsd \
|
|
|
|
--with-pwrfail-dir=/run/apcupsd \
|
|
|
|
--with-lock-dir=/run/lock \
|
|
|
|
--with-pid-dir=/run \
|
|
|
|
--enable-usb \
|
|
|
|
${stdenv.lib.optionalString enableCgiScripts "--enable-cgi --with-cgi-bin=$out/libexec/cgi-bin"}
|
|
|
|
"
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
for file in "$out"/etc/apcupsd/*; do
|
|
|
|
sed -i -e 's|^WALL=.*|WALL="${utillinux}/bin/wall"|g' \
|
2013-07-20 21:36:18 +02:00
|
|
|
-e 's|^HOSTNAME=.*|HOSTNAME=`${nettools}/bin/hostname`|g' \
|
2013-07-17 01:53:30 +02:00
|
|
|
"$file"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2013-10-05 16:22:46 +02:00
|
|
|
description = "Daemon for controlling APC UPSes";
|
2013-07-17 01:53:30 +02:00
|
|
|
homepage = http://www.apcupsd.com/;
|
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ maintainers.bjornfor ];
|
|
|
|
};
|
|
|
|
}
|