#!/bin/sh

echo "grub-install for wrap"
if [ "$1" != "" ] && [ "$1" != "0" ] && [ "$1" != "2" ]; then
	echo "you might select a grub-target, boot partition is also mirrored"
	echo "one argument"
	echo "  0 for standard boot partition (/dev/hda1)"
	echo "  2 for mirrored boot partition (/dev/hda3)"
	if [ "$1" != "" ]; then
		echo "wrong argument, exiting"
		exit 1
	fi
fi
if [ "$1" == "" ]; then
	BOOTDEV="0"
else
	BOOTDEV="$1"
fi

grub --batch --no-curses --no-floppy <<EOF
device (hd0) /dev/hda
root (hd0,$BOOTDEV)
setup (hd0)
quit
EOF