#!/bin/sh
# mkpartition - for dosemu 0.49
#    Robert Sanders, gt8134b@prism.gatech.edu
#
# $Date: 1993/11/12 12:41:41 $
# $Source: /home/src/dosemu0.49pl4g/periph/RCS/mkpartition,v $
# $Revision: 1.1 $
# $State: Exp $
#

ME=`basename $0`
DRIVE=$1
PARTNUM=$2
PART=${DRIVE}${PARTNUM}
ETCD=/etc/dosemu
PFILE=${ETCD}/partition

echo "MKPARTITION for dosemu 0.49"
echo
echo "Setting up dosemu to use partition $PART from drive $DRIVE..."

if [ $PARTNUM -gt 4 ]
then
	echo "$ME: $PARTNUM outside range; the highest partition is 4"
	exit 1
fi

if [ ! -r "$DRIVE" -o ! -r "$PART" ]
then
	echo "$ME: drive <$DRIVE> or partition <$PART> non-readable or absent"
	exit 1
fi

if [ -r "$PFILE" ]
then
	echo "Backing up $PFILE to $PFILE.old"
	mv $PFILE ${PFILE}.old
fi

dd if=$DRIVE of=$PFILE bs=512 count=1