|
840
by Dustin Kirkland
slightly different approache to this problem, per IRC with slangasek... |
1 |
diff -upr a/util/grub-install.in b/util/grub-install.in
|
|
841
by Dustin Kirkland
This commit adds some smarts (back) into the handling of the multiple |
2 |
--- a/util/grub-install.in 2008-08-11 19:20:22.000000000 -0500
|
3 |
+++ b/util/grub-install.in 2008-08-11 19:20:30.000000000 -0500
|
|
|
840
by Dustin Kirkland
slightly different approache to this problem, per IRC with slangasek... |
4 |
@@ -187,6 +187,11 @@ convert () {
|
|
839
by Dustin Kirkland
This is the second revision of patch 2/2 for bug #33649, based on feedback from |
5 |
# If not found, print an error message and exit. |
6 |
if test "x$tmp_drive" = x; then |
|
|
840
by Dustin Kirkland
slightly different approache to this problem, per IRC with slangasek... |
7 |
echo "$1 does not have any corresponding BIOS drive." 1>&2 |
8 |
+ # If /boot is on a RAID device, provide more information
|
|
|
839
by Dustin Kirkland
This is the second revision of patch 2/2 for bug #33649, based on feedback from |
9 |
+ if mdadm --detail "$bootdir_device" >/dev/null 2>&1; then
|
|
840
by Dustin Kirkland
slightly different approache to this problem, per IRC with slangasek... |
10 |
+ echo "You can run grub-install on your RAID device [$bootdir_device]," 1>&2
|
11 |
+ echo "or you can define [$1] in [$device_map]." 1>&2
|
|
|
839
by Dustin Kirkland
This is the second revision of patch 2/2 for bug #33649, based on feedback from |
12 |
+ fi
|
|
840
by Dustin Kirkland
slightly different approache to this problem, per IRC with slangasek... |
13 |
exit 1 |
|
839
by Dustin Kirkland
This is the second revision of patch 2/2 for bug #33649, based on feedback from |
14 |
fi |
15 |
||
16 |
@@ -410,6 +415,10 @@ if test -n "$tmp"; then
|
|
17 |
exit 1 |
|
18 |
fi |
|
19 |
||
20 |
+# Get the root drive.
|
|
21 |
+root_device=`find_device ${rootdir}`
|
|
22 |
+bootdir_device=`find_device ${bootdir}`
|
|
23 |
+
|
|
24 |
# Check for INSTALL_DEVICE. |
|
25 |
case "$install_device" in |
|
26 |
/dev/*) |
|
27 |
@@ -431,10 +440,6 @@ case "$install_device" in
|
|
28 |
exit 1 ;; |
|
29 |
esac |
|
30 |
||
31 |
-# Get the root drive.
|
|
32 |
-root_device=`find_device ${rootdir}`
|
|
33 |
-bootdir_device=`find_device ${bootdir}`
|
|
34 |
-
|
|
35 |
# Check if the boot directory is in the same device as the root directory. |
|
36 |
if test "x$root_device" != "x$bootdir_device"; then |
|
37 |
# Perhaps the user has a separate boot partition. |
|
|
841
by Dustin Kirkland
This commit adds some smarts (back) into the handling of the multiple |
38 |
@@ -524,11 +529,34 @@ fi
|
|
839
by Dustin Kirkland
This is the second revision of patch 2/2 for bug #33649, based on feedback from |
39 |
sync |
40 |
||
41 |
# Now perform the installation. |
|
42 |
-$grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
|
|
|
840
by Dustin Kirkland
slightly different approache to this problem, per IRC with slangasek... |
43 |
+if echo "$install_device" | grep -qs "^/dev/md[0-9]" 2>/dev/null; then
|
|
839
by Dustin Kirkland
This is the second revision of patch 2/2 for bug #33649, based on feedback from |
44 |
+ # installing to an md device; write an MBR to each disk in the RAID
|
45 |
+ echo -n > $log_file
|
|
|
841
by Dustin Kirkland
This commit adds some smarts (back) into the handling of the multiple |
46 |
+ for disk in $(mdadm --detail "$install_device" 2>/dev/null | \
|
|
839
by Dustin Kirkland
This is the second revision of patch 2/2 for bug #33649, based on feedback from |
47 |
+ grep " active sync " 2>/dev/null | \
|
48 |
+ sed "s/^.* active sync\s*//" 2>/dev/null \
|
|
49 |
+ ); do
|
|
|
841
by Dustin Kirkland
This commit adds some smarts (back) into the handling of the multiple |
50 |
+ dev=$(echo "$disk" | sed "s/[0-9]\+$//")
|
51 |
+ bootpart=${disk#$dev}
|
|
52 |
+ grubroot=$(($bootpart-1))
|
|
53 |
+ hddev=$(echo "$install_drive" | sed "s/[()]//g" | sed "s/,.*//")
|
|
54 |
+ echo "Installing GRUB to $dev as ($hddev,$grubroot)..."
|
|
|
840
by Dustin Kirkland
slightly different approache to this problem, per IRC with slangasek... |
55 |
+ $grub_shell --device-map=/dev/null <<EOF >>$log_file
|
|
841
by Dustin Kirkland
This commit adds some smarts (back) into the handling of the multiple |
56 |
+device ($hddev) $dev
|
57 |
+root ($hddev,$grubroot)
|
|
58 |
+setup --stage2=$grubdir/stage2 --prefix=$grub_prefix $force_lba ($hddev,$grubroot)
|
|
|
840
by Dustin Kirkland
slightly different approache to this problem, per IRC with slangasek... |
59 |
+quit
|
60 |
+EOF
|
|
|
839
by Dustin Kirkland
This is the second revision of patch 2/2 for bug #33649, based on feedback from |
61 |
+ done
|
62 |
+else
|
|
63 |
+ # traditional case, normal grub installation
|
|
|
840
by Dustin Kirkland
slightly different approache to this problem, per IRC with slangasek... |
64 |
+ echo "Installing GRUB to $install_device as $install_drive..."
|
|
839
by Dustin Kirkland
This is the second revision of patch 2/2 for bug #33649, based on feedback from |
65 |
+ $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
|
66 |
root $root_drive |
|
67 |
setup $force_lba --stage2=$grubdir/stage2 --prefix=$grub_prefix $install_drive |
|
68 |
quit |
|
69 |
EOF |
|
70 |
+fi
|
|
71 |
||
72 |
if ${xfs_frozen} ; then
|
|
73 |
xfs_freeze -u ${grubdir}
|
|
|
841
by Dustin Kirkland
This commit adds some smarts (back) into the handling of the multiple |
74 |
@@ -543,8 +571,14 @@ dpkg-query -W -f '${Version}\n' grub > $
|
75 |
||
76 |
rm -f $log_file |
|
77 |
||
78 |
-# Prompt the user to check if the device map is correct.
|
|
79 |
echo "Installation finished. No error reported." |
|
80 |
+
|
|
81 |
+if echo "$install_device" | grep -qs "^/dev/md[0-9]" 2>/dev/null; then
|
|
82 |
+ # Displaying device.map when installing to a RAID device is misleading
|
|
83 |
+ exit 0
|
|
84 |
+fi
|
|
85 |
+
|
|
86 |
+# Prompt the user to check if the device map is correct.
|
|
87 |
echo "This is the contents of the device map $device_map." |
|
88 |
echo "Check if this is correct or not. If any of the lines is incorrect," |
|
89 |
echo "fix it and re-run the script \`grub-install'." |