summary refs log tree commit diff
path: root/pkgs/os-specific
diff options
context:
space:
mode:
authorEelco Dolstra2010-05-16 20:25:57 +0000
committerEelco Dolstra2010-05-16 20:25:57 +0000
commite367687e2982637ebc755c114c9ed90fdca1a613 (patch)
tree5ceb1adddc5f5f380591757d694885f152e297f5 /pkgs/os-specific
parent1b1e5e7d691ec5280c59e4191c0d68899e9b5323 (diff)
* mdadm: Enable incremental activation of swraid arrays from udev.
svn path=/nixpkgs/trunk/; revision=21805
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r--pkgs/os-specific/linux/mdadm/default.nix15
-rw-r--r--pkgs/os-specific/linux/mdadm/udev.patch20
2 files changed, 31 insertions, 4 deletions
diff --git a/pkgs/os-specific/linux/mdadm/default.nix b/pkgs/os-specific/linux/mdadm/default.nix
index 9de10be05536..0a80e7c8dd0c 100644
--- a/pkgs/os-specific/linux/mdadm/default.nix
+++ b/pkgs/os-specific/linux/mdadm/default.nix
@@ -1,19 +1,25 @@
-{stdenv, fetchurl, groff}:
+{ stdenv, fetchurl, groff }:
 
 stdenv.mkDerivation rec {
   name = "mdadm-3.1.2";
+  
   src = fetchurl {
     url = "mirror://kernel/linux/utils/raid/mdadm/${name}.tar.bz2";
     sha256 = "0s2d2a01j8cizxqvbgd0sn5bpa1j46q8976078b3jq1q7i1ir0zz";
   };
 
-  buildNativeInputs = [groff];
+  # Enable incremental activation of swraid arrays from udev.
+  patches = [ ./udev.patch ];
 
-  patchPhase = "sed -e 's@/lib/udev@\${out}/lib/udev@' -i Makefile";
+  buildNativeInputs = [ groff ];
 
+  preConfigure = "sed -e 's@/lib/udev@\${out}/lib/udev@' -i Makefile";
+
+  # Force mdadm to use /var/run/mdadm.map for its map file (or
+  # /dev/.mdadm/map as a fallback).
   preBuild =
     ''
-      makeFlagsArray=(INSTALL=install BINDIR=$out/sbin MANDIR=$out/share/man)
+      makeFlagsArray=(INSTALL=install BINDIR=$out/sbin MANDIR=$out/share/man VAR_RUN=/var/run/mdadm ALT_RUN=/dev/.mdadm)
       if [[ -n "$crossConfig" ]]; then
         makeFlagsArray+=(CROSS_COMPILE=$crossConfig-)
       fi
@@ -21,5 +27,6 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "Programs for managing RAID arrays under Linux";
+    homepage = http://neil.brown.name/blog/mdadm;
   };
 }
diff --git a/pkgs/os-specific/linux/mdadm/udev.patch b/pkgs/os-specific/linux/mdadm/udev.patch
new file mode 100644
index 000000000000..5eb35f0c584c
--- /dev/null
+++ b/pkgs/os-specific/linux/mdadm/udev.patch
@@ -0,0 +1,20 @@
+diff --exclude '*~' -rc mdadm-3.1.2-orig/udev-md-raid.rules mdadm-3.1.2/udev-md-raid.rules
+*** mdadm-3.1.2-orig/udev-md-raid.rules	2010-02-22 21:14:58.000000000 +0100
+--- mdadm-3.1.2/udev-md-raid.rules	2010-05-16 20:45:22.000000000 +0200
+***************
+*** 5,11 ****
+  ACTION=="change", GOTO="md_no_incr"
+  
+  # import data from a raid member and activate it
+! #ENV{ID_FS_TYPE}=="linux_raid_member", IMPORT{program}="/sbin/mdadm --examine --export $tempnode", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
+  # import data from a raid set
+  LABEL="md_no_incr"
+  KERNEL!="md*", GOTO="md_end"
+--- 5,11 ----
+  ACTION=="change", GOTO="md_no_incr"
+  
+  # import data from a raid member and activate it
+! ENV{ID_FS_TYPE}=="linux_raid_member", IMPORT{program}="/sbin/mdadm --examine --export $tempnode", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
+  # import data from a raid set
+  LABEL="md_no_incr"
+  KERNEL!="md*", GOTO="md_end"