#!/bin/bash

M1=M
M2=("WRITE HD BOOTSECTOR TO FLOPPY")

function backup_bootsector {

    grep -q $FS /etc/mtab || mount $FS
    exec_command "dd if=$HDDEVICE of=$FS/mbr.hda bs=512 count=1"
    umount $FS

}

function backup_bootsector_hd {

    select_harddisk

    if [ "$YNRETVAL" = "0" ]; then

	inputbox "Enter \"ext2\" or \"dos\""

	if [ "$RETVAL" = "0" ]; then

	    case $INPUT in

		ext2) FS=$A
		    msgbox "Put a formatted floppy in the floppydrive"
		    backup_bootsector;;

		dos)  FS=$B
	    	    msgbox "Put a formatted floppy in the floppydrive"
	    	    backup_bootsector;;

		*)  msgbox "You must specify the filesystem type";;

	    esac

	fi

    fi
}
