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

#	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.
#

FAILURE=1	# fatal error

REBUILD=0

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

undo_strcf() {
if [ -f /etc/inet/strcf ]
then 
	sed "/\# i386\/$1/s/^	/#	/" < /etc/inet/strcf > /etc/inet/strcf.tmp 
	mv /etc/inet/strcf.tmp /etc/inet/strcf
fi
rm -rf /etc/inet/strcf.tmp
}

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

# determine that ID/TP tools are available

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

for MODULE in pc586
do
	${CONFBIN}/idcheck -p ${MODULE}
	RES="$?"
	if
		[ "${RES}" -ne "100" -a "${RES}" -ne "0" ]
	then
		${CONFBIN}/idinstall -d ${MODULE}
		echo "Removing ${NAME} ${MODULE} module ..."
		REBUILD=1
	fi
done

undo_strcf pc586

if
	[ "${REBUILD}" = "1" ]
then
	# rebuild for changes to take effect
	
	${CONFBIN}/idbuild
	if
		[ "$?" -ne "0" ]
	then
		exit ${FAILURE}
	else
		exit 10
	fi
else
	exit 0
fi

