#!/bin/sh
#
# Script to run grub to recreate the MBR
#
export LANG=C
# Find boot partition if any
bootp=`grep "^/dev/.*\ on\ /boot" diskinfo/mount.bsi | cut -d ' ' -f 1`
# find boot device
if [ x$bootp != x ] ; then
   bootdev=`echo $bootp | cut -c1-8`
else
   bootdev=`grep "^/dev/.*\ on\ /" diskinfo/mount.bsi | cut -c1-8`
fi
echo "Boot device is $bootdev"
echo " "
echo "To manually install grub, enter:"
echo "chroot /mnt/disk"
echo "/sbin/grub-install $bootdev"
echo " "
echo "Attempting to install grub ..."
echo " "
chroot /mnt/disk /sbin/grub-install $bootdev
sync
