#!/bin/sh

MayIDoThis() {
    local description question command res
    description=$1
    question=$2
    command=$3
    default=$4
    res=0

    ask-me-a-question "$question" yn $default
    if [ "$?" -eq "1" ] ; then
        LogIt "$description" 1
        $command
        res=$?
    else
        LogIt "Skipping it." 1
    fi
    if [ "$res" -ne "0" ] ; then
        LogIt "Warning - error returned by '$command'" 1
    fi
    return $res
}


# ------------------------------ main -----------------------------------

LogIt "bootstrap-mode --- starting"

ask-me-a-question "Do you want IDE optimization (y/N) ?" "yn" "n"
if [ "$?" -eq "2" ] ; then
    ide-opt-off
else
    ide-opt-on
fi

mount /mnt/floppy &> /dev/null
while [ ! -e "/mnt/floppy/bootstrap.sh" ] ; do
    echo -e -n "Insert the 1.44MB bootstrap floppy, then press ENTER."
    read line
    mount /mnt/floppy
done

/mnt/floppy/bootstrap

res=`mount | grep /mnt/floppy`
if [ "$res" != "" ] ; then
    echo "Unmounting /mnt/floppy"
    umount /mnt/floppy
fi

exit 0
