#!/bin/sh
set -e;

PACKAGE=sendmail-base;

if [ -L @docdir@/$PACKAGE ]; then
	# /usr/share/doc/$PACKAGE was a symlink to /usr/share/doc/sendmail
	rm @docdir@/$PACKAGE
fi
if [ -L /usr/share/bug/$PACKAGE ]; then
	rm /usr/share/bug/$PACKAGE
fi

if [ "$1" = "upgrade" ] && dpkg --compare-versions "$2" lt "8.14.4-2.2~"; then
	# /usr/share/doc/$PACKAGE was a symlink to /usr/share/doc/sendmail
	rm -rf @docdir@/sendmail/examples
	rm -f @docdir@/sendmail/Debian-specific.gz
	rm -f @docdir@/sendmail/site.config.m4.gz
fi

if [ "$1" = "upgrade" ]; then
		# Prevent cronjob from running during upgrade...
		if [ -f @sysconfdir@/cron.d/sendmail ]; then
			echo "#preinst" > @sysconfdir@/cron.d/sendmail;
			fi;

		# Move files to new home
		if [ -d @sysconfdir@/mail/ssl ]; then
			mv -f @sysconfdir@/mail/ssl @sysconfdir@/mail/tls;
			fi;
fi

#DEBHELPER#
