echo
echo "Welcome to MAKEBOOT, a boot disk creation utility."
echo
if [ "$1" = "" ]; then
	echo "The default kernel used to make this boot disk will be /zImage, the one"
	echo "that comes with the Slackware rescue disk. If you'd like to use a better"
	echo "kernel (such as the one on your root Linux partition), then you should "
	echo "hit control-C to end this script, mount your root partition, and start"
	echo "makeboot again using the full path and filename as the argument. For"
	echo "example: "
	echo  
	echo "makeboot /root/zImage"
	KERNEL=/zImage
else
	KERNEL=$1
fi
echo
echo "Please insert a formatted floppy disk into your boot drive. This will be"
echo "made into your new Linux boot disk."
echo
echo -n "Press [enter] when ready."  
read REPLY;
echo
echo "Copying kernel ($KERNEL) to floppy."
echo "(dd if=$KERNEL of=/dev/fd0)" 
dd if=$KERNEL of=/dev/fd0
echo "Kernel copied."
echo
echo "This boot disk must be configured to boot your root partition."
echo
while [ 0 ]; do
	echo "At this prompt below, enter the name of your root partition (such as"
	echo "/dev/hda1), or enter [p] for a partition list."
	echo 
	echo -n "Partition? "
	read PARTITION;  
	if [ "$PARTITION" = "p" ]; then
		echo
		fdisk -l
		echo
	else
		break;
	fi
done
echo
echo "Setting root partition to $PARTITION..."
echo "  rdev /dev/fd0 $PARTITION"
rdev /dev/fd0 $PARTITION
echo
echo "You need to choose a video mode. There is the standard 80x25 mode, and"
echo "an extended mode."
echo
echo "What video mode would you like?"
echo "-1 : Normal VGA"
echo "-2 : Extended VGA"
echo "-3 : Ask at boot time"
echo
while [ 0 ]; do
	echo -n "Video mode (-1, -2, -3)? "	
	read VIDMODE;
	if [ "$VIDMODE" = "-1" -o "$VIDMODE" = "-2" -o "$VIDMODE" = "-3" ]; then
		break;
	fi
done
echo
echo "Setting video mode to $VIDMODE..."
echo "  rdev -v /dev/fd0 $VIDMODE"
rdev -v /dev/fd0 $VIDMODE
echo
echo "Setting of read-only/read-write flag:"
echo
echo "If you're using bootutils, your partition should be mounted read-only."
echo "Bootutils will check the partition, and then remount it read-write. If"
echo "you are not using bootutils, you'll probably want to have this boot disk"
echo "mount your root partition read-write."
echo 
echo "0 : read-write"
echo "1 : read-only"
echo
while [ 0 ]; do
	echo -n "Which setting? "
	read ROOTFLAG;
	if [ "$ROOTFLAG" = "0" -o "$ROOTFLAG" = "1" ]; then
		break;
	fi
done
echo
echo "Setting root flags..."
echo "  rdev -R /dev/fd0 $ROOTFLAG"
rdev -R /dev/fd0 $ROOTFLAG
echo
echo "Boot disk created."
echo
