#!/bin/sh
#Update script for exim config.
#This script will update the exim.conf.local from /usr/local/afribin to /etc
#This will also rebuild the exim config accourding to the updated exim.conf.local
#Script by Jan Prinsloo 05/05/2006
#Afrihost.com - The Best Web Hosting Ever
cd /usr/local/afribin/configs
if [ ! -f /scripts/buildeximconf ] ; then
   echo Not a cpanel server skipping eximconf upgrade
   exit 0
fi

if [ -f /etc/noclam -o ! -f /usr/bin/clamdscan ] ; then
   eximconf='exim.conf.local.noclam'
else
   eximconf='exim.conf.local'
fi
diff $eximconf /etc/exim.conf.local 2> /dev/null > /dev/null
if [ $? -eq 0 ] ; then
   echo "Exim.conf up to date"
   exit
fi

echo Running exim.conf.local upgrade...
cp $eximconf /etc/exim.conf.local
/scripts/buildeximconf
touch /etc/exim.mailertable

OS=`uname -s`
export OS

case "$OS" in
   FreeBSD)
      echo "Stopping Exim"
      /usr/local/etc/rc.d/040exim.sh stop
      echo "Starting Exim"
      /usr/local/etc/rc.d/040exim.sh start
   ;;
   Linux)
      echo "Stopping Exim"
      service exim stop
      echo "Starting Exim"
      service exim start
   ;;
esac



