blob: 8dacdcbc12127d2d668b7d9a327275f97f6a955e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#!/bin/bash
# Install grub stage1 as the MBR, copying the dos partition table from the
# existing MBR.
DEV="$1"
if [ ! "$DEV" -o ! -w "$DEV" ]; then
echo 2>&1 "Usage: $0 DEVICE"
exit 1
fi
case "$DEV" in
*r?d[0-9])
;;
*)
echo "The device $DEV doesn't seem to be a whole-disk raw device; continue? [n] "
read C
case "$C" in
[Yy]*)
;;
*)
echo 2>&1 "$0: Aborting";
exit 2
;;
esac
;;
esac
cd /tmp
dd if="$DEV" of=mbr bs=512 count=1 \
&& cp /boot/grub/stage1_ffs stage1 \
&& dd if=mbr of=stage1 conv=notrunc bs=1 seek=446 skip=446 count=64 \
&& dd if=stage1 of="$DEV" bs=512 count=1 \
|| { echo 2>&1 "$0: Install failed!" ; exit 5 ; }
rm mbr stage1
echo "$0: /boot/grub/stage1_ffs installed in MBR"
echo "$0: Don't forget to use the grub `install=' command to install stage2"
|