#!/bin/sh
#
#   - Removes old CFM QTPowerPlug
#   - Removes old QTTuneUp/Smeagol extension
#   - Removes any old Clamato(5.0.4) quicktime pieces
#   - Removes any old SU1(5.0.5) quicktime pieces
#   - Removes any old QuickTime.framework/Info-macos.plist
#   - Remove the QuickTime Player Channels file
#   - Remove the old QuickTime Player Help folder
#   - Remove the old QuickTimeUpdateHelper
#   - Remove the old QuickTime Updater (uncommented as of 7.2)

RM="/bin/rm -rf"
QUICKTIMECOMPONENTSDIR=/System/Library/QuickTime

if [ -d "$3/$QUICKTIMECOMPONENTSDIR/QuickTimePowerPlug.component" ]; then
	$RM "$3/$QUICKTIMECOMPONENTSDIR/QuickTimePowerPlug.component"
fi

if [ -d "$3/$QUICKTIMECOMPONENTSDIR/QuickTimeTuneUp.component" ]; then
	$RM "$3/$QUICKTIMECOMPONENTSDIR/QuickTimeTuneUp.component"
fi

if [ -d "$3/$QUICKTIMECOMPONENTSDIR/QuickTimeJPEGUpdate.component" ]; then
	$RM "$3/$QUICKTIMECOMPONENTSDIR/QuickTimeJPEGUpdate.component"
fi

if [ -d "$3/$QUICKTIMECOMPONENTSDIR/QuickTimeDVUpdate.component" ]; then
	$RM "$3/$QUICKTIMECOMPONENTSDIR/QuickTimeDVUpdate.component"
fi

if [ -d "$3/$QUICKTIMECOMPONENTSDIR/QuickTimeComponentsUpdate.component" ]; then
	$RM "$3/$QUICKTIMECOMPONENTSDIR/QuickTimeComponentsUpdate.component"
fi

if [ -d "$3/$QUICKTIMECOMPONENTSDIR/QuickTimeDataHandlerUpdate.component" ]; then
	$RM "$3/$QUICKTIMECOMPONENTSDIR/QuickTimeDataHandlerUpdate.component"
fi

# Remove the old Info-macos.plist file
if [ -f "$3/System/Library/Frameworks/QuickTime.framework/Versions/A/Resources/Info-macos.plist" ]; then
	$RM "$3/System/Library/Frameworks/QuickTime.framework/Versions/A/Resources/Info-macos.plist"
fi

# Remove the QuickTime Player channels file
if [ -f "$3/$QUICKTIMECOMPONENTSDIR/QuickTime Channels" ]; then
	$RM "$3/$QUICKTIMECOMPONENTSDIR/QuickTime Channels"
fi

# Remove the old QuickTime Player Help folder
if [ -d "$3/Library/Documentation/Help/QuickTime.help" ]; then
	$RM "$3/Library/Documentation/Help/QuickTime.help"
fi  

# Remove the QuickTimeUpdateHelper (never used on X, and only contained a 'vers' resource)
if [ -f "$3/$QUICKTIMECOMPONENTSDIR/QuickTimeUpdateHelper" ]; then
	$RM "$3/$QUICKTIMECOMPONENTSDIR/QuickTimeUpdateHelper"
fi

# Remove the QuickTime Updater
if [ -d "$3/$QUICKTIMECOMPONENTSDIR/QuickTime Updater.app" ]; then
	$RM "$3/$QUICKTIMECOMPONENTSDIR/QuickTime Updater.app"
fi

if [ -f "$3/System/Library/Components/AudioCodecs.component/Contents/Resources/CodecNames.strings" ]; then
	$RM "$3/System/Library/Components/AudioCodecs.component/Contents/Resources/CodecNames.strings"
fi

##### Remove Caches

if [ -f "$3/System/Library/Caches/com.apple.Components.SystemCache.Components" ]; then
	$RM "$3 /System/Library/Caches/com.apple.Components.SystemCache.Components"
fi

if [ -f "$3/System/Library/Caches/com.apple.Components.SystemCache.QuickTimeComponents" ]; then
	$RM "$3/System/Library/Caches/com.apple.Components.SystemCache.QuickTimeComponents"
fi

if [ -f "$3/Library/Caches/com.apple.Components.LocalCache.AudioComponents" ]; then
	$RM "$3/Library/Caches/com.apple.Components.LocalCache.AudioComponents"
fi

if [ -f "$3/Library/Caches/com.apple.Components.LocalCache.Components" ]; then
	$RM "$3/Library/Caches/com.apple.Components.LocalCache.Components"
fi

if [ -f "$3/Library/Caches/com.apple.Components.LocalCache.Components" ]; then
	$RM "$3/Library/Caches/com.apple.Components.LocalCache.Components"
fi

