#!/bin/sh 
# uninstall.sh
# Created by Tresa on 08/03/11.# Copyright 2011 __MyCompanyName__. All rights reserved.

BASEDIR=$(dirname "$0")
cd "$BASEDIR"
cd ../
cd "./InstallFiles/Uninstall/"
cp -f -R "Printer Driver.zip" "/tmp/"

ditto -xk "/tmp/Printer Driver.zip" "/tmp/"

cd "/tmp/Printer Driver"

sudo Common/PerformOperations.app/Contents/MacOS/PerformOperations -mode "root" -InstallerPath "$0"
sleep 5

while true;
do
if ps ax | grep -v grep | grep PerformOperations > /dev/null
then
	sleep 1
else
	break
fi
done
sudo -u "$USER" Common/PerformOperations.app/Contents/MacOS/PerformOperations -mode "user"
cd ../

sudo rm -f -R "/tmp/Printer Driver"
sudo rm -f -R "/tmp/Printer Driver.zip"