#!/bin/bash

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

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

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

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

# Remove the previous FW overrides
if [ -d "/System/Library/Extensions/ApogeeFWOverideDriver.kext" ]; then
  rm -Rf /System/Library/Extensions/ApogeeFWOverideDriver.kext
fi

# Remove the previous Symphony Agent
if [ -d "/System/Library/Extensions/SymphonyAgent.bundle" ]; then
  rm -Rf /System/Library/Extensions/SymphonyAgent.bundle
fi

# Remove the previous Symphony Preference file
if [ -f "/Library/Preferences/com.apogee.symphonyDaemon.plist " ]; then
  rm -f /Library/Preferences/com.apogee.symphonyDaemon.plist 
fi

# Remove the previous Symphony Receipts (this was a problem after upgrading to Leopard and trying to install)
rm -Rf /Library/Receipts/Symphony*
