#! /bin/sh
# This script removes the new USB framework drivers from the system.
#
#
PATH="/usr/bin:/usr/sbin:${PATH}"
export PATH
ARCH=`uname -i`

#
# The is_installed() function checks the name_to_major file to see 
# if the driver has been installed on the system by using the grep
# function.  If the driver entry is found, it will return a status 
# of zero.
#

is_installed() {

        driver=$1
        grep "^${driver} " $ROOTDIR/etc/name_to_major > /dev/null 2>&1

        return $?
}


#
# Remove the new framework drivers
#
# NOTES:
#
# 1) Ugen is not uninstalled, so that bindings set up by users are not removed
#    This could leave a residual reference to a deleted ugen binary if another
#    was not originally installed.
#
# 2) Drivers not installed by this patch are not removed by this script.  There
#    are some USB drivers not installed by this patch.
#
# 3) Drivers not installed on a particular platform  (such as usba10_uhci on
#    sparc) will not be found and therefore no attempt to remove them will be
#    made.
#

is_installed usba10_hid
if [ $? = 0 ]
   then 
	rem_drv -b ${ROOTDIR} usba10_hid 
fi

is_installed usba10_hubd
if [ $? = 0 ] 
   then
	rem_drv -b ${ROOTDIR} usba10_hubd 
fi

is_installed usba10_scsa2usb 
if [ $? = 0 ] 
   then
	rem_drv -b ${ROOTDIR} usba10_scsa2usb 
fi

is_installed usba10_usb_mid 
if [ $? = 0 ] 
   then
	rem_drv -b ${ROOTDIR} usba10_usb_mid
fi

is_installed usba10_usbprn
if [ $? = 0 ] 
   then
	rem_drv -b ${ROOTDIR} usba10_usbprn
fi
  
is_installed usba10_usb_ac 
if [ $? = 0 ]
   then
	rem_drv -b ${ROOTDIR} usba10_usb_ac 
fi
     
is_installed usba10_usb_as
if [ $? = 0 ] 
   then
	rem_drv -b ${ROOTDIR} usba10_usb_as 
fi

is_installed usba10_usbser_edge
if [ $? = 0 ]
   then
	rem_drv -b ${ROOTDIR} usba10_usbser_edge
fi

is_installed ohci
if [ $? = 0 ] 
   then 
	rem_drv -b ${ROOTDIR} ohci
fi

is_installed usba10_ohci
if [ $? = 0 ] 
   then 
	rem_drv -b ${ROOTDIR} usba10_ohci
fi

is_installed usba10_ehci
if [ $? = 0 ] 
   then
	rem_drv -b ${ROOTDIR} usba10_ehci
fi

is_installed hid
if [ $? = 0 ]
   then
	 rem_drv -b ${ROOTDIR} hid 
fi

is_installed scsa2usb
if [ $? = 0 ]
   then
	 rem_drv -b ${ROOTDIR} scsa2usb
fi

is_installed usb_ac
if [ $? = 0 ]
   then
	rem_drv -b ${ROOTDIR} usb_ac
fi

is_installed usb_as
if [ $? = 0 ]
   then
	rem_drv -b ${ROOTDIR} usb_as
fi
 
is_installed usbser_edge
if [ $? = 0 ]
   then
	rem_drv -b ${ROOTDIR} usbser_edge
fi

exit 0
