3 # Uninstaller script for GHC.framework
4 # (currently only for system volume installations)
6 INSTALL_DEST=/Library/Frameworks
8 if [ ${INSTALL_BASE} = / ]; then
11 INSTALL_BIN=${INSTALL_BASE}/bin
14 if [ ! -x ${INSTALL_DEST}/GHC.framework ]; then
15 echo "${INSTALL_DEST}/GHC.framework does not exit"
19 if [ ${USER} != root ]; then
20 echo "GHC.framework installer must be run with admin privileges"
21 echo "Prefix command by 'sudo'"
25 VERSIONS=(`ls ${INSTALL_DEST}/GHC.framework/Versions`)
26 NO_VERSIONS=${#VERSIONS[@]}
28 if [ ${VERSIONS[${NO_VERSIONS}-1]} != Current ]; then
29 echo "Fatal error: last version should be Current"
30 echo "Found versions: ${VERSIONS[@]}"
33 CURRENT_PHYS=`cd /Library/Frameworks/GHC.framework/Versions/Current; pwd -P`
34 CURRENT=`basename ${CURRENT_PHYS}`
36 if [ ${NO_VERSIONS} -ne 2 ]; then
37 echo "Multiple versions of GHC.framework are currently installed."
38 echo "This uninstaller removes GHC.framework entirely and should only"
39 echo "be used if there is exactly one version."
41 echo "To remove individual old versions, simply delete the directory"
42 echo "${INSTALL_DEST}/GHC.framework/Versions/VERSION_TO_REMOVE"
44 echo "Found versions: ${VERSIONS[@]}(= ${CURRENT})"
48 echo "Removing symbolic links into GHC.framework"
49 for thisfile in `ls ${INSTALL_BIN}`; do
50 if ls -l ${INSTALL_BIN}/${thisfile} | grep -q GHC.framework/Versions; then
51 rm -f ${INSTALL_BIN}/${thisfile}
55 echo "Removing ${INSTALL_DEST}/GHC.framework"
56 rm -rf ${INSTALL_DEST}/GHC.framework
58 echo "Removing package recipt"
59 rm -f /Library/Receipts/boms/org.haskell.glasgowHaskellCompiler.ghc.pkg.bom
61 echo "${INSTALL_DEST}/GHC.framework has been purged!"