#
#  (C) Copyright PTI. 1994
# This source file is the property of PTI.
# It may not be copied or distributed in any isomorphic form
# without an appropriate prior licensing arrangement with 
# PTI.
#
# Shell script to remove UNIX driver
#

TMPFILE=/tmp/tmp$$
MDEVICE=/etc/conf/cf.d/mdevice
SCOHDSPACE=/etc/conf/pack.d/hd/space.c
SCOPACK=/etc/conf/pack.d/wd0
ATTPACK=/etc/conf/pack.d/hd

strings - /bin/pwd | grep 'SCO' > /dev/null 2>&1
if [ $? = 0 ]
then
	UNIXID=SCO
fi

strings - /bin/pwd | grep 'UNIX System V/386' > /dev/null 2>&1
if [ $? = 0 ]
then
	UNIXID="AT&T"
fi

echo "\n\nRemoving driver ..."

# mdevice
if [ "$UNIXID" = "AT&T" ]
then 
	sed -e '/^hd/s/[ 	]pti/	hd/g' $MDEVICE > $TMPFILE
fi
cp $TMPFILE $MDEVICE 2> /dev/null

if [ $UNIXID = SCO ]
then
	THISPACK=$SCOPACK
else
	THISPACK=$ATTPACK
fi
	
cp ${THISPACK}/Driver.ptibak ${THISPACK}/Driver.o 2> /dev/null
rm ${THISPACK}/space.c $THISPACK/Driver.ptibak > /dev/null 2>&1

/etc/conf/bin/idbuild
if [ $? != 0 ]
then
	exit 1
fi
rm /bin/cisetmode > /dev/null 2>&1
rm $TMPFILE > /dev/null 2>&1
sync
sync
exit 0
