Skip to content

Commit

Permalink
util-linux: fixup setuid/setgid build problems
Browse files Browse the repository at this point in the history
... hopefully.  Also refactor some nix code a little.
  • Loading branch information
vcunat committed Jun 7, 2017

Verified

This commit was signed with the committer’s verified signature.
vcunat Vladimír Čunát
1 parent 833bc78 commit 1aac1fe
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions pkgs/os-specific/linux/util-linux/default.nix
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 1aac1fe

Please sign in to comment.