preremove revision 7c478bd95313f5f23a4c958a745db2134aa03244
#!/bin/sh
#
#pragma ident "%Z%%M% %I% %E% SMI"
#
# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
PATH="/usr/bin:/usr/sbin:${PATH}"
export PATH
#
# Driver info
#
DRV=daplt
REM_DRV=/usr/sbin/rem_drv
#
# Select the correct rem_drv options to execute.
# rem_drv touches /reconfigure to cause the
# next boot to be a reconfigure boot.
#
if [ "${BASEDIR}" = "/" ]; then
#
# On a running system, modify the
# system files and remove the driver
#
REM_DRV_FLAGS=""
else
#
# On a client, modify the system files
# relative to BASEDIR
#
REM_DRV_FLAGS="-b ${BASEDIR}"
fi
${REM_DRV} ${REM_DRV_FLAGS} ${DRV} || exit 1
# After the service provider has been removed, remove the entries for the
# service provider from /etc/dat/dat.conf to cleanup the state.
# We might not be able to run datadm(1m) here to cleanup the state because
# it might not be on the machine that pkgrm is invoked on so we run datadm
# only if {BASEDIR} is "/".
if [ "${BASEDIR}" = "/" ]; then
#
# On a running system, modify the
# dat.conf file using datadm
#
SPCONF=/usr/share/dat/SUNWudaplt.conf
DATADM=/usr/sbin/datadm
if [ -r "${SPCONF}" ]; then
${DATADM} -r ${SPCONF}
if [ $? -ne 0 ]; then
echo "datadm -r failed"
exit 1
fi
exit 0
else
echo "SUNWudaplt.conf does not exist. Cannot do datadm -r"
exit 1
fi
else
#
# If not on a running system (i.e, running on a client), modify
# the dat.conf file relative to $BASEDIR
#
DATCONF=${BASEDIR}/etc/dat/dat.conf
TMPDATCONF=${DATCONF}.$$.tmp
rm -f $TMPDATCONF
sed -e "/driver_name=tavor/d" $DATCONF > $TMPDATCONF
if [ $? -eq 0 ]; then
mv -f $TMPDATCONF $DATCONF
else
exit 1
fi
fi
exit 0