#! /bin/sh
#
#ident  "@(#)postremove	1.6    01/04/19 SMI"

set -u
PATH="/usr/bin:/usr/sbin:${PATH}"
export PATH

#
# Driver info
#
DRV=ge

# Select the correct rem_drv options to execute.
# Only attempt to unload the driver on a running system.
#
if [ "${BASEDIR}" = "/" ]; then
	REM_DRV="rem_drv"
else
	REM_DRV="rem_drv -b ${BASEDIR}"
fi

#
# Make sure rem_drv has *not* been previously executed
# before attempting to remove the driver.
#
grep -w "${DRV}" ${BASEDIR}/etc/name_to_major > /dev/null 2>&1
if [ $? -eq 0 ]; then
	${REM_DRV} ${DRV}
	if [ $? -ne 0 ]; then
		echo "\nFailed rem_drv!\n" >&2
		exit 1
	fi
fi

#
# rem_drv doesn't remove the entry in /dev therefore this script
# will have to finish off that clean up.
#
rm -f ${BASEDIR}/dev/${DRV}
#
exit 0
