1
diff -ur grub-0.97/util/grub-install.in grub-0.97.raid/util/grub-install.in
2
--- grub-0.97/util/grub-install.in 2008-04-30 22:42:03.000000000 +0200
3
+++ grub-0.97.raid/util/grub-install.in 2008-04-30 22:46:45.000000000 +0200
8
- # Break the device name into the disk part and the partition part.
11
# Find an actual physical device if we're passed a RAID device
13
- /dev/md*) set -- `getraid_mdadm $1`
14
+ /dev/md* | /dev/md/*) set -- `getraid_mdadm $1`
16
- tmp_disk=`echo "$1" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
17
- -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \
18
- -e 's%\(fd[0-9]*\)$%\1%' \
19
- -e 's%/part[0-9]*$%/disc%' \
20
- -e 's%\(c[0-7]d[0-9]*\).*$%\1%' \
21
- -e 's%\(e[0-9]\.[0-9]*\).*$%\1%'`
22
- tmp_part=`echo "$1" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' \
23
- -e 's%.*d[0-9]*p%%' \
24
- -e 's%.*/fd[0-9]*$%%' \
25
- -e 's%.*/floppy/[0-9]*$%%' \
26
- -e 's%.*/\(disc\|part\([0-9]*\)\)$%\2%' \
27
- -e 's%.*c[0-7]d[0-9]*p*%%' \
28
- -e 's%.*e[0-9]\.[0-9]*p%%' \
29
- -e 's%.*e[0-9]\.[0-9]*\$%%'`
32
- tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'`
33
- tmp_part=`echo "$1" | sed "s%$tmp_disk%%"` ;;
34
- freebsd* | kfreebsd*-gnu)
35
- tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$%\1%' \
36
- | sed 's%r\{0,1\}\(da[0-9]*\).*$%\1%'`
37
- tmp_part=`echo "$1" \
38
- | sed "s%.*/r\{0,1\}[saw]d[0-9]\(s[0-9]*[a-h]\)%\1%" \
39
- | sed "s%.*/r\{0,1\}da[0-9]\(s[0-9]*[a-h]\)%\1%"`
41
- netbsd* | knetbsd*-gnu)
42
- tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([sw]d[0-9]*\).*$%r\1d%' \
43
- | sed 's%r\{0,1\}\(fd[0-9]*\).*$%r\1a%'`
44
- tmp_part=`echo "$1" \
45
- | sed "s%.*/r\{0,1\}[sw]d[0-9]\([abe-p]\)%\1%"`
48
- echo "grub-install does not support your OS yet." 1>&2
52
- # Get the drive name.
53
- tmp_drive=`grep -v '^#' $device_map | grep "$tmp_disk *$" \
54
- | sed 's%.*\(([hf]d[0-9][a-z0-9,]*)\).*%\1%'`
56
- # If not found, print an error message and exit.
57
- if test "x$tmp_drive" = x; then
58
- echo "$1 does not have any corresponding BIOS drive." 1>&2
62
- if test "x$tmp_part" != x; then
63
- # If a partition is specified, we need to translate it into the
67
- echo "$tmp_drive" | sed "s%)$%,`expr $tmp_part - 1`)%" ;;
69
- if echo $tmp_part | grep "^s" >/dev/null; then
70
- tmp_pc_slice=`echo $tmp_part \
71
- | sed "s%s\([0-9]*\)[a-z]*$%\1%"`
72
- tmp_drive=`echo "$tmp_drive" \
73
- | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"`
75
- if echo $tmp_part | grep "[a-z]$" >/dev/null; then
76
- tmp_bsd_partition=`echo "$tmp_part" \
77
- | sed "s%[^a-z]*\([a-z]\)$%\1%"`
78
- tmp_drive=`echo "$tmp_drive" \
79
- | sed "s%)%,$tmp_bsd_partition)%"`
81
- echo "$tmp_drive" ;;
82
- freebsd* | kfreebsd*-gnu)
83
- if echo $tmp_part | grep "^s" >/dev/null; then
84
- tmp_pc_slice=`echo $tmp_part \
85
- | sed "s%s\([0-9]*\)[a-h]*$%\1%"`
86
- tmp_drive=`echo "$tmp_drive" \
87
- | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"`
89
- if echo $tmp_part | grep "[a-h]$" >/dev/null; then
90
- tmp_bsd_partition=`echo "$tmp_part" \
91
- | sed "s%s\{0,1\}[0-9]*\([a-h]\)$%\1%"`
92
- tmp_drive=`echo "$tmp_drive" \
93
- | sed "s%)%,$tmp_bsd_partition)%"`
95
- echo "$tmp_drive" ;;
96
- netbsd* | knetbsd*-gnu)
97
- if echo $tmp_part | grep "^[abe-p]$" >/dev/null; then
98
- tmp_bsd_partition=`echo "$tmp_part" \
99
- | sed "s%\([a-p]\)$%\1%"`
100
- tmp_drive=`echo "$tmp_drive" \
101
- | sed "s%)%,$tmp_bsd_partition)%"`
103
- echo "$tmp_drive" ;;
106
- # If no partition is specified, just print the drive name.
109
+ GRUB_LEGACY_0_BASED_PARTITIONS=1 grub-probe --device-map=${device_map} -t drive -d "$1"
112
# Usage: resolve_symlink file
114
# Usage: find_device file
115
# Find block device on which the file resides.
117
- # For now, this uses the program `df' to get the device name, but is
118
- # this really portable?
119
- tmp_fname=`df $1/ | sed -n 's%.*\(/dev/[^ ]*\).*%\1%p'`
120
+ tmp_fname=`grub-probe --device-map=${device_map} -t device $1/`
122
if test -z "$tmp_fname"; then
123
echo "Could not find device for $1" 2>&1
124
diff -ur grub-0.97/util/grub-install.in grub-0.97.new/util/grub-install.in
125
--- grub-0.97/util/grub-install.in 2008-07-23 01:14:29.000000000 +0200
126
+++ grub-0.97.new/util/grub-install.in 2008-07-23 01:16:46.000000000 +0200
128
if test -f "$device_map"; then
131
- # Create a safe temporary file.
132
- test -n "$mklog" && log_file=`$mklog`
134
- # Before all invocations of the grub shell, call sync to make sure
135
- # the raw device is in sync with any bufferring in filesystems.
138
- $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
141
- if grep "Error [0-9]*: " $log_file >/dev/null; then
147
+ grub-mkdevicemap $no_floppy --device-map=$device_map
150
# Make sure that there is no duplicated entry.