#!/bin/sh
# $Id: sbc_run_grub,v 1.3 2005/03/02 16:57:23 sesam Exp $
# Script to run grub to recreate the MBR
#
# Find boot partition if any
bootp=`grep "^/dev/.*\ /boot" $1/mount.sdi | cut -d ' ' -f 1`
# find boot device
if [ x$bootp != x ] ; then
   bootdev=`echo $bootp | cut -c1-8`
else
   bootdev=`grep "^/dev/.*\ /\ " $1/mount.sdi | cut -c1-8`
fi

echo -n "Do you want to install GRUB in the MBR and in $bootdev? (yes/no): "
read a

if [ x$a == xyes ] ; then
chroot /mnt/disk grub-install $bootdev
sync
fi

echo -n "Do you want to unmount the restored hard disk partitions? (yes/no): "
read a

if [ x$a == xja ] ; then
$1/../sbc_umount_drives
fi

echo -n "Do you want to reboot the system? (yes/no): "
read a

if [ x$a == xyes ] ; then
/sbin/shutdown now
fi
