util-linux: fixup setuid/setgid build problems

... hopefully.  Also refactor some nix code a little.
This commit is contained in:
Vladimír Čunát 2017-06-07 15:17:40 +02:00
parent 833bc78dcf
commit 1aac1fe5dd
No known key found for this signature in database
GPG key ID: E747DF1F9575A3AA

View file

@ -30,30 +30,29 @@ stdenv.mkDerivation rec {
};
preConfigure = lib.optionalString (systemd != null) ''
configureFlags+="--with-systemd --with-systemdsystemunitdir=$bin/lib/systemd/system/"
configureFlags+=" --with-systemd --with-systemdsystemunitdir=$bin/lib/systemd/system/"
'';
# !!! It would be better to obtain the path to the mount helpers
# (/sbin/mount.*) through an environment variable, but that's
# somewhat risky because we have to consider that mount can setuid
# root...
configureFlags = ''
--enable-write
--enable-last
--enable-mesg
--disable-use-tty-group
--enable-fs-paths-default=/run/wrappers/bin:/var/run/current-system/sw/bin:/sbin
${if ncurses == null then "--without-ncurses" else ""}
'';
configureFlags = [
"--enable-write"
"--enable-last"
"--enable-mesg"
"--disable-use-tty-group"
"--enable-fs-paths-default=/run/wrappers/bin:/var/run/current-system/sw/bin:/sbin"
"--disable-makeinstall-setuid" "--disable-makeinstall-chown"
]
++ lib.optional (ncurses == null) "--without-ncurses";
makeFlags = "usrbin_execdir=$(bin)/bin usrsbin_execdir=$(bin)/sbin";
nativeBuildInputs = [ pkgconfig ];
buildInputs =
[ zlib pam ]
++ lib.optional (ncurses != null) ncurses
++ lib.optional (systemd != null) systemd
++ lib.optional (perl != null) perl;
++ lib.filter (p: p != null) [ ncurses systemd perl ];
postInstall = ''
rm "$bin/bin/su" # su should be supplied by the su package (shadow)