mdadm: use shared system-sendmail

This commit is contained in:
Léo Gaspard 2018-10-27 18:34:56 +09:00
parent 50bb0afa7c
commit b074a40f74

View File

@ -1,18 +1,5 @@
{ stdenv, writeScript { stdenv, writeScript, fetchurl, groff, system-sendmail }:
, fetchurl, groff
}:
let
sendmail-script = writeScript "sendmail-script" ''
#!/bin/sh
if [ -x /run/wrappers/bin/sendmail ]; then
/run/wrappers/bin/sendmail "$@"
else
/run/current-system/sw/bin/sendmail "$@"
fi
'';
in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "mdadm-4.1"; name = "mdadm-4.1";
@ -23,7 +10,7 @@ stdenv.mkDerivation rec {
# This is to avoid self-references, which causes the initrd to explode # This is to avoid self-references, which causes the initrd to explode
# in size and in turn prevents mdraid systems from booting. # in size and in turn prevents mdraid systems from booting.
allowedReferences = [ stdenv.cc.libc.out sendmail-script ]; allowedReferences = [ stdenv.cc.libc.out system-sendmail ];
patches = [ ./no-self-references.patch ]; patches = [ ./no-self-references.patch ];
@ -40,7 +27,7 @@ stdenv.mkDerivation rec {
preConfigure = '' preConfigure = ''
sed -e 's@/lib/udev@''${out}/lib/udev@' \ sed -e 's@/lib/udev@''${out}/lib/udev@' \
-e 's@ -Werror @ @' \ -e 's@ -Werror @ @' \
-e 's@/usr/sbin/sendmail@${sendmail-script}@' -i Makefile -e 's@/usr/sbin/sendmail@${system-sendmail}@' -i Makefile
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {