2022-11-27 09:42:12 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2023-02-02 18:25:31 +00:00
|
|
|
, coreutils
|
2022-11-27 09:42:12 +00:00
|
|
|
, pkg-config
|
|
|
|
, perl
|
|
|
|
, lvm2
|
|
|
|
, libaio
|
|
|
|
, readline
|
|
|
|
, systemd
|
|
|
|
, liburcu
|
|
|
|
, json_c
|
2023-02-02 18:25:31 +00:00
|
|
|
, linuxHeaders
|
2022-11-27 09:42:12 +00:00
|
|
|
, cmocka
|
|
|
|
, nixosTests
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "multipath-tools";
|
2023-02-02 18:25:31 +00:00
|
|
|
version = "0.9.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-27 09:42:12 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "opensvc";
|
|
|
|
repo = "multipath-tools";
|
|
|
|
rev = "refs/tags/${version}";
|
2023-02-02 18:25:31 +00:00
|
|
|
sha256 = "sha256-CPvtnjzkyxKXrT8+YXaIgDA548h8X61+jCxMHKFfEyg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
2023-02-02 18:25:31 +00:00
|
|
|
substituteInPlace create-config.mk \
|
|
|
|
--replace /bin/echo ${coreutils}/bin/echo
|
2021-04-08 16:26:57 +00:00
|
|
|
|
|
|
|
substituteInPlace multipathd/multipathd.service \
|
2023-02-02 18:25:31 +00:00
|
|
|
--replace /sbin/multipathd "$out/bin/multipathd"
|
2021-04-08 16:26:57 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
sed -i -re '
|
|
|
|
s,^( *#define +DEFAULT_MULTIPATHDIR\>).*,\1 "'"$out/lib/multipath"'",
|
|
|
|
' libmultipath/defaults.h
|
|
|
|
sed -i -e 's,\$(DESTDIR)/\(usr/\)\?,$(prefix)/,g' \
|
|
|
|
kpartx/Makefile libmpathpersist/Makefile
|
2020-06-02 18:00:15 +00:00
|
|
|
sed -i -e "s,GZIP,GZ," \
|
|
|
|
$(find * -name Makefile\*)
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
nativeBuildInputs = [ pkg-config perl ];
|
2023-02-02 18:25:31 +00:00
|
|
|
buildInputs = [ systemd lvm2 libaio readline liburcu json_c linuxHeaders ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"LIB=lib"
|
|
|
|
"prefix=$(out)"
|
2023-02-02 18:25:31 +00:00
|
|
|
"systemd_prefix=$(out)"
|
|
|
|
"kernel_incdir=${linuxHeaders}/include/"
|
2020-04-24 23:36:52 +00:00
|
|
|
"man8dir=$(out)/share/man/man8"
|
|
|
|
"man5dir=$(out)/share/man/man5"
|
|
|
|
"man3dir=$(out)/share/man/man3"
|
|
|
|
];
|
|
|
|
|
2022-11-27 09:42:12 +00:00
|
|
|
doCheck = true;
|
|
|
|
preCheck = ''
|
|
|
|
# skip test attempting to access /sys/dev/block
|
|
|
|
substituteInPlace tests/Makefile --replace ' devt ' ' '
|
|
|
|
'';
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ cmocka ];
|
2022-11-27 09:42:12 +00:00
|
|
|
|
2022-01-25 03:21:06 +00:00
|
|
|
passthru.tests = { inherit (nixosTests) iscsi-multipath-root; };
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2022-11-27 09:42:12 +00:00
|
|
|
description = "Tools for the Linux multipathing storage driver";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://christophe.varoqui.free.fr/";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|