#!/bin/sh

set -e

. /usr/share/debconf/confmodule

if [ -n "$EX4DEBUG" ]; then
  echo "now debugging $0 $@"
  set -x
fi

case "$1" in
	configure)

	# needed for woody: "start" will fail on dpkg-reconfigure because
	# daemon is already running.
	# Afaik this has changed, dpkg-reconfigure from sid/sarge will call
	# prerm on reconfigure.
	# || true is needed for succesfull installation with configtype 'none'
	if [ -x /etc/init.d/exim4 ]; then
		if command -v invoke-rc.d >/dev/null 2>&1; then
			invoke-rc.d exim4 start || invoke-rc.d exim4 reload || true
		else
			/etc/init.d/exim4 start || /etc/init.d/exim4 reload || true
		fi
	fi
	db_stop

	;;
esac


