FAILURE=1
CONFDIR=/etc/conf
CONFBIN=${CONFDIR}/bin
TMP=/tmp/slip.err

NOTOOLS="ERROR: The Installable Driver feature has been removed. \
The ${NAME} cannot be installed."

ERROR1=" Errors have been written to the file $TMP."

BASE1="ERROR: The ${NAME} is not compatible with this release \
of the UNIX System V operating system \
and can not be used with this system."

rm -f $TMP > /dev/null 2>&1

# determine that ID/TP tools are available

if [ ! -x ${CONFBIN}/idbuild -o ! -x ${CONFBIN}/idinstall ]
then
	message ${NOTOOLS}
	exit $FAILURE
fi

# check OS version

OSVER=`uname -a | cut -d " " -f3`

case ${OSVER} in
	4.0*) ;;
	4.1*) ;;
	*) message ${BASE1};
	   exit $FAILURE;;
esac

if [ "${SLIP_FIX_IP}" = "YES" ]
then
	mv /etc/conf/pack.d/ip/Driver.o /etc/conf/pack.d/ip/Driver.old
	cp /tmp/slip/ipDriver.o /etc/conf/pack.d/ip/Driver.o
fi

# install the driver

errflag=0
cd /tmp/slip

/etc/conf/bin/idinstall -a slip 2>> $TMP
if [ $? != 0 ]
then
	/etc/conf/bin/idinstall -u slip 2>> $TMP
	if [ $? != 0 ]
	then
       	message "The installation cannot be completed due to an error \
in the driver installation. $ERROR1  Please try the installation again.  \
If the error occurs again, contact your Service Representative."
		exit $FAILURE
	fi
fi

/etc/conf/bin/idbuild 2>> $TMP
if [ $? != 0 ]
then
	message "The installation cannot be completed due to an error in the \
kernel reconfiguration. $ERROR1  Please try the installation again.  If the \
error occurs again, contact your Service Representative." 
	exit $FAILURE
fi

errflag=`expr ${errflag:=0} + 10`

installf -f $PKGINST

# Now clean up

removef $PKGINST /tmp/slip/* >/dev/null 2>&1

for i in Driver.o Master Space.c System Node ipDriver.o
do
	removef $PKGINST /tmp/slip/$i >/dev/null 2>&1
done
removef $PKGINST /tmp/slip >/dev/null 2>&1
removef -f $PKGINST >/dev/null 2>&1
rm -f $TMP 1>/dev/null 2>&1

exit ${errflag} 

