#!/bin/sh

cd /System/Library/StartupItems

if [ -f Sendmail.tar ]; then
  echo "Restoring the Sendmail launcher..."
  if tar -xf  Sendmail.tar; then
    rm -f Sendmail.tar 
  fi 
fi

if [ -f Postfix.tar ]; then
  echo "Restoring the Postfix launcher..."
  if tar -xf  Postfix.tar; then
    rm -f Postfix.tar
  fi
fi

cd /Library/StartupItems

echo ""
if [ -d CommuniGatePro ]; then
  echo "Removing the start-up launcher..."
  rm -rf CommuniGatePro
fi

if [ -f /usr/bin/LegacyMail ]; then
  echo "Restoring Legacy Mailer"
  if ! mv /usr/bin/LegacyMail /usr/bin/mail ; then
    echo "Failed to restore the name of the legacy mail application"
    exit 1
  fi
fi

if [ -d /usr/sbin/CommuniGatePro ]; then
  echo "Removing CommuniGate Pro Application..."
  rm -rf /usr/sbin/CommuniGatePro
fi

