2008-08-06 19:27:50 +04:00
|
|
|
{ stdenv, fetchurl, ncurses ? null
|
|
|
|
|
|
|
|
, # Build mount/umount only.
|
|
|
|
buildMountOnly ? false
|
|
|
|
|
|
|
|
, # A directory containing mount helpers programs
|
|
|
|
# (i.e. `mount.<fstype>') to be used instead of /sbin.
|
|
|
|
mountHelpers ? null
|
|
|
|
}:
|
2004-02-16 13:40:45 +03:00
|
|
|
|
2004-03-29 21:23:01 +04:00
|
|
|
stdenv.mkDerivation {
|
2008-08-06 19:27:50 +04:00
|
|
|
name = (if buildMountOnly then "mount-" else "") + "util-linux-2.13-pre7";
|
2006-10-30 18:14:15 +03:00
|
|
|
|
2004-02-16 13:40:45 +03:00
|
|
|
src = fetchurl {
|
2007-08-27 17:59:40 +04:00
|
|
|
url = mirror://kernel/linux/utils/util-linux/testing/util-linux-2.13-pre7.tar.bz2;
|
2006-10-30 18:14:15 +03:00
|
|
|
md5 = "13cdf4b76533e8421dc49de188f85291";
|
2004-02-16 13:40:45 +03:00
|
|
|
};
|
2008-07-24 17:48:23 +04:00
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Fix for a local root exploit via mount/umount
|
|
|
|
# (http://www.gentoo.org/security/en/glsa/glsa-200710-18.xml).
|
|
|
|
(fetchurl {
|
|
|
|
url = "http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo-x86/sys-apps/util-linux/files/util-linux-2.13-setuid-checks.patch?rev=1.1";
|
|
|
|
sha256 = "02ky7ljzqpx8ii3dfmjydw8nnhshpw2inwh6w1vqllz8mhn81jdf";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2006-10-30 18:14:15 +03:00
|
|
|
configureFlags = "--disable-use-tty-group";
|
|
|
|
|
2008-07-24 17:48:23 +04:00
|
|
|
buildInputs = stdenv.lib.optional (ncurses != null) ncurses;
|
2007-12-06 22:36:43 +03:00
|
|
|
|
2008-08-06 19:27:50 +04:00
|
|
|
inherit mountHelpers;
|
|
|
|
|
|
|
|
preConfigure = ''
|
2006-10-30 18:14:15 +03:00
|
|
|
makeFlagsArray=(usrbinexecdir=$out/bin usrsbinexecdir=$out/sbin datadir=$out/share exampledir=$out/share/getopt)
|
2008-08-06 19:27:50 +04:00
|
|
|
if test -n "$mountHelpers"; then
|
|
|
|
substituteInPlace mount/mount.c --replace /sbin/mount. $mountHelpers/mount.
|
|
|
|
substituteInPlace mount/umount.c --replace /sbin/umount. $mountHelpers/umount.
|
|
|
|
fi
|
2008-07-24 17:48:23 +04:00
|
|
|
'';
|
2006-10-31 19:21:24 +03:00
|
|
|
|
2008-08-06 19:27:50 +04:00
|
|
|
buildPhase =
|
|
|
|
if buildMountOnly then ''
|
|
|
|
make "''${makeFlagsArray[@]}" -C lib
|
|
|
|
make "''${makeFlagsArray[@]}" -C mount
|
|
|
|
'' else "";
|
|
|
|
|
|
|
|
installPhase =
|
|
|
|
if buildMountOnly then ''
|
|
|
|
make "''${makeFlagsArray[@]}" -C lib install
|
|
|
|
make "''${makeFlagsArray[@]}" -C mount install
|
|
|
|
'' else "";
|
|
|
|
|
2006-10-31 19:21:24 +03:00
|
|
|
# Hack to get static builds to work.
|
|
|
|
NIX_CFLAGS_COMPILE = "-DHAVE___PROGNAME=1";
|
2004-02-16 13:40:45 +03:00
|
|
|
}
|