Another fix for grub-install for virtio
[people/pmueller/ipfire-2.x.git] / src / patches / grub-0.97_grub-install_virtio.patch
1 diff -Naur grub-0.97.org/util/grub-install.in grub-0.97/util/grub-install.in
2 --- grub-0.97.org/util/grub-install.in 2004-07-24 20:57:31.000000000 +0200
3 +++ grub-0.97/util/grub-install.in 2009-08-14 20:01:20.000000000 +0200
4 @@ -96,12 +96,12 @@
5 # Break the device name into the disk part and the partition part.
6 case "$host_os" in
7 linux*)
8 - tmp_disk=`echo "$1" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
9 + tmp_disk=`echo "$1" | sed -e 's%\([vsh]d[a-z]\)[0-9]*$%\1%' \
10 -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \
11 -e 's%\(fd[0-9]*\)$%\1%' \
12 -e 's%/part[0-9]*$%/disc%' \
13 -e 's%\(c[0-7]d[0-9]*\).*$%\1%'`
14 - tmp_part=`echo "$1" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' \
15 + tmp_part=`echo "$1" | sed -e 's%.*/[vsh]d[a-z]\([0-9]*\)$%\1%' \
16 -e 's%.*d[0-9]*p%%' \
17 -e 's%.*/fd[0-9]*$%%' \
18 -e 's%.*/floppy/[0-9]*$%%' \
19 @@ -333,6 +333,10 @@
20 if test -f "$device_map"; then
21 :
22 else
23 +
24 + tmp_disk=`echo "$install_device" | grep "/dev/vd"`
25 + if test "x$tmp_disk" = x; then
26 +
27 # Create a safe temporary file.
28 test -n "$mklog" && log_file=`$mklog`
29
30 @@ -345,6 +349,11 @@
31 fi
32
33 rm -f $log_file
34 +
35 + else
36 + echo "Create fake device.map for vitio device $1" 1>&2
37 + echo "(hd0) $install_device" > $device_map
38 + fi
39 fi
40
41 # Make sure that there is no duplicated entry.