summary refs log tree commit diff
path: root/pkgs/tools/misc/grub
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2010-01-07 23:45:29 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2010-01-07 23:45:29 +0000
commit8df82e27b5beca17354d4bccd854b26cee2a716f (patch)
tree12964a864cd5892856c5c5cb0c21523143f83d51 /pkgs/tools/misc/grub
parenta4473b8205a3f3c980c06e3c7210c2764f4577b8 (diff)
downloadnixlib-8df82e27b5beca17354d4bccd854b26cee2a716f.tar
nixlib-8df82e27b5beca17354d4bccd854b26cee2a716f.tar.gz
nixlib-8df82e27b5beca17354d4bccd854b26cee2a716f.tar.bz2
nixlib-8df82e27b5beca17354d4bccd854b26cee2a716f.tar.lz
nixlib-8df82e27b5beca17354d4bccd854b26cee2a716f.tar.xz
nixlib-8df82e27b5beca17354d4bccd854b26cee2a716f.tar.zst
nixlib-8df82e27b5beca17354d4bccd854b26cee2a716f.zip
* Work around an incompatibility between LVM's udev rules and GRUB 2
  (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=550704).

svn path=/nixpkgs/trunk/; revision=19304
Diffstat (limited to 'pkgs/tools/misc/grub')
-rw-r--r--pkgs/tools/misc/grub/1.9x.nix12
-rw-r--r--pkgs/tools/misc/grub/device-mapper-symlinks.patch28
2 files changed, 39 insertions, 1 deletions
diff --git a/pkgs/tools/misc/grub/1.9x.nix b/pkgs/tools/misc/grub/1.9x.nix
index 5f24aae7b05e..87235a60eea3 100644
--- a/pkgs/tools/misc/grub/1.9x.nix
+++ b/pkgs/tools/misc/grub/1.9x.nix
@@ -16,7 +16,17 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ bison ncurses libusb freetype ];
 
-  patchPhase =
+  patches =
+    [ # The udev rules for LVM create symlinks in /dev/mapper rathe
+      # than device nodes, causing GRUB to fail to recognize LVM
+      # volumes. See
+      # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=550704
+      # This ugly workaround makes `find_root_device' use stat() on
+      # files in /dev/mapper instead of lstat().
+      ./device-mapper-symlinks.patch
+    ];
+
+  postPatch =
     '' gunzip < "${unifont_bdf}" > "unifont.bdf"
        sed -i "configure" \
            -e "s|/usr/src/unifont.bdf|$PWD/unifont.bdf|g"
diff --git a/pkgs/tools/misc/grub/device-mapper-symlinks.patch b/pkgs/tools/misc/grub/device-mapper-symlinks.patch
new file mode 100644
index 000000000000..0a21a51de799
--- /dev/null
+++ b/pkgs/tools/misc/grub/device-mapper-symlinks.patch
@@ -0,0 +1,28 @@
+Only in grub-1.97.1-orig/: grub-1.97.1
+diff -rc -x '*~' grub-1.97.1-orig/util/getroot.c grub-1.97.1/util/getroot.c
+*** grub-1.97.1-orig/util/getroot.c	2009-11-09 16:48:16.000000000 +0100
+--- grub-1.97.1/util/getroot.c	2010-01-08 00:26:12.000000000 +0100
+***************
+*** 217,224 ****
+  	continue;
+  
+        if (S_ISLNK (st.st_mode))
+! 	/* Don't follow symbolic links.  */
+! 	continue;
+  
+        if (S_ISDIR (st.st_mode))
+  	{
+--- 217,229 ----
+  	continue;
+  
+        if (S_ISLNK (st.st_mode))
+!         {
+!           if (strcmp(dir, "mapper") != 0)
+!             /* Don't follow symbolic links.  */
+!             continue;
+!           if (stat (ent->d_name, &st) < 0)
+!             continue;
+!         }
+  
+        if (S_ISDIR (st.st_mode))
+  	{