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