Merge pull request #233031 from dominikh/nut-2.8.0
nut: update forgotten FOD, various cleanups
This commit is contained in:
commit
72c631b01c
@ -1,5 +1,23 @@
|
||||
{ lib, stdenv, fetchurl, substituteAll, pkg-config, neon, libusb-compat-0_1, openssl, udev, avahi, freeipmi
|
||||
, libtool, makeWrapper, autoreconfHook, fetchpatch
|
||||
{ lib
|
||||
, stdenv
|
||||
, autoreconfHook
|
||||
, avahi
|
||||
, coreutils
|
||||
, fetchurl
|
||||
, freeipmi
|
||||
, gd
|
||||
, i2c-tools
|
||||
, libmodbus
|
||||
, libtool
|
||||
, libusb1
|
||||
, makeWrapper
|
||||
, neon
|
||||
, net-snmp
|
||||
, openssl
|
||||
, pkg-config
|
||||
, substituteAll
|
||||
, systemd
|
||||
, udev
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
@ -8,42 +26,50 @@ stdenv.mkDerivation rec {
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://networkupstools.org/source/${lib.versions.majorMinor version}/${pname}-${version}.tar.gz";
|
||||
sha256 = "19r5dm07sfz495ckcgbfy0pasx0zy3faa0q7bih69lsjij8q43lq";
|
||||
sha256 = "sha256-w+WnCNp5e3xwtlPTexIGoAD8tQO4VRn+TN9jU/eSv+U=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
# Fix build with openssl >= 1.1.0
|
||||
url = "https://github.com/networkupstools/nut/commit/612c05efb3c3b243da603a3a050993281888b6e3.patch";
|
||||
sha256 = "0jdbii1z5sqyv24286j5px65j7b3gp8zk3ahbph83pig6g46m3hs";
|
||||
})
|
||||
(substituteAll {
|
||||
src = ./hardcode-paths.patch;
|
||||
avahi = "${avahi}/lib";
|
||||
freeipmi = "${freeipmi}/lib";
|
||||
libusb = "${libusb-compat-0_1}/lib";
|
||||
libusb = "${libusb1}/lib";
|
||||
neon = "${neon}/lib";
|
||||
libmodbus = "${libmodbus}/lib";
|
||||
netsnmp = "${net-snmp.lib}/lib";
|
||||
})
|
||||
];
|
||||
|
||||
buildInputs = [ neon libusb-compat-0_1 openssl udev avahi freeipmi ];
|
||||
buildInputs = [ neon libusb1 openssl udev avahi freeipmi libmodbus i2c-tools net-snmp gd ];
|
||||
|
||||
nativeBuildInputs = [ autoreconfHook libtool pkg-config makeWrapper ];
|
||||
|
||||
configureFlags =
|
||||
[ "--with-all"
|
||||
"--with-ssl"
|
||||
"--without-snmp" # Until we have it ...
|
||||
"--without-powerman" # Until we have it ...
|
||||
"--without-cgi"
|
||||
"--without-hal"
|
||||
"--with-systemdsystemunitdir=$(out)/etc/systemd/system"
|
||||
"--with-systemdsystemunitdir=$(out)/lib/systemd/system"
|
||||
"--with-systemdshutdowndir=$(out)/lib/systemd/system-shutdown"
|
||||
"--with-systemdtmpfilesdir=$(out)/lib/tmpfiles.d"
|
||||
"--with-udev-dir=$(out)/etc/udev"
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = toString [ "-std=c++14" ];
|
||||
postInstall = ''
|
||||
substituteInPlace $out/lib/systemd/system-shutdown/nutshutdown \
|
||||
--replace /bin/sleep "${coreutils}/bin/sleep" \
|
||||
--replace /bin/systemctl "${systemd}/bin/systemctl"
|
||||
|
||||
for file in system/{nut-monitor.service,nut-driver-enumerator.service,nut-server.service,nut-driver@.service} system-shutdown/nutshutdown; do
|
||||
substituteInPlace $out/lib/systemd/$file \
|
||||
--replace "$out/etc/nut.conf" "/etc/nut.conf"
|
||||
done
|
||||
|
||||
# we don't need init.d scripts
|
||||
rm -r $out/share/solaris-init
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Network UPS Tools";
|
||||
|
@ -1,13 +1,15 @@
|
||||
--- a/tools/nut-scanner/nutscan-init.c
|
||||
+++ b/tools/nut-scanner/nutscan-init.c
|
||||
@@ -44,6 +44,10 @@ int nutscan_load_upsclient_library(const char *libname_path);
|
||||
|
||||
/* FIXME: would be good to get more from /etc/ld.so.conf[.d] */
|
||||
char * search_paths[] = {
|
||||
--- a/common/common.c
|
||||
+++ b/common/common.c
|
||||
@@ -991,6 +991,12 @@ ssize_t select_write(const int fd, const void *buf, const size_t buflen, const t
|
||||
* communications media and/or vendor protocol.
|
||||
*/
|
||||
static const char * search_paths[] = {
|
||||
+ "@avahi@",
|
||||
+ "@freeipmi@",
|
||||
+ "@libusb@",
|
||||
+ "@neon@",
|
||||
+ "@libmodbus@",
|
||||
+ "@netsnmp@",
|
||||
/* Use the library path (and bitness) provided during ./configure first */
|
||||
LIBDIR,
|
||||
"/usr/lib64",
|
||||
"/lib64",
|
||||
"/usr"LIBDIR,
|
||||
|
Loading…
Reference in New Issue
Block a user