about summary refs log tree commit diff
path: root/pkgs/os-specific/linux/util-linux
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2008-08-06 15:27:50 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2008-08-06 15:27:50 +0000
commit0a884b25f9f6825d5cadc8ef0cae5319687f5ed5 (patch)
tree7092a7327b6c8c25af699559a63a8effcdbf5594 /pkgs/os-specific/linux/util-linux
parent63b9500b882d06fbaa9d31a72e0c9117c3e55f63 (diff)
downloadnixlib-0a884b25f9f6825d5cadc8ef0cae5319687f5ed5.tar
nixlib-0a884b25f9f6825d5cadc8ef0cae5319687f5ed5.tar.gz
nixlib-0a884b25f9f6825d5cadc8ef0cae5319687f5ed5.tar.bz2
nixlib-0a884b25f9f6825d5cadc8ef0cae5319687f5ed5.tar.lz
nixlib-0a884b25f9f6825d5cadc8ef0cae5319687f5ed5.tar.xz
nixlib-0a884b25f9f6825d5cadc8ef0cae5319687f5ed5.tar.zst
nixlib-0a884b25f9f6825d5cadc8ef0cae5319687f5ed5.zip
* util-linux: added an option to build just mount/umount, and an
  option to set the path to the mount helpers programs
  (mount.<fstype>) to something other than /sbin.  Needed in NixOS to
  get the mount command to work for NTFS-3G, CIFS, etc.

svn path=/nixpkgs/trunk/; revision=12514
Diffstat (limited to 'pkgs/os-specific/linux/util-linux')
-rw-r--r--pkgs/os-specific/linux/util-linux/default.nix32
1 files changed, 29 insertions, 3 deletions
diff --git a/pkgs/os-specific/linux/util-linux/default.nix b/pkgs/os-specific/linux/util-linux/default.nix
index 8aed357d54cd..d9fd0028c799 100644
--- a/pkgs/os-specific/linux/util-linux/default.nix
+++ b/pkgs/os-specific/linux/util-linux/default.nix
@@ -1,7 +1,15 @@
-{stdenv, fetchurl, ncurses ? null}:
+{ 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
+}:
 
 stdenv.mkDerivation {
-  name = "util-linux-2.13-pre7";
+  name = (if buildMountOnly then "mount-" else "") + "util-linux-2.13-pre7";
 
   src = fetchurl {
     url = mirror://kernel/linux/utils/util-linux/testing/util-linux-2.13-pre7.tar.bz2;
@@ -21,10 +29,28 @@ stdenv.mkDerivation {
 
   buildInputs = stdenv.lib.optional (ncurses != null) ncurses;
 
-  preBuild = ''
+  inherit mountHelpers;
+
+  preConfigure = ''
     makeFlagsArray=(usrbinexecdir=$out/bin usrsbinexecdir=$out/sbin datadir=$out/share exampledir=$out/share/getopt)
+    if test -n "$mountHelpers"; then
+      substituteInPlace mount/mount.c --replace /sbin/mount. $mountHelpers/mount.
+      substituteInPlace mount/umount.c --replace /sbin/umount. $mountHelpers/umount.
+    fi
   '';
 
+  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 "";
+
   # Hack to get static builds to work.
   NIX_CFLAGS_COMPILE = "-DHAVE___PROGNAME=1"; 
 }