1 --- grub-0.97/util/grub-install.in.dmraid 2006-01-13 16:40:24.000000000 -0500
2 +++ grub-0.97/util/grub-install.in 2006-01-13 16:40:37.000000000 -0500
4 # Break the device name into the disk part and the partition part.
7 - tmp_disk=`echo "$1" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
8 + tmp_disk=`echo "$1" | grep -v '/mapper/control$' |
9 + grep -v '/mapper/[[:alnum:]]\+-[[:alnum:]]\+$' | uniq |
10 + sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
11 -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \
12 -e 's%\(fd[0-9]*\)$%\1%' \
13 -e 's%/part[0-9]*$%/disc%' \
14 - -e 's%\(c[0-7]d[0-9]*\).*$%\1%'`
15 - tmp_part=`echo "$1" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' \
16 + -e 's%\(c[0-7]d[0-9]*\).*$%\1%' \
17 + -e 's%\(/mapper/[[:alpha:]]\+_[[:alpha:]]\+\)[[:digit:]]\+$%\1%'`
18 + tmp_part=`echo "$1" | grep -v '/mapper/control$' |
19 + grep -v '/mapper/[[:alnum:]]\+-[[:alnum:]]\+$' | uniq |
20 + sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' \
22 -e 's%.*/fd[0-9]*$%%' \
23 -e 's%.*/floppy/[0-9]*$%%' \
24 -e 's%.*/\(disc\|part\([0-9]*\)\)$%\2%' \
25 - -e 's%.*c[0-7]d[0-9]*p%%'`
26 + -e 's%.*c[0-7]d[0-9]*p%%' \
27 + -e 's%.*/mapper/[[:alpha:]]\+_[[:alpha:]]\+\([[:digit:]]\+\)$%\1%' |
28 + grep -v '.*/mapper/.*'`
31 tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'`
36 +# Usage: stat_device file
37 +# Find major:minor of a device node.
39 + majmin=`stat -c "%t:%T" "$1" 2>/dev/null`
40 + if test -z "$majmin"; then
41 + echo "Could not find device for $1" 2>&1
48 +# Usage: find_mapper_device file
49 +# Find a file in /dev/mapper with the same major:minor as the specified node.
50 +find_mapper_device() {
51 + if [ -b "$1" ]; then
54 + mntpnt=`echo "$1" | sed 's,/,\\\\/,g'`
55 + dev=`awk '($2 ~ /'$mntpnt'/) { print $1 }' /etc/mtab`
57 + if test -z "$dev"; then
58 + echo "Could not find device for $1" 2>&1
62 + majmin=`stat_device $dev`
63 + for x in /dev/mapper/* ; do
64 + devmajmin=`stat_device "$x"`
65 + if [ "$majmin" == "$devmajmin" ]; then
73 # Usage: find_device file
74 # Find block device on which the file resides.
80 - tmp_fname=`resolve_symlink $tmp_fname`
81 + ret_fname=`resolve_symlink $tmp_fname`
82 + tmp_fname=`find_mapper_device $ret_fname`
83 + if test -n "$tmp_fname"; then
84 + ret_fname="$tmp_fname"