#! /bin/sh

PKG_INSTALL_ROOT=$ROOTDIR

#
# This script cleans up /etc/driver_aliases, /etc/driver_classes
# and /etc/name_to_major.
#
#

if [ -f $ROOTDIR/usr/sbin/rem_drv ]; then

if [ ! -f $ROOTDIR/platform/sun4u/kernel/drv/db21554 ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR db21554
fi

if [ ! -f $ROOTDIR/platform/sun4u/kernel/drv/sparcv9/pcf8584 ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR pcf8584
fi

if [ ! -f $ROOTDIR/platform/sun4u/kernel/drv/sparcv9/pcisch ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR pcisch
fi

if [ ! -f $ROOTDIR/platform/sun4u/kernel/drv/sparcv9/upa64s ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR upa64s
fi

if [ ! -f $ROOTDIR/platform/sun4u/kernel/drv/sparcv9/seeprom ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR seeprom
fi

if [ ! -f $ROOTDIR/platform/sun4u/kernel/drv/sparcv9/at24 ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR at24
fi

if [ ! -f $ROOTDIR/platform/sun4u/kernel/drv/sparcv9/smbus ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR smbus
fi

if [ ! -f $ROOTDIR/platform/sun4u/kernel/drv/sparcv9/max1617 ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR max1617
fi


if [ ! -f $ROOTDIR/platform/sun4u/kernel/cpu/SUNW,UltraSPARC-IIIi ]; then
	if [ ! -f $ROOTDIR/platform/sun4u/kernel/cpu/SUNW,UltraSPARC-III+ ]; then
        	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR us
        	$ROOTDIR/usr/sbin/add_drv -b $ROOTDIR -i \
        	'SUNW,UltraSPARC-III SUNW,UltraSPARC-IIe' -n us
	fi
else
        $ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR us
        $ROOTDIR/usr/sbin/add_drv -b $ROOTDIR -i \
        'SUNW,UltraSPARC-III "SUNW,UltraSPARC-III+" SUNW,UltraSPARC-IIe' -n us
fi

	
if [ ! -f $ROOTDIR/platform/sun4u/kernel/drv/sparcv9/pmubus -a \
     ! -f $ROOTDIR/platform/SUNW,Sun-Blade-100/kernel/drv/sparcv9/pmubus ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR pmubus
fi

if [ ! -f $ROOTDIR/platform/SUNW,Sun-Blade-100/kernel/drv/sparcv9/grfans ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR grfans
fi

if [ ! -f $ROOTDIR/platform/SUNW,Sun-Blade-100/kernel/drv/sparcv9/grppm ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR grppm
fi

if [ ! -f $ROOTDIR/platform/sun4u/kernel/drv/sparcv9/bbc_beep ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR bbc_beep
fi

if [ ! -f $ROOTDIR/platform/sun4u/kernel/tod/sparcv9/todds1287 ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR todds1287
fi

if [ ! -f $ROOTDIR/platform/sun4u/kernel/drv/sparcv9/schppm ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR schppm
fi

if [ ! -f $ROOTDIR/platform/SUNW,Sun-Blade-1000/kernel/drv/sparcv9/xcalppm ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR xcalppm
fi

if [ ! -f $ROOTDIR/platform/SUNW,Sun-Blade-100/kernel/drv/sparcv9/grbeep -a \
     ! -f $ROOTDIR/platform/sun4u/kernel/drv/sparcv9/grbeep ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR grbeep
fi

if [ ! -f $ROOTDIR/platform/sun4u/kernel/drv/sparcv9/smbus ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR smbus
fi

if [ ! -f $ROOTDIR/platform/sun4u/kernel/drv/sparcv9/mc-us3 ]; then
	$ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR mc-us3
fi

if [ ! -f $ROOTDIR/platform/sun4u/kernel/drv/sparcv9/pmc ]; then
        $ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR pmc
fi

if [ ! -f $ROOTDIR/platform/SUNW,Sun-Fire-15000/kernel/drv/sparcv9/axq ]; then
        $ROOTDIR/usr/sbin/rem_drv -b $ROOTDIR axq
fi

fi
exit 0
