rpms/grub/devel grub-0.97-dmraid.patch, NONE, 1.1 grub.spec, 1.32, 1.33

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri Jan 13 21:47:28 UTC 2006


Author: pjones

Update of /cvs/dist/rpms/grub/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv25391

Modified Files:
	grub.spec 
Added Files:
	grub-0.97-dmraid.patch 
Log Message:
- add dmraid support


grub-0.97-dmraid.patch:
 grub-install.in |   61 ++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 55 insertions(+), 6 deletions(-)

--- NEW FILE grub-0.97-dmraid.patch ---
--- grub-0.97/util/grub-install.in.dmraid	2006-01-13 16:40:24.000000000 -0500
+++ grub-0.97/util/grub-install.in	2006-01-13 16:40:37.000000000 -0500
@@ -101,17 +101,24 @@
     # Break the device name into the disk part and the partition part.
     case "$host_os" in
     linux*)
-	tmp_disk=`echo "$1" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
+	tmp_disk=`echo "$1" | grep -v '/mapper/control$' |
+		grep -v '/mapper/[[:alnum:]]\+-[[:alnum:]]\+$' | uniq |
+		sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
 				  -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \
 				  -e 's%\(fd[0-9]*\)$%\1%' \
 				  -e 's%/part[0-9]*$%/disc%' \
-				  -e 's%\(c[0-7]d[0-9]*\).*$%\1%'`
-	tmp_part=`echo "$1" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' \
+				  -e 's%\(c[0-7]d[0-9]*\).*$%\1%' \
+	  -e 's%\(/mapper/[[:alpha:]]\+_[[:alpha:]]\+\)[[:digit:]]\+$%\1%'`
+	tmp_part=`echo "$1" | grep -v '/mapper/control$' |
+		grep -v '/mapper/[[:alnum:]]\+-[[:alnum:]]\+$' | uniq |
+		sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' \
 				  -e 's%.*d[0-9]*p%%' \
 				  -e 's%.*/fd[0-9]*$%%' \
 				  -e 's%.*/floppy/[0-9]*$%%' \
 				  -e 's%.*/\(disc\|part\([0-9]*\)\)$%\2%' \
-				  -e 's%.*c[0-7]d[0-9]*p%%'`
+				  -e 's%.*c[0-7]d[0-9]*p%%' \
+	  -e 's%.*/mapper/[[:alpha:]]\+_[[:alpha:]]\+\([[:digit:]]\+\)$%\1%' |
+		grep -v '.*/mapper/.*'`
 	;;
     gnu*)
 	tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'`
@@ -253,6 +260,43 @@
     return 0
 }
 
+# Usage: stat_device file
+# Find major:minor of a device node.
+stat_device() {
+    majmin=`stat -c "%t:%T" "$1" 2>/dev/null`
+    if test -z "$majmin"; then
+	echo "Could not find device for $1" 2>&1
+	exit 1
+    fi
+
+    echo "$majmin"
+}
+
+# Usage: find_mapper_device file
+# Find a file in /dev/mapper with the same major:minor as the specified node.
+find_mapper_device() {
+    if [ -b "$1" ]; then
+	dev="$1"
+    else
+	mntpnt=`echo "$1" | sed 's,/,\\\\/,g'`
+	dev=`awk '($2 ~ /'$mntpnt'/) { print $1 }' /etc/mtab`
+    fi
+    if test -z "$dev"; then
+	echo "Could not find device for $1" 2>&1
+	exit 1
+    fi
+	
+    majmin=`stat_device $dev`
+    for x in /dev/mapper/* ; do
+	devmajmin=`stat_device "$x"`
+	if [ "$majmin" == "$devmajmin" ]; then
+	    echo "$x"
+	    return 0
+	fi
+    done
+    return 1
+}
+
 # Usage: find_device file
 # Find block device on which the file resides.
 find_device () {
@@ -265,9 +309,14 @@
 	exit 1
     fi
 
-    tmp_fname=`resolve_symlink $tmp_fname`
+    ret_fname=`resolve_symlink $tmp_fname`
+    tmp_fname=`find_mapper_device $ret_fname`
+    if test -n "$tmp_fname"; then
+	ret_fname="$tmp_fname"
+    fi
 
-    echo "$tmp_fname"
+    echo "$ret_fname"
+    return 0
 }
 
 copy_images() {


Index: grub.spec
===================================================================
RCS file: /cvs/dist/rpms/grub/devel/grub.spec,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- grub.spec	14 Dec 2005 22:50:23 -0000	1.32
+++ grub.spec	13 Jan 2006 21:47:22 -0000	1.33
@@ -1,6 +1,6 @@
 Name: grub
 Version: 0.97
-Release: 1
+Release: 2
 Summary: GRUB - the Grand Unified Boot Loader.
 Group: System Environment/Base
 License: GPL
@@ -93,6 +93,9 @@
 # scripts don't screw up.
 Patch1111: grub-0.97-datadir.patch
 
+# install correctly on dmraid devices
+Patch1112: grub-0.97-dmraid.patch
+
 ExclusiveArch: i386 x86_64
 BuildRequires: binutils >= 2.9.1.0.23, ncurses-devel, texinfo
 BuildRequires: automake
@@ -161,6 +164,8 @@
 
 %patch1111 -p1 -b .datadir
 
+%patch1112 -p1 -b .dmraid
+
 %build
 autoreconf --install --force
 GCCVERS=$(gcc --version | head -1 | cut -d\  -f3 | cut -d. -f1)
@@ -213,6 +218,9 @@
 %{_datadir}/grub
 
 %changelog
+* Fri Jan 13 2006 Peter Jones <pjones at redhat.com> - 0.97-2
+- add dmraid support
+
 * Wed Dec 14 2005 Peter Jones <pjones at redhat.com> - 0.97-1
 - update to grub 0.97
 




More information about the fedora-cvs-commits mailing list