#!/bin/sh

#*************************************************************************
#
# ADOBE CONFIDENTIAL
# ___________________
#
#  Copyright 2014 Adobe Systems Incorporated
#  All Rights Reserved.
#
# NOTICE:  All information contained herein is, and remains
# the property of Adobe Systems Incorporated and its suppliers,
# if any.  The intellectual and technical concepts contained
# herein are proprietary to Adobe Systems Incorporated and its
# suppliers and are protected by trade secret or copyright law.
# Dissemination of this information or reproduction of this material
# is strictly forbidden unless prior written permission is obtained
# from Adobe Systems Incorporated.
#*************************************************************************

echo "CCP Package UnInstaller : postupgrade launched..."

if [ -f "$PACKAGE_PATH/Contents/Info.plist" ]
then
	UninstallPkgBundleId=`defaults read "$PACKAGE_PATH/Contents/Info" CFBundleIdentifier`
	if [ -n "$UninstallPkgBundleId" ]
	then
		InstallPkgBundleId="${UninstallPkgBundleId/uninstall/install}"
		echo "InstallPkgBundleId to forgot : $InstallPkgBundleId"
		pkgutil -f --forget "$InstallPkgBundleId"
		PkgUtilExitCode=$?
		echo "Forget ($InstallPkgBundleId) exit code : $PkgUtilExitCode"
	else
		echo "CCP Package UnInstaller : Failed to find BundleId in Info.plist file in postupgrade..."
	fi	
else
	echo "CCP Package UnInstaller : Failed to locate Info.plist file in postupgrade..."
fi