#	Copyright (c) 1990  Intel Corporation
#	All Rights Rreserved
#
#	INTEL CORPORATION PROPRIETARY INFORMATION
#
#	This software is supplied to AT & T under the terms of a license 
#	agreement with Intel Corporation and may not be copied nor 
#	disclosed except in accordance with the terms of that agreement.
#

#ident	"@(#)/usr/src/add-on/pkg.kdb/postinstall.sl 1.1 4.0 12/08/90 46626 AT&T-USL"

FAILURE=1	# fatal error

MOD=kdb
CONFDIR=/etc/conf
CONFBIN=${CONFDIR}/bin

TMP=/tmp/${MOD}.err

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

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

exitstat=0

# install the driver

cd /tmp/${MOD}

${CONFBIN}/idinstall -a ${MOD} 2> ${TMP}
if
	[ "$?" != "0" ]
then
	${CONFBIN}/idinstall -u ${MOD} 2> ${TMP}
	if
		[ "$?" != "0" ]
	then
		message "The installation of the ${NAME} cannot be completed \
due to an error in the driver installation. \
The file ${TMP} contains the errors."
		exitstat=${FAILURE}
	fi
fi

if [ ${exitstat} = 0 ]
then
	# Rebuild the kernel
	${CONFBIN}/idbuild 2>> $TMP
	if
		[ "$?" -ne "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"
		exitstat=${FAILURE}
	else
		exitstat=10
	fi
fi

#
# Now clean up
#
rm -f $TMP >/dev/null 2>&1
removef $PKGINST /tmp/${MOD}/* >/dev/null 2>&1
removef $PKGINST /tmp/${MOD} >/dev/null 2>&1
removef -f $PKGINST >/dev/null 2>&1

exit ${exitstat}
