#!/bin/tcsh
#
# install script for EMU Audio kernel extension
# the EMUUSBAudio.kext file should be in same dir as this script.
# W.Pasman 8oct2014
# we also run kextutil to write all symbols to ~/symbols, for panic debugging .
#
echo "Installing EMU driver"
set pathname=`dirname "$0"`
cd "$pathname"

echo "plz to turn off your EMU USB device for loading of kext, you have 3 seconds to do so"
sleep 3
sudo kextunload /System/Library/Extensions/EMUUSBAudio.kext
echo "deleting old kext"
sudo rm -r /System/Library/Extensions/EMUUSBAudio.kext
echo "moving things"
sudo cp -r EMUUSBAudio.kext /System/Library/Extensions
echo "doing permissions stuff"
cd /System/Library/Extensions
sudo chgrp -R wheel EMUUSBAudio.kext
echo "loading new kext"
sudo kextload -v EMUUSBAudio.kext
# enable following for debugging.
# kextutil -s ~/symbols/ -A EMUUSBAudio.kext/
echo "so long"


# manual start:
# chmod -R 755 EMUUSBAudio.kext/
# sudo chgrp -R wheel EMUUSBAudio.kext
#sudo kextload -v EMUUSBAudio.kext/