#!/bin/bash

#remove the previous Ensemble MaestroLink
if [ -f "/Library/LaunchAgents/apogee.enssuportdmn.plist" ]; then
	sudo rm /Library/LaunchAgents/apogee.enssuportdmn.plist
fi

# remove the previous plugins
if [ -d "/System/Library/Extensions/ONEPlugIn.bundle" ]; then
  rm -R /System/Library/Extensions/ONEPlugIn.bundle
fi
if [ -d "/System/Library/Extensions/apogfwplugin.bundle" ]; then
  rm -R /System/Library/Extensions/apogfwplugin.bundle
fi

# remove the previous preference file
if [ -d "/Library/Preferences/com.apogee.ONEDaemon.plist" ]; then
  rm -R /Library/Preferences/com.apogee.ONEDaemon.plist
fi

# remove the previous daemon sockets
if [ -d "/var/tmp/com.apogee.apogeeDaemon" ]; then
	sudo rm -R /var/tmp/com.apogee.apogeeDaemon
fi
if [ -d "/var/tmp/com.apogee.ONEDaemon" ]; then
	sudo rm -R /var/tmp/com.apogee.ONEDaemon
fi

# Remove the previous USB overrides
if [ -d "/System/Library/Extensions/ONEUSBOverideDriver.kext" ]; then
  rm -R /System/Library/Extensions/ONEUSBOverideDriver.kext
fi

# Remove the previous USB overrides
if [ -d "/System/Library/Extensions/ApogeeUSBOverideDriver.kext" ]; then
  rm -R /System/Library/Extensions/ApogeeUSBOverideDriver.kext
fi

