]>
Commit | Line | Data |
---|---|---|
82705b6e MT |
1 | --- grub-0.95/util/grub-install.in.md2 2005-01-03 14:49:18.133866107 -0500 |
2 | +++ grub-0.95/util/grub-install.in 2005-01-03 16:35:44.923732271 -0500 | |
3 | @@ -35,6 +35,7 @@ | |
4 | rootdir= | |
5 | grub_prefix=/boot/grub | |
6 | ||
7 | +install_drives= | |
8 | install_device= | |
9 | no_floppy= | |
10 | force_lba= | |
11 | @@ -272,6 +273,30 @@ | |
12 | done | |
13 | } | |
14 | ||
15 | + | |
16 | +dump_boot_block () { | |
17 | + sync | |
18 | + $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file | |
19 | +dump ${root_drive}${tmp} ${img_file} | |
20 | +quit | |
21 | +EOF | |
22 | +} | |
23 | + | |
24 | + | |
25 | +install_boot_block () { | |
26 | + # Before all invocations of the grub shell, call sync to make sure | |
27 | + # the raw device is in sync with any bufferring in filesystems. | |
28 | + sync | |
29 | + | |
30 | + # Now perform the installation. | |
31 | + $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >>$log_file | |
32 | +root $1 | |
33 | +setup $force_lba --stage2=$grubdir/stage2 --prefix=$grub_prefix $2 | |
34 | +quit | |
35 | +EOF | |
36 | +} | |
37 | + | |
38 | + | |
39 | # Check the arguments. | |
40 | for option in "$@"; do | |
41 | case "$option" in | |
42 | @@ -416,28 +441,32 @@ | |
43 | # Check for INSTALL_DEVICE. | |
44 | case "$install_device" in | |
45 | /dev/*) | |
46 | - # If we are running md on a Linux box, just use the first physical device | |
47 | - # at this point. | |
48 | install_device=`resolve_symlink "$install_device"` | |
49 | - install_device=`find_real_devs $install_device | awk '{print $1}'` | |
50 | - | |
51 | - install_drive=`convert "$install_device"` | |
52 | - # I don't know why, but some shells wouldn't die if exit is | |
53 | - # called in a function. | |
54 | - if test "x$install_drive" = x; then | |
55 | + for install_drive in `find_real_devs $install_device` ; do | |
56 | + install_drive=`convert $install_drive` | |
57 | + if [ "x$install_drive" = "x" ]; then | |
58 | + exit 1 | |
59 | + fi | |
60 | + install_drives="${install_drives} ${install_drive}" | |
61 | + done | |
62 | + unset install_drive | |
63 | + | |
64 | + if test "x$install_drives" = x ; then | |
65 | exit 1 | |
66 | fi ;; | |
67 | \([hf]d[0-9]*\)) | |
68 | - install_drive="$install_device" ;; | |
69 | + install_drives="$install_device" ;; | |
70 | [hf]d[0-9]*) | |
71 | # The GRUB format with no parenthesis. | |
72 | - install_drive="($install_device)" ;; | |
73 | + install_drives="($install_device)" ;; | |
74 | *) | |
75 | echo "Format of install_device not recognized." 1>&2 | |
76 | usage | |
77 | exit 1 ;; | |
78 | esac | |
79 | ||
80 | +unset install_device | |
81 | + | |
82 | # Get the root drive. | |
83 | root_device=`find_device ${rootdir}` | |
84 | bootdir_device=`find_device ${bootdir}` | |
85 | @@ -465,41 +494,39 @@ | |
86 | test -n "$mkimg" && img_file=`$mkimg` | |
87 | test -n "$mklog" && log_file=`$mklog` | |
88 | ||
89 | -for real_device in `find_real_devs $root_device`; do | |
90 | - # Convert the root deviceto a GRUB drive. | |
91 | - root_drive=`convert "$real_device"` | |
92 | - if [ "x$root_drive" = x ]; then | |
93 | - exit 1 | |
94 | - fi | |
95 | +# There's not a real root device, so just pick the first | |
96 | +if is_raid1_device $root_device ; then | |
97 | + root_device=`find_real_devs $root_device | awk '{print $1}'` | |
98 | +fi | |
99 | ||
100 | - for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do | |
101 | - count=5 | |
102 | - tmp=`echo $file | sed "s|^${grubdir}|${grub_prefix}|"` | |
103 | - while test $count -gt 0; do | |
104 | - sync | |
105 | - $grub_shell --batch $no_floppy --device-map=$device_map \ | |
106 | - <<EOF >$log_file | |
107 | -dump ${root_drive}${tmp} ${img_file} | |
108 | -quit | |
109 | -EOF | |
110 | - if grep "Error [0-9]*: " $log_file >/dev/null; then | |
111 | - : | |
112 | - elif cmp $file $img_file >/dev/null; then | |
113 | - break | |
114 | - fi | |
115 | - sleep 1 | |
116 | - count=`expr $count - 1` | |
117 | - done | |
118 | - if test $count -eq 0; then | |
119 | - echo "The file $file not read correctly." 1>&2 | |
120 | - exit 1 | |
121 | - fi | |
122 | - done | |
123 | +# Convert the root deviceto a GRUB drive. | |
124 | +root_drive=`convert "$root_device"` | |
125 | +if [ "x$root_drive" = x ]; then | |
126 | + exit 1 | |
127 | +fi | |
128 | ||
129 | - rm -f $img_file | |
130 | - rm -f $log_file | |
131 | +for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do | |
132 | + count=5 | |
133 | + tmp=`echo $file | sed "s|^${grubdir}|${grub_prefix}|"` | |
134 | + while test $count -gt 0; do | |
135 | + dump_boot_block $root_drive $img_file | |
136 | + if grep "Error [0-9]*: " $log_file >/dev/null; then | |
137 | + : | |
138 | + elif cmp $file $img_file >/dev/null; then | |
139 | + break | |
140 | + fi | |
141 | + sleep 1 | |
142 | + count=`expr $count - 1` | |
143 | + done | |
144 | + if test $count -eq 0; then | |
145 | + echo "The file $file not read correctly." 1>&2 | |
146 | + exit 1 | |
147 | + fi | |
148 | done | |
149 | ||
150 | +rm -f $img_file | |
151 | +rm -f $log_file | |
152 | + | |
153 | if ! test -e ${grubdir}/grub.conf ; then | |
154 | test -e ${grubdir}/menu.lst && ln -s ./menu.lst ${grubdir}/grub.conf | |
155 | fi | |
156 | @@ -507,24 +534,13 @@ | |
157 | # Create a safe temporary file. | |
158 | test -n "$mklog" && log_file=`$mklog` | |
159 | ||
160 | -for real_device in `find_real_devs $root_device`; do | |
161 | +for install_drive in $install_drives; do | |
162 | # Convert the root deviceto a GRUB drive. | |
163 | - root_drive=`convert "$real_device"` | |
164 | + root_drive=`convert "$root_device"` | |
165 | if [ "x$root_drive" = x ]; then | |
166 | exit 1 | |
167 | fi | |
168 | - | |
169 | - # Before all invocations of the grub shell, call sync to make sure | |
170 | - # the raw device is in sync with any bufferring in filesystems. | |
171 | - sync | |
172 | - | |
173 | - # Now perform the installation. | |
174 | - $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >>$log_file | |
175 | -root $root_drive | |
176 | -setup $force_lba --stage2=$grubdir/stage2 --prefix=$grub_prefix $root_drive | |
177 | -quit | |
178 | -EOF | |
179 | - | |
180 | + install_boot_block $root_drive $install_drive | |
181 | done | |
182 | ||
183 | if grep "Error [0-9]*: " $log_file >/dev/null ; then |