5 echo 'pass the device on which to install' >&2
9 # try to remake boot.img if it's missing
10 if [ ! -f boot.img ]; then
15 if mount | grep ^$dev >/dev/null 2>&1; then
16 echo "device $dev seems to be in use." >&2
17 echo "Make sure it's the correct device, and unmount the following filesystems first:" >&2
19 mount | grep ^$dev >&2
23 # copy the existing MBR to preserve the partition table
24 echo "saving copy of existing MBR to preserve partition table ..."
25 dd if=$dev of=/tmp/instmbr.mbr bs=512 count=1 status=none
26 echo "writing boot image to $dev ..."
27 dd if=boot.img of=$dev bs=512 status=none conv=notrunc
28 echo "patching boot sector with saved partition table ..."
29 dd if=/tmp/instmbr.mbr of=$dev bs=1 seek=440 skip=440 count=70 status=none conv=notrunc