#!/bin/bash

echo -n "DW"  >  myver
uname -r  >>  myver
if  grep "DW6." myver > mycheck ;then
    #echo " DW6 "
    sudo rm -rf /System/Library/Extensions/VIAUSBEHCI_D78.kext
    sudo rm -rf /System/Library/Extensions/VIAUHCIdriver_D78.kext
    if  ! grep "DW6.8" myver > mycheck ;then
	sudo rm -rf /System/Library/Extensions/VIAUSBEHCI.kext
	#echo " Non -  DW6.8 "
    fi
else 
    sudo rm -rf /System/Library/Extensions/VIAUSBEHCI.kext
    sudo rm -rf /System/Library/Extensions/VIAUHCIdriver.kext
    if ! grep "DW7." myver > mycheck ;then
       #echo " Non  - DW7...... "
       if  ! grep "DW8." myver > mycheck ;then
   	   sudo rm -rf /System/Library/Extensions/VIAUSBEHCI_D78.kext
    	   sudo rm -rf /System/Library/Extensions/VIAUHCIdriver_D78.kext
	   #echo " Non - DW8...... "
       fi
    fi
fi
rm -f mycheck
rm -f myver 
sudo touch  /System/Library/Extensions
