
DRV=$1
while [ 1 ]
do
if [ "$DRV" != "A:"  -a "$DRV" != "a:" -a "$DRV" != "B:" -a "$DRV" != "b:" ]
then
echo "Incorrect drive name ! (choose a: or b:) \c"
read $DRV 
else
break
fi
done

CURRDIR=`pwd` 
TMPDIR=/tmp/$$
rm -r $TMPDIR > /dev/null 2>&1
mkdir $TMPDIR
cd $TMPDIR
PTIOS=SCO
strings - /bin/pwd | grep 'SCO' > /dev/null 2>&1
echo "Copy files from floppy ..."
if [ $? = 0 ]
then
echo ".\c"
doscp -r $DRV/unix/Driver.sco .
echo ".\c"
doscp -r $DRV/unix/Driver.att .
echo ".\c"
doscp -r $DRV/unix/Install  .
echo ".\c"
doscp -r $DRV/unix/Remove  .
echo ".\c"
doscp -r $DRV/unix/Name  .
echo ".\c"
doscp -r $DRV/unix/Size  .
echo ".\c"
doscp -r $DRV/unix/ptisetmode .
else
PTIOS=ATT
echo ".\c"
doscp -m $DRV/unix/Driver.sco .
echo ".\c"
doscp -m $DRV/unix/Driver.att .
echo ".\c"
doscp -m $DRV/unix/Install  .
echo ".\c"
doscp -m $DRV/unix/Remove  .
echo ".\c"
doscp -m $DRV/unix/Name  .
echo ".\c"
doscp -m $DRV/unix/Size  .
echo ".\c"
doscp -m $DRV/unix/ptisetmode .
fi

echo "\n\nPlease remove this floppy from drive."
echo "\nNow, another floppy is needed for temporary use, and"
echo "the contents of this temporary floppy will be destoryed."
echo "Do you wish to continue?(y/n) \c"
read AAA
if [ "$AAA" = "N" -o "$AAA" = "n" ]
then
	exit 1
fi

echo "\n"
while [ 1 ]
do
echo "In which drive is the temporary floppy inserted ?"
echo "	1) 1.44 MB 3 1/2\" drive A:"
echo "	2) 1.44 MB 3 1/2\" drive B:"
echo "	3) 1.2 MB 5 1/4\" drive A:"
echo "	4) 1.2 MB 5 1/4\" drive B:"
echo "Please choose it (1, 2, 3, 4): \c"
read AAA
if [ "$AAA" = "1" -o "$AAA" = "2" -o "$AAA" = "3" -o "$AAA" = "4" ]
then
break
fi
done

echo "\n"
if [ "$AAA" = "1" ]
then
DRV=/dev/rdsk/f0q18d
fi
if [ "$AAA" = "2" ]
then
DRV=/dev/rdsk/f1q18d
fi
if [ "$AAA" = "3" ]
then
DRV=/dev/rdsk/f0q15d
fi
if [ "$AAA" = "4" ]
then
DRV=/dev/rdsk/f1q15d
fi

format $DRV

if [ $PTIOS = SCO ]
then
ls * | cpio -oBcdmu > $DRV 
else
ls * | cpio -oBmu -H odc > $DRV 
fi
echo "\n Please keep this floppy in drive until the installation is complete."
echo "Press <Enter> to continue \c"
read AAA
installpkg
cd $CURRDIR
rm -r $TMPDIR
