#!/bin/sh

#
# Remove components of the previous KfM (if present):
#

# The framework, which can have a different layout
FRAMEWORK=${3}/System/Library/Frameworks/Kerberos.framework
if [ -d "${FRAMEWORK}" ]
    then "${3}/bin/rm" -rf "${FRAMEWORK}"
fi

# The CFM glue which doesn't like to get merged
CFMGLUE=${3}/System/Library/CFMSupport/Kerberos
if [ -f "${CFMGLUE}" ]
    then rm -rf "${CFMGLUE}"
fi

# Bogus des dylib name
DES524=${3}/usr/lib/libdes524.dylib
if [ -f "${DES524}" ]
    then "${3}/bin/rm" -rf "${DES524}"
fi

# SymLink to umbrella framework support headers
INCLUDELINK=${3}/usr/include/KerberoSupport
if [ -L "${INCLUDELINK}" ]
    then "${3}/bin/rm" -rf "${INCLUDELINK}"
fi

# Current application location
APP=${3}/System/Library/CoreServices/Kerberos.app
if [ -d "${APP}" ]
    then "${3}/bin/rm" -rf "${APP}"
fi

OLDAPP1=${3}/Applications/Kerberos.app
# Old application location from KfM 4.0 install
if [ -d "${OLDAPP1}" ]
    then "${3}/bin/rm" -rf "${OLDAPP1}"
fi

# Old application location from Apple private builds
OLDAPP2=${3}/Applications/Utilities/Kerberos.app
if [ -d "${OLDAPP2}" ]
    then "${3}/bin/rm" -rf "${OLDAPP2}"
fi

exit 0
