--- indimail-mta-3.1.orig/debian/copyright
+++ indimail-mta-3.1/debian/copyright
@@ -0,0 +1,43 @@
+Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135
+Name: IndiMail
+Maintainer: Manvendra Bhangui <indimail-mta@indimail.org>
+Source: https://github.com/indimail/indimail-mta
+
+Copyright: 2008-2020, Manvendra Bhangui <mbhangui@gmail.com>
+License: GPL-3+
+
+License: GPL-3+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+ .
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>
+ .
+ On Debian systems, the full text of the GNU General Public
+ License version 3 can be found in the file
+ `/usr/share/common-licenses/GPL-3'.
+
+License: LGPL-3+
+ This library is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+ .
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>
+ .
+ On Debian systems, the full text of the GNU Lesser General Public
+ License version 3 can be found in the file
+ `/usr/share/common-licenses/LGPL-3'.
--- indimail-mta-3.1.orig/debian/indimail-mta.preinst
+++ indimail-mta-3.1/debian/indimail-mta.preinst
@@ -0,0 +1,128 @@
+#!/bin/sh
+# preinst script for indimail
+#
+# see: dh_installdeb(1)
+
+set -e
+prefix=/usr
+qmaildir=/var/indimail
+libexecdir=/usr/libexec/indimail
+servicedir=/service
+logdir=/var/log/svc
+rm=/bin/rm
+
+# summary of how this script can be called:
+#        * <new-preinst> `install'
+#        * <new-preinst> `install' <old-version>
+#        * <new-preinst> `upgrade' <old-version>
+#        * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+log_it() {
+  echo "$(echo  ""|tai64n|tai64nlocal)$*"
+}
+
+case "$1" in
+    upgrade)
+	(
+	if [ -f ${libexecdir}/qupgrade.sh ] ; then
+		log_it "Running Custom Upgrade Script for pre $1"
+		/bin/sh ${libexecdir}/qupgrade.sh pre $1 3.1 $* | tai64n | tai64nlocal
+	fi
+	if [ -d /run ] ; then
+		rundir=/run
+	elif [ -d /var/run ] ; then
+		rundir=/var/run
+	else
+		rundir=${servicedir}
+	fi
+	set +e
+	log_it "shutting down indimail services"
+	for i in greylist.1999 qmail-qmqpd.628 \
+		qmail-qmtpd.209 qmail-smtpd.25 qmail-smtpd.366 \
+		qmail-smtpd.465 qmail-smtpd.587 qmail-send.25 \
+		qmail-daned.1998 qscanq slowq-send \
+		resolvconf udplogger.3000 qmail-logfifo
+	do
+		if [ ! -d ${servicedir}/$i ] ; then
+			continue
+		fi
+		${prefix}/bin/svstat ${servicedir}/$i
+		if [ $? -eq 0 ] ; then
+			mkdir -p ${rundir}/$i
+			touch ${rundir}/$i/.down
+			${prefix}/bin/svc -d ${servicedir}/$i >/dev/null 2<&1 || true
+		fi
+	done
+	set -e
+	) >> /var/log/indimail-mta-setup.log 2>&1
+	exit 0
+	;;
+	install)
+	if [ -f ${libexecdir}/qupgrade.sh ] ; then
+		(
+		log_it "Running Custom Upgrade Script for pre $1"
+		/bin/sh ${libexecdir}/qupgrade.sh pre $1 3.1 $* | tai64n | tai64nlocal
+		) >> /var/log/indimail-mta-setup.log 2>&1
+	fi
+	#
+	# Create a users and groups. Do not report any problems if they already
+	# exists.
+	#
+	(
+	log_it "Adding indimail-mta users/groups"
+	nscd_up=`ps -ef |grep nscd |grep -v grep|wc -l`
+	if [ $nscd_up -ge 1 ] ; then
+		if [ -x /etc/init.d/nscd ] ; then
+			/etc/init.d/nscd stop
+		elif [ -f /etc/systemd/system/multi-user.target/nscd.service ] ; then
+			/bin/systemctl stop nscd.service >/dev/null 2>&1 || true
+		fi
+	fi
+	/usr/bin/getent group indimail  > /dev/null || /usr/sbin/groupadd -r -g 555 indimail || \
+		/usr/sbin/groupadd indimail || true
+	/usr/bin/getent group nofiles   > /dev/null || /usr/sbin/groupadd nofiles  || true
+	/usr/bin/getent group qmail     > /dev/null || /usr/sbin/groupadd qmail    || true
+	/usr/bin/getent group qscand    > /dev/null || /usr/sbin/groupadd qscand   || true
+	/usr/bin/getent group qcerts    > /dev/null || /usr/sbin/groupadd qcerts   || true
+	
+	for i in indimail alias qmaild qmaill qmailp qmailq qmailr qmails qscand
+	do
+		${rm} -f /var/spool/mail/$i
+	done
+	
+	/usr/bin/getent passwd indimail > /dev/null || \
+		/usr/sbin/useradd -r -g indimail -u 555 -d ${qmaildir} indimail || \
+		test $? = 4 && /usr/sbin/useradd -r -g indimail -d ${qmaildir} indimail || true
+	/usr/bin/getent passwd alias    > /dev/null || /usr/sbin/useradd -M -g nofiles  -d ${qmaildir}/alias  -s /sbin/nologin  alias || true
+	/usr/bin/getent passwd qmaild   > /dev/null || /usr/sbin/useradd -M -g nofiles  -d ${qmaildir}        -s /sbin/nologin qmaild -G qcerts || true
+	/usr/bin/getent passwd qmaill   > /dev/null || /usr/sbin/useradd -M -g nofiles  -d ${logdir}          -s /sbin/nologin qmaill || true
+	/usr/bin/getent passwd qmailp   > /dev/null || /usr/sbin/useradd -M -g nofiles  -d ${qmaildir}        -s /sbin/nologin qmailp || true
+	/usr/bin/getent passwd qmailq   > /dev/null || /usr/sbin/useradd -M -g qmail    -d ${qmaildir}        -s /sbin/nologin qmailq || true
+	/usr/bin/getent passwd qmailr   > /dev/null || /usr/sbin/useradd -M -g qmail    -d ${qmaildir}        -s /sbin/nologin qmailr -G qcerts || true
+	/usr/bin/getent passwd qmails   > /dev/null || /usr/sbin/useradd -M -g qmail    -d ${qmaildir}        -s /sbin/nologin qmails -G qcerts || true
+	/usr/bin/getent passwd qscand   > /dev/null || /usr/sbin/useradd -M -g qscand   -d ${qmaildir}/qscanq -G qmail,qscand -s /sbin/nologin qscand || true
+	if [ $nscd_up -ge 1 ] ; then
+		if [ -x /etc/init.d/nscd ] ; then
+			/etc/init.d/nscd start
+		fi
+	fi
+	) > /var/log/indimail-mta-setup.log 2>&1
+	;;
+
+    abort-upgrade)
+    ;;
+
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
--- indimail-mta-3.1.orig/debian/indimail-mta.postinst
+++ indimail-mta-3.1/debian/indimail-mta.postinst
@@ -0,0 +1,565 @@
+#!/bin/sh
+# postinst script for indimail
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+prefix=/usr
+qmaildir=/var/indimail
+mandir=/usr/share/man
+shareddir=/usr/share/indimail
+libexecdir=/usr/libexec/indimail
+qcount=5
+qbase=${qmaildir}/queue
+mbase=/home/mail
+logdir=/var/log/svc
+servicedir=/service
+qsysconfdir=/etc/indimail
+sysconfdir=/etc
+cp=/bin/cp
+rm=/bin/rm
+mv=/bin/mv
+####################################
+nodksignature=0
+notlsarr=0
+tcpserver_plugin=1
+dkimkeyfn=default
+
+log_it() {
+  echo "$(echo  ""|tai64n|tai64nlocal)$*"
+}
+
+setperm()
+{
+	local user="$1"; shift
+	local group="$1"; shift
+	local mode="$1"; shift
+	local file="$1"; shift
+	/usr/sbin/dpkg-statoverride --list "$file" >/dev/null && return 0
+	/usr/sbin/dpkg-statoverride --update --add "$user" "$group" "$mode" "$file"
+}
+
+fixperms()
+{
+	if [ $# -eq 3 ] ; then # directory
+	#%dir %attr(0555,root,indimail) /var/indimail/sbin
+		lin=$2
+		file=$3
+		if [ ! -d $file ] ; then
+			return 0
+		fi
+	elif [ $# = 2 ] ; then # file
+	#%attr(0555,root,qmail) /var/indimail/bin/rsmtp
+		lin=$1
+		file=$2
+		if [ ! -f $file ] ; then
+			return 0
+		fi
+	fi
+	perm=`echo $lin|cut -d\( -f2 | cut -d, -f1`
+	perm_f1=`echo $perm | cut -c1`
+	own=`echo $lin|cut -d\( -f2 | cut -d, -f2`
+	grp=`echo $lin|cut -d\( -f2 | cut -d, -f3|cut -d\) -f1`
+	if [ -f $file ] ; then
+		if [ $perm_f1 -eq 0 ] ; then # 4755, 0644
+			/bin/chown $own:$grp $file
+			/bin/chmod $perm $file
+		else
+			echo $file
+			if [ -f /usr/sbin/dpkg-statoverride ] ; then
+				setperm $own $grp $perm $file
+			else
+				/bin/chown $own:$grp $file
+				/bin/chmod $perm $file
+			fi
+		fi
+	elif [ -d $file ] ; then
+		/bin/chown $own:$grp $file
+		/bin/chmod $perm $file
+	fi
+}
+
+upgrade=0
+case "$1" in
+	configure)
+	if [ -n "$2" ] ; then
+		upgrade=1
+	fi
+	;;
+
+	abort-upgrade|abort-remove|abort-deconfigure)
+	exit 0
+	;;
+
+	*)
+	echo "postinst called with unknown argument \`$1'" >&2
+	exit 1
+	;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+if [ $upgrade -eq 1 ] ; then # upgrade
+	(
+	if [ -f ${libexecdir}/qupgrade ] ; then
+		log_it "Running Custom Upgrade Script for post upgrade"
+		/bin/sh ${libexecdir}/qupgrade post upgrade 3.1 $* | tai64n | tai64nlocal
+	fi
+	) >> /var/log/indimail-mta-setup.log 2>&1
+fi
+#
+# We need to do this for debian. SIGH!!
+#
+if [ -f ${qsysconfdir}/indimail-mta.perms ] ; then
+	(
+	/bin/grep -v "^#" ${qsysconfdir}/indimail-mta.perms | cut -d# -f1 | while read line
+	do
+		if [ " $line" = " " ] ; then
+			continue
+		fi
+		fixperms $line
+	done
+	) > ${qsysconfdir}/indimail-mta-stat.override 2>> /var/log/indimail-mta-setup.log
+	if [ ! -s ${qsysconfdir}/indimail-mta-stat.override ] ; then
+		/bin/rm -f ${qsysconfdir}/indimail-mta-stat.override
+	fi
+fi
+
+if [ $upgrade -eq 1 ] ; then # upgrade
+	(
+	# refresh indimail-mta services
+	svc_list=""
+	for i in clamd greylist.1999 qmail-qmqpd.628 \
+		qmail-qmtpd.209 qmail-smtpd.25 qmail-smtpd.366 \
+		qmail-smtpd.465 qmail-smtpd.587 slowq-send \
+		qmail-daned.1998 qscanq udplogger.3000 \
+		qmail-logfifo .svscan
+	do
+		if [ -d ${servicedir}/$i ] ; then
+			if [ -z "$svc_list" ] ; then
+				svc_list="${servicedir}/$i"
+			else
+				svc_list="$svc_list ${servicedir}/$i"
+			fi
+		fi
+	done
+	svc_list="$svc_list ${qsysconfdir}/control/defaultqueue"
+	${prefix}/sbin/svctool --servicedir=${servicedir} --refreshsvc="$svc_list" | tai64n | tai64nlocal
+
+	set +e
+	if [ -d /run ] ; then
+		rundir=/run
+	elif [ -d /var/run ] ; then
+		rundir=/var/run
+	else
+		rundir=${servicedir}
+	fi
+	log_it "starting indimail-mta services"
+	for i in greylist.1999 qmail-daned.1998 qmail-qmqpd.628 \
+		qmail-qmtpd.209 qmail-send.25 qmail-smtpd.25 \
+		qmail-smtpd.366 qmail-smtpd.465 qmail-smtpd.587 \
+		slowq-send qscanq resolvconf udplogger.3000 \
+		qmail-logfifo
+	do
+		if [ ! -d ${servicedir}/$i ] ; then
+			continue
+		fi
+		${prefix}/bin/svok ${servicedir}/$i 2>&1
+		if [ $? -eq 0 -a -f ${rundir}/$i/.down ] ; then
+			${rm} -f ${rundir}/$i/.down
+			${prefix}/bin/svc -u ${servicedir}/$i
+		fi
+	done
+	set -e
+	) >> /var/log/indimail-mta-setup.log 2>&1
+	exit 0
+fi
+if [ ! "${prefix}" = "/usr" ] ; then
+	# Recreate ld.so links and cache
+	if [ -d ${sysconfdir}/ld.so.conf.d ] ; then
+	log_it "recreating ld.so cache"
+	(
+		if [ -d /usr/lib64 ] ; then
+			echo /usr/lib64
+		else
+			echo /usr/lib
+		fi
+	) > ${sysconfdir}/ld.so.conf.d/indimail-mta-`uname -m`.conf
+	/sbin/ldconfig
+	fi
+else
+	/sbin/ldconfig
+fi
+
+log_it "Doing Post Install"
+echo ""
+echo " 1. Configure ${logdir} for multilog"
+echo " 2. Configure ${servicedir}"
+echo " 3. Configure svscanlog service"
+echo " 4. Configure standard catch-all accounts, default qmail configuration"
+echo " 5. Configure DKIM, Domainkeys signature"
+echo " 6. Configure QHPSI for inline virus scanning"
+echo " 7. Configure SMTP services on port in 465 25 587"
+echo " 8. Configure default queue configuration for sendmail, qmail-inject"
+echo " 9. Configure ODMR service"
+echo "10. Configure greylisting service"
+echo "11. Configure QMTP service"
+echo "12. Configure QMQP service"
+echo "13. Configure udplogger service"
+echo "14. Configure qscanq/clamd/freshclam service"
+echo "15. Configure ${qsysconfdir}/control/signatures"
+echo "16. Configure tcprules database for SMTP, QMTP, QMQP"
+echo "17. Configure indimail-mta startup"
+echo ""
+
+(
+log_it "Creating ${logdir}"
+if [ ! -d ${logdir} ] ; then
+	/bin/mkdir ${logdir}
+fi
+/bin/chown -R qmaill:nofiles ${logdir}
+
+# Misc/Configuration
+log_it "Creating default qmail configuraton and catch-all alias (${qmaildir}/alias/Maildir) for all system users"
+${prefix}/sbin/svctool --config=qmail --fsync --syncdir \
+	--postmaster=${qmaildir}/alias/Maildir/ | tai64n | tai64nlocal
+
+if [ $nodksignature -eq 0 ] ; then
+	if [ -x ${prefix}/bin/dknewkey ] ; then
+		ver_opt="dkim"
+		sign_opt="dkim"
+		if [ " $key_bit" = " " ] ; then
+			key_bit=1024
+		fi
+		${prefix}/bin/dknewkey -b $key_bit ${qsysconfdir}/control/domainkeys/$dkimkeyfn
+	else
+		ver_opt="none"
+		sign_opt="none"
+	fi
+else
+	ver_opt="none"
+	sign_opt="none"
+fi
+a_arch=`uname -m`
+if [ " $a_arch" = " x86_64" ] ; then
+	smtp_soft_mem=104857600
+	qmtp_soft_mem=104857600
+	qmqp_soft_mem=104857600
+	send_soft_mem=104857600
+else
+	smtp_soft_mem=26214400
+	qmtp_soft_mem=26214400
+	qmqp_soft_mem=26214400
+	send_soft_mem=83886080
+fi
+
+log_it "Checking if clamav is installed"
+if [ -f /usr/sbin/clamd -a -f /usr/bin/clamdscan ] ; then
+	have_clamav=1
+	clamdPrefix="/usr"
+	if [ -d ${sysconfdir}/clamav ] ; then
+		mysysconfdir=${sysconfdir}/clamav
+	elif [ -d ${sysconfdir}/clamd.d ] ; then
+		mysysconfdir=${sysconfdir}/clamd.d
+	elif [ -d ${qsysconfdir}] ; then
+		mysysconfdir=${qsysconfdir}
+	else
+		mysysconfdir=${sysconfdir}
+	fi
+	qhpsi="/usr/bin/clamdscan %s --config=${mysysconfdir}/scan.conf --fdpass --quiet --no-summary"
+	# let qscand get qmail group for socket permission
+	/usr/sbin/usermod -aG qmail qscand || true
+else
+	have_clamav=0
+fi
+
+# SMTP
+for port in 465 25 587
+do
+	extra_opt=""
+	if [ $port -eq 465 ] ; then
+		extra_opt="--skipsend --authsmtp --ssl --utf8"
+		extra_opt="$extra_opt --rbl=-rzen.spamhaus.org --rbl=-rdnsbl-1.uceprotect.net"
+	elif [ $port -eq 587 ] ; then
+		# local authenticated users
+		# why bother with spamfilter
+		# if you do, then you have a serious
+		# problem with your organization, not
+		# with IndiMail
+    	extra_opt="--skipsend --forceauthsmtp --secureauth --antispoof --forcetls --utf8"
+	else
+		extra_opt="--remote-authsmtp=login --localfilter --remotefilter"
+		extra_opt="$extra_opt --deliverylimit-count=-1 --deliverylimit-size=-1"
+		extra_opt="$extra_opt --rbl=-rzen.spamhaus.org --rbl=-rdnsbl-1.uceprotect.net"
+		extra_opt="$extra_opt --dmemory=$send_soft_mem --setgroups --setuser-priv --utf8"
+	fi
+	if [ $tcpserver_plugin -eq 1 ] ; then
+		extra_opt="$extra_opt --shared-objects=1 --use-dlmopen=1"
+	fi
+	if [ $have_clamav -eq 1 ] ; then
+		extra_opt="$extra_opt --qhpsi=\"$qhpsi\""
+	fi
+	eval ${prefix}/sbin/svctool --smtp=$port --servicedir=${servicedir} \
+		--qbase=${qbase} --qcount=${qcount} --qstart=1 \
+		--query-cache --dnscheck --password-cache \
+		--cntrldir=control --localip=0 --maxdaemons=75 --maxperip=25 --persistdb \
+		--starttls --memory=$smtp_soft_mem \
+		--chkrecipient --chkrelay --masquerade \
+		--min-free=52428800 --content-filter --virus-filter \
+		--dmasquerade --infifo=infifo \
+		--dkverify=${ver_opt} \
+		--dksign=${sign_opt} --private_key=${qsysconfdir}/control/domainkeys/%/$dkimkeyfn \
+		$extra_opt | tai64n | tai64nlocal
+done
+
+# queue parameters in control/defaultqueue for qmail-inject, sendmail
+extra_opt=""
+if [ $have_clamav -eq 1 ] ; then
+	extra_opt="--qhpsi=\"$qhpsi\""
+fi
+eval ${prefix}/sbin/svctool --queueParam=defaultqueue \
+	--qbase=${qbase} --qcount=${qcount} --qstart=1 \
+	--min-free=52428800 --virus-filter \
+	--dkverify="none" --dksign="none" \
+	$extra_opt | tai64n | tai64nlocal
+
+# slowq service
+eval ${prefix}/sbin/svctool --slowq --servicedir=${servicedir} --qbase=${qbase} \
+	--cntrldir=control --todo-proc --persistdb --starttls \
+    --dmemory=${send_soft_mem} --min-free=52428800 --dkverify=${ver_opt} \
+	--dksign=${sign_opt} --private_key=${qsysconfdir}/control/domainkeys/%/${dkimkeyfn} \
+	--remote-authsmtp=login --localfilter --remotefilter \
+	--deliverylimit-count="-1" --deliverylimit-size="-1" --setgroups --setuser-priv --utf8 | tai64n | tai64nlocal
+
+#odmr
+${prefix}/sbin/svctool --smtp=366 --odmr --servicedir=${servicedir} \
+	--infifo="" --forceauthsmtp --starttls --query-cache --password-cache --skipsend \
+	--memory=$smtp_soft_mem | tai64n | tai64nlocal
+
+# Greylist daemon
+${prefix}/sbin/svctool --greylist=1999 --servicedir=${servicedir} --min-resend-min=2 \
+	--resend-win-hr=24 --timeout-days=30 --context-file=greylist.context \
+	--hash-size=65535 --save-interval=5 --whitelist=greylist.white | tai64n | tai64nlocal
+
+if [ ${notlsarr} -eq 0 ] ; then
+	# qmail-daned tlsa daemon
+	${prefix}/sbin/qmail-daned > /dev/null 2>&1 || \
+	(test $? -ne 100 && ${prefix}/sbin/svctool \
+		--tlsa=1998 --servicedir=${servicedir} \
+		--timeout-days=30 --context-file=tlsa.context \
+		--hash-size=65535 --save-interval=5 --whitelist=tlsa.white ) | tai64n | tai64nlocal || \
+	echo "Not enabling qmail-daned service" 1>&2
+fi
+
+# qmail-qmtpd service
+${prefix}/sbin/svctool --qmtp=209 --servicedir=${servicedir} --qbase=${qbase} \
+	--qcount=${qcount} --qstart=1 --cntrldir=control --localip=0 \
+	--maxdaemons=75 --maxperip=25 \
+	--memory=$qmtp_soft_mem --min-free=52428800 | tai64n | tai64nlocal
+
+# qmail-qmqpd service
+${prefix}/sbin/svctool --qmqp=628 --servicedir=${servicedir} --qbase=${qbase} \
+	--qcount=${qcount} --qstart=1 --cntrldir=control --localip=0 \
+	--maxdaemons=75 --maxperip=25 \
+	--memory=$qmqp_soft_mem --min-free=52428800 | tai64n | tai64nlocal
+/bin/touch ${servicedir}/qmail-qmqpd.628/down
+
+# virus/spam filtering
+${prefix}/sbin/svctool --qscanq --servicedir=${servicedir} --scanint=200 | tai64n | tai64nlocal
+if [ $have_clamav -eq 1 ] ; then
+	${prefix}/sbin/svctool --config=clamd | tai64n | tai64nlocal
+	${prefix}/sbin/svctool --config=foxhole | tai64n | tai64nlocal
+	# create clamd, freshclam service
+	${prefix}/sbin/svctool --clamd --servicedir=${servicedir} --clamdPrefix=$clamdPrefix \
+		--sysconfdir=$mysysconfdir | tai64n | tai64nlocal
+	if [ $have_clamav -eq 1 ] ; then
+		log_it "Checking if clamd/freshclam is running"
+		count=`ps -e|grep clamd|wc -l`
+		if [ $count -gt 0 ] ; then
+			log_it "Disabling clamd service"
+			$TOUCH ${servicedir}/clamd/down
+		fi
+		count=`ps -e|grep freshclam|wc -l`
+		if [ $count -gt 0 ] ; then
+			log_it "Disabling freshclam service"
+			$TOUCH ${servicedir}/freshclam/down
+		fi
+	fi
+fi
+
+# udplogger service
+${prefix}/sbin/svctool --udplogger=3000 --localip=0 --timeout=10 --servicedir=${servicedir} | tai64n | tai64nlocal
+
+/bin/cat <<EOFUU > ${qsysconfdir}/control/signatures
+# Windows executables seen in active virii
+TVqQAAMAA
+TVpQAAIAA
+# Additional windows executable signatures not yet seen in virii
+TVpAALQAc
+TVpyAXkAX
+TVrmAU4AA
+TVrhARwAk
+TVoFAQUAA
+TVoAAAQAA
+TVoIARMAA
+TVouARsAA
+TVrQAT8AA
+# .ZIPfile signature seen in SoBig.E and mydoom:
+#UEsDBBQAA
+#UEsDBAoAAA
+# .GIF file found in a previous Microsoft virus making the rounds.
+R0lGODlhaAA7APcAAP///+rp6puSp6GZrDUjUUc6Zn53mFJMdbGvvVtXh2xre8bF1x8cU4yLprOy
+EOFUU
+/bin/chown qscand:qscand ${qsysconfdir}/control/signatures
+
+if [ -x ${sysconfdir}/init.d/apparmor ] ; then
+if [ $have_clamav -eq 1 ] ; then
+	if [ -d ${sysconfdir}/apparmor.d/local ] ; then
+		reload=0
+		if [ ! -f ${sysconfdir}/apparmor.d/local/usr.sbin.clamd ] ; then
+		(
+		echo "# Site-specific additions and overrides for usr.sbin.clamd."
+		echo "# For more details, please see ${sysconfdir}/apparmor.d/local/README."
+		echo "capability setuid,"
+		echo "capability setgid,"
+		echo "${shareddir}/clamd/ r,"
+		echo "${shareddir}/clamd/** krw,"
+		reload=1
+		) > ${sysconfdir}/apparmor.d/local/usr.sbin.clamd
+		fi
+		if [ ! -f ${sysconfdir}/apparmor.d/local/usr.sbin.freshclam ] ; then
+		(
+		echo "# Site-specific additions and overrides for usr.bin.freshclam."
+		echo "# For more details, please see ${sysconfdir}/apparmor.d/local/README."
+		echo "${shareddir}/share/clamd/ r,"
+		echo "${shareddir}/share/clamd/** krw,"
+		reload=1
+		) > ${sysconfdir}/apparmor.d/local/usr.bin.freshclam
+		fi
+		if [ $reload -ne 0 ] ; then
+			log_it "Reloading apparmor profiles..."
+			/usr/sbin/service apparmor reload || true
+		fi
+	fi
+fi
+fi
+
+# rebuild cdb
+for i in smtp qmtp qmqp
+do
+	for j in `/bin/ls ${qsysconfdir}/tcp/tcp.$i 2>/dev/null`
+	do
+		t1=`date +'%s' -r $j`
+		if [ -f $j.cdb ] ; then
+			t2=`date +'%s' -r $j.cdb`
+		else
+			t2=0
+		fi
+		if [ $t1 -gt $t2 ] ; then
+			log_it "Creating CDB $j.cdb"
+			${prefix}/bin/tcprules $j.cdb $j.tmp < $j && /bin/chmod 664 $j.cdb \
+				&& /bin/chown indimail:indimail $j.cdb
+		fi
+	done
+done
+
+# turn off automatic refresh for services during first time installation
+svc_list=""
+for i in clamd greylist.1999 qmail-qmqpd.628 \
+	qmail-qmtpd.209 qmail-smtpd.25 qmail-smtpd.366 \
+	qmail-smtpd.465 qmail-smtpd.587 qscanq udplogger.3000 \
+	qmail-daned.1998 qmail-send.25 slowq-send qmail-logfifo \
+	resolvconf
+do
+	if [ -d ${servicedir}/$i ] ; then
+		svc_list="$svc_list ${servicedir}/$i"
+		# save variables
+		${prefix}/sbin/svctool --servicedir=${servicedir} --service-name=$i \
+			--export-variables=${servicedir}/$i/variables/.variables  --force | tai64n | tai64nlocal
+	fi
+done
+svc_list="$svc_list ${qsysconfdir}/control/defaultqueue"
+${prefix}/sbin/svctool --servicedir=${servicedir} --autorefresh="0 $svc_list" | tai64n | tai64nlocal
+
+log_it "compressing man pages"
+find ${mandir} -type f -exec gzip -q {} \;
+if [ -f ${mandir}/man7/authlib.7.gz ] ; then
+	for i in authshadow.7 authpwd.7 authpam.7 authcustom.7
+	do
+		${rm} -f ${mandir}/man7/$i
+		ln -sf ${mandir}/man7/authlib.7.gz ${mandir}/man7/$i.gz
+	done
+fi
+
+#
+if [ /usr/lib/sm.bin/sendmail ] ; then
+	log_it "removing sendmail as alternative"
+	if [ -x /usr/sbin/update-alternatives ] ; then
+	/usr/sbin/update-alternatives --remove-all sendmail-mta || true
+	/usr/sbin/update-alternatives --remove-all sendmail-msp || true
+	elif [ -x /usr/bin/update-alternatives ] ; then
+	/usr/bin/update-alternatives --remove-all sendmail-mta || true
+	/usr/bin/update-alternatives --remove-all sendmail-msp || true
+	fi
+fi
+${prefix}/sbin/svctool --disable-service sendmail exim4 postfix | tai64n | tai64nlocal
+log_it "adding indimail-mta as an alternative"
+${prefix}/sbin/svctool --config=add-alt | tai64n | tai64nlocal
+
+if [ -x ${libexecdir}/instcheck.indimail-mta ] ; then
+	log_it "Checking Installed Permissions"
+	${libexecdir}/instcheck.indimail-mta > /dev/null 2>&1
+fi
+
+) >> /var/log/indimail-mta-setup.log 2>&1
+
+if [ -f ${sysconfdir}/init/svscan.conf -o -f ${sysconfdir}/event.d/svscan ] ; then
+	echo "1. Execute /sbin/initctl emit qmailstart to start services"
+	count=1
+elif [ -f ${sysconfdir}/systemd/system/multi-user.target.wants/svscan.service ] ; then
+	echo "1. Execute /bin/systemctl start svscan to start services"
+	count=1
+else
+	if [ -x ${prefix}/sbin/initsvc ] ; then
+	echo "1. Execute ${prefix}/sbin/initsvc -on"
+	else
+	echo "1. Execute ${sysconfdir}/init.d/svscan start"
+	fi
+	echo "2. Execute /sbin/init q to start services"
+	count=2
+fi
+default_domain=$(echo $([ -n "$HOSTNAME" ] && echo "$HOSTNAME" || uname -n) | sed 's/^\([^\.]*\)\.\([^\.]*\)\./\2\./')
+echo "   You can also use the 'service' command to start indimail-mta"
+echo "   sudo service svscan start"
+count=`expr $count + 1`
+echo "$count. Change your default domain in ${qsysconfdir}/control/defaultdomain"
+count=`expr $count + 1`
+echo "$count. You can optionally run the following command to verify installation"
+echo "   sudo ${prefix}/sbin/svctool --check-install --servicedir=${servicedir} \\"
+echo "       --qbase=${qbase} --qcount=${qcount} --qstart=1"
+if [ ! -f ${qsysconfdir}/certs/servercert.pem ] ; then
+count=`expr $count + 1`
+echo "$count. You need to create CERTS for SSL/TLS/STARTTLS"
+echo "   Execute the following command to create the certificate"
+echo "   ${prefix}/sbin/svctool --config=cert --postmaster=postmaster@${default_domain} --common_name=${default_domain}"
+fi
+echo
+log_it "Look at /var/log/indimail-mta-setup.log for the installation log"
+
+exit 0
--- indimail-mta-3.1.orig/debian/indimail-mta.prerm
+++ indimail-mta-3.1/debian/indimail-mta.prerm
@@ -0,0 +1,114 @@
+#!/bin/sh
+# prerm script for indimail
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+prefix=/usr
+qmaildir=/var/indimail
+shareddir=/usr/share/indimail
+libexecdir=/usr/libexec/indimail
+mandir=/usr/share/man
+qsysconfdir=/etc/indimail
+servicedir=/service
+rm=/bin/rm
+mv=/bin/mv
+nocourierimap=0
+
+log_it() {
+  echo "$(echo  ""|tai64n|tai64nlocal)$*"
+}
+
+case "$1" in
+    remove|upgrade|deconfigure)
+	(
+	if [ -f ${libexecdir}/qupgrade.sh ] ; then
+		log_it "Running Custom Upgrade Script for pre $1"
+		/bin/sh ${libexecdir}/qupgrade.sh prerm $1 3.1 $* | tai64n | tai64nlocal
+	fi
+	if [ -d /run ] ; then
+		rundir=/run
+	elif [ -d /var/run ] ; then
+		rundir=/var/run
+	else
+		rundir=${servicedir}
+	fi
+	set +e
+	log_it "shutting down indimail services"
+	for i in greylist.1999 qmail-qmqpd.628 \
+		qmail-qmtpd.209 qmail-smtpd.25 qmail-smtpd.366 \
+		qmail-smtpd.465 qmail-smtpd.587 qmail-daned.1998 \
+		qscanq udplogger.3000
+	do
+		${prefix}/bin/svstat ${servicedir}/$i
+		if [ $? -eq 0 ] ; then
+			mkdir -p ${rundir}/$i
+			touch ${rundir}/$i/.down
+			${prefix}/bin/svc -d ${servicedir}/$i >/dev/null 2>&1
+		fi
+	done
+	set -e
+	) >> /var/log/indimail-mta-setup.log 2>&1
+	;;
+
+    failed-upgrade)
+    ;;
+
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+# we are doing upgrade
+if [ " $1" = " upgrade" -o " $1" = " deconfigure" ] ; then
+	exit 0
+fi
+
+(
+if [ -s ${qsysconfdir}/indimail-mta-stat.override -a -f /usr/sbin/dpkg-statoverride ] ; then
+	log_it "reverting permissions"
+	/bin/cat ${qsysconfdir}/indimail-mta-stat.override | while read line
+	do
+		if [ -f $line ] ; then
+			log_it "reverting permission for $line"
+			/usr/sbin/dpkg-statoverride --remove $line || true
+		fi
+	done
+fi
+log_it "removing indimail-mta as an alternative"
+$prefix/sbin/svctool --config=remove-alt
+
+if [ $nocourierimap -eq 0 ] ; then
+	for i in authshadow.7 authpwd.7 authpam.7 authcustom.7
+	do
+		${rm} -f ${mandir}/man7/$i.gz || true
+	done
+	${rmdir} --ignore-fail-on-non-empty ${mandir}/man7 2>/dev/null || true
+fi
+
+for i in lib sbin
+do
+	if [ -f /usr/$i/sendmail.old ] ; then
+		${mv} /usr/$i/sendmail.old /usr/$i/sendmail
+	fi
+done
+exit 0
+) >> /var/log/indimail-mta-setup.log 2>&1
--- indimail-mta-3.1.orig/debian/indimail-mta.postrm
+++ indimail-mta-3.1/debian/indimail-mta.postrm
@@ -0,0 +1,256 @@
+#!/bin/sh
+# postrm script for indimail
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <overwriter>
+#          <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+prefix=/usr
+qmaildir=/var/indimail
+qsysconfdir=/etc/indimail
+shareddir=/usr/share/indimail
+libexecdir=/usr/libexec/indimail
+mandir=/usr/share/man
+servicedir=/service
+logdir=/var/log/svc
+rm=/bin/rm
+rmdir=/bin/rmdir
+####################################
+default_domain=indimail.org
+
+log_it() {
+  echo "$(echo  ""|tai64n|tai64nlocal)$*"
+}
+
+case "$1" in
+    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+	if [ -f ${libexecdir}/qupgrade.sh ] ; then
+	(
+		log_it "Running Custom Upgrade Script for pre $1"
+		/bin/sh ${libexecdir}/qupgrade.sh postrm $1 3.1 $* | tai64n | tai64nlocal
+	) >> /var/log/indimail-mta-setup.log 2>&1
+	fi
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+# we are doing upgrade or removal
+if [ " $1" = " upgrade" ] ; then
+	if [ ! "${prefix}" = "/usr" ] ; then
+		log_it "recreating ld.so cache"
+		/sbin/ldconfig
+	fi
+	exit 0
+fi
+
+case "$1" in
+    failed-upgrade|abort-install|abort-upgrade|disappear)
+	exit 0
+    ;;
+esac
+#
+# Debian silliness
+#
+if [ " $1" = " purge" ] ; then
+	nscd_up=`ps -ef |grep nscd |grep -v grep|wc -l`
+	if [ $nscd_up -ge 1 ] ; then
+		if [ -x /etc/init.d/nscd ] ; then
+			/etc/init.d/nscd stop
+		elif [ -f /etc/systemd/system/multi-user.target/nscd.service ] ; then
+			/bin/systemctl stop nscd.service >/dev/null 2>&1 || true
+		fi
+	fi
+	(
+	for i in alias qmaild qmailp qmailq qmailr qmails qscand indimail
+	do
+		log_it "removing user $i"
+		/usr/bin/getent passwd $i > /dev/null && /usr/sbin/userdel $i >/dev/null || true
+	done
+	for i in qmail qscand indimail qcerts
+	do
+		log_it "removing group $i"
+		/usr/bin/getent group $i > /dev/null && /usr/sbin/groupdel $i  >/dev/null || true
+	done
+	if [ $nscd_up -ge 1 ] ; then
+		if [ -x /etc/init.d/nscd ] ; then
+			/etc/init.d/nscd start
+		elif [ -f /etc/systemd/system/multi-user.target/nscd.service ] ; then
+			/bin/systemctl start nscd.service >/dev/null 2>&1 || true
+		fi
+	fi
+
+	log_it "removing configuration"
+	for i in .qmail-nonspam .qmail-register-nonspam .qmail-register-spam .qmail-spam .qmail-default
+	do
+		${rm} -f ${qmaildir}/domains/${default_domain}/$i
+	done
+	if [ -d ${qmaildir}/domains/${default_domain} ] ; then
+		${rmdir} --ignore-fail-on-non-empty ${qmaildir}/domains/${default_domain} 2>/dev/null || true
+	fi
+	${rmdir} --ignore-fail-on-non-empty ${qmaildir}/domains 2>/dev/null || true
+
+	log_it "removing aliases postmaster, mailer-daemon, root"
+	for i in postmaster mailer-daemon root
+	do
+		${rm} -f ${qmaildir}/alias/.qmail-"$i"
+	done
+	${rm} -rf ${qmaildir}/Maildir ${qmaildir}/alias/Maildir
+	if [ -d ${qmaildir}/alias ] ; then
+		${rmdir} --ignore-fail-on-non-empty ${qmaildir}/alias 2>/dev/null || true
+	fi
+
+	log_it "removing tcp configuration"
+	${rm} -f ${qsysconfdir}/resolv.conf
+	for i in smtp qmtp qmqp
+	do
+		${rm} -f ${qsysconfdir}/tcp/tcp.$i.cdb ${qsysconfdir}/tcp/tcp.$i
+	done
+	${rm} -f ${qsysocnfdir}/control/controlfiles.q
+	for i in chkrcptdomains defaulthost greylist.white me signatures tlsclientmethod \
+		databytes dnsbllist hostip plusdomain smtpgreeting tlsserverciphers \
+		defaultdelivery envnoathost localiphost queue_base timeoutremote tlsservermethod \
+		defaultdomain filterargs locals rcpthosts timeoutsmtpd
+	do
+		${rm} -f ${qsysconfdir}/control/$i
+	done
+	for i in indimail.cnf indimail-mta-stat.override backup.conf \
+		cronlist.q headerlist inc_deps indimail.mrtg.cfg \
+		procmailrc indimail.settings lib_deps osh.table \
+		quotawarnmsg.example services.log
+	do
+		${rm} -f ${qsysconfdir}/$i
+	done
+	for i in rsa2048.pem rsa1024.pem servercert.cnf servercert.pem dh1024.pem \
+		dh2048.pem dh512.pem rsa512.pem servercert.rand clientcert.pem dhparams.pem
+	do
+		${rm} -f ${qsysconfdir}/certs/$i
+	done
+
+	log_it "removing binaries, libraries, queues"
+	if [ ${prefix} = "/var/indimail" -o ${prefix} = "/var/qmail" ] ; then
+		for i in bin sbin queue
+		do
+			${rm} -rf ${prefix}/$i || true
+		done
+		log_it "removing man pages"
+		for i in ${prefix}/bin ${prefix}/sbin ${prefix}/lib ${prefix}/queue \
+			${mandir}/man1 ${mandir}/cat1 ${mandir}/man5 \
+			${mandir}/cat5 ${mandir}/man7 ${mandir}/cat7 \
+			${mandir}/man8 ${mandir}/cat8 ${mandir}/man3
+		do
+			${rm} -rf $i || true
+		done
+		for i in `/bin/ls ${shareddir} 2>/dev/null`
+		do
+			if [ " $i" = " clamd" ] ; then # leave the signatures
+				continue;
+			fi
+			${rm} -rf ${shareddir}/$i || true
+		done
+	else
+		for i in bin sbin control users
+		do
+			${rm} -f ${qmaildir}/$i || true
+		done
+		# queue
+		${rm} -rf ${qmaildir}/queue || true
+		# modules
+		${rm} -rf ${prefix}/lib/indimail || true
+		# shareddir
+		if [ ! " ${shareddir}" = " /usr/share" ] ; then
+			for i in `/bin/ls ${shareddir} 2>/dev/null`
+			do
+				${rm} -rf ${shareddir}/$i || true
+			done
+		fi
+		# libexecdir
+		if [ ! " ${libexecdir}" = " /usr/libexec" ] ; then
+			${rm} -rf ${libexecdir} || true
+		fi
+	fi
+	for i in assign cdb
+	do
+    	${rm} -f ${qsysconfdir}/users/$i
+	done
+	if [ -d ${qsysconfdir}/users ] ; then
+	${rmdir} --ignore-fail-on-non-empty ${qsysconfdir}/users || true
+	fi
+	${rm} -f ${qsysconfdir}/control/domainkeys/default.pub ${qsysconfdir}/control/domainkeys/default
+	if [ -d ${qsysconfdir}/control/domainkeys ] ; then
+		${rmdir} --ignore-fail-on-non-empty ${qsysconfdir}/control/domainkeys 2>/dev/null || true
+	fi
+	if [ -d ${qsysconfdir}/control/defaultqueue ] ; then
+	${rm} -rf ${qsysconfdir}/control/defaultqueue 2>/dev/null || true
+	fi
+	if [ -d ${qsysconfdir}/control ] ; then
+	${rmdir} --ignore-fail-on-non-empty ${qsysconfdir}/control || true
+	fi
+	if [ -d ${qsysconfdir}/certs ] ; then
+	${rmdir} --ignore-fail-on-non-empty ${qsysconfdir}/certs || true
+	fi
+	log_it "removing man pages"
+	${rmdir} --ignore-fail-on-non-empty ${qmaildir} 2>/dev/null || true
+
+	log_it "removing startup services"
+    for i in clamd greylist.1999 qmail-send.25 qmail-qmqpd.628 \
+      qmail-qmtpd.209 qmail-smtpd.25 qmail-smtpd.366 \
+      qmail-smtpd.465 qmail-smtpd.587 qmail-daned.1998 \
+      slowq-send qscanq udplogger.3000 .svscan
+	do
+		if [ -d ${servicedir}/$i -o -L ${servicedir}/$i ] ; then
+			touch ${servicedir}/$i/down
+			svc -dx ${servicedir}/$i >/dev/null 2<&1 || true
+		fi
+		if [ -d ${servicedir}/$i/log -o -L ${servicedir}/$i/log ] ; then
+			touch ${servicedir}/$i/log/down
+			svc -dx ${servicedir}/$i/log >/dev/null 2<&1 || true
+		fi
+		if [ -d ${servicedir}/$i -o -L ${servicedir}/$i ] ; then
+			${rm} -rf ${servicedir}/$i >/dev/null 2>&1 || true
+		fi
+	done
+
+	count=`/bin/ls ${servicedir} 2>/dev/null| /usr/bin/wc -l`
+	if [ $count -eq 0 ] ; then
+		${rmdir} --ignore-fail-on-non-empty ${servicedir} || true
+	fi
+	log_it "removing logs"
+	for i in deliver.25 smtpd.25 smtpd.366 smtpd.465 \
+		smtpd.587 qmtpd.209 qmqpd.628 greylist.1999 \
+		daned.1998 resolvconf udplogger.3000 slowq-send \
+		logfifo
+	do
+		if [ -d ${logdir}/$i ] ; then
+			rm -fr ${logdir}/$i
+		fi
+	done
+	) >> /var/log/indimail-mta-setup.log 2>&1
+fi
+if [ ! "${prefix}" = "/usr" ] ; then
+	log_it "recreating ld.so cache"
+	/sbin/ldconfig
+fi
+exit 0
--- indimail-mta-3.1.orig/debian/rules
+++ indimail-mta-3.1/debian/rules
@@ -0,0 +1,157 @@
+#!/usr/bin/make -f
+
+# -*- makefile -*-
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+export DEB_CFLAGS_MAINT_APPEND = "-fno-lto"
+export DEB_LDFLAGS_MAINT_APPEND = "-fno-lto"
+
+# This is the debhelper compatibility version to use.
+# export DH_COMPAT=4
+DPKG_EXPORT_BUILDFLAGS = 1
+include /usr/share/dpkg/buildflags.mk
+
+prefix=/usr
+qmaildir=/var/indimail
+sysconfdir=/etc
+qsysconfdir=/etc/indimail
+shareddir=/usr/share/indimail
+libexecdir=/usr/libexec/indimail
+servicedir=/service
+mandir=/usr/share/man
+
+version=3.1
+tcpserver_plugin=1
+notlsarr=0
+# check https://wiki.debian.org/Multiarch/Implementation#Dynamic_debian.2F.2A_files
+libd=$(shell if [ -d $(prefix)/lib/$(arch)-linux-gnu ] ; then echo lib/$(arch)-linux-gnu; else echo lib;fi)
+cp=/bin/cp
+rm=/bin/rm
+
+DESTDIR=$(CURDIR)/debian/indimail-mta.tmp
+
+build: build-stamp
+build-stamp:
+	dh_testdir
+	#
+	# configure
+	#
+	if [ $(tcpserver_plugin) -eq 1 ] ; then \
+		echo "-DLOAD_SHARED_OBJECTS" > conf-dlopen; \
+	else \
+		/bin/rm -f conf-dlopen; \
+	fi
+	if [ $(notlsarr) -eq 0 ] ; then \
+		echo "-DHASTLSA" > conf-tlsa; \
+	else \
+		/bin/rm -f conf-tlsa; \
+	fi
+	#
+	# run make
+	#
+	sed 's{PREFIX{${prefix}{'          conf-prefix.in     > conf-prefix
+	sed 's{QMAIL{${qmaildir}{'         conf-qmail.in      > conf-qmail
+	sed 's{SYSCONFDIR{${qsysconfdir}{' conf-sysconfdir.in > conf-sysconfdir
+	sed 's{SHAREDDIR{${shareddir}{'    conf-shared.in     > conf-shared
+	sed 's{LIBEXECDIR{${libexecdir}{'  conf-libexec.in    > conf-libexec
+	sed 's{SERVICEDIR{${servicedir}{'  conf-servicedir.in > conf-servicedir
+	sed -i 's/-Wformat.*//g' conf-cc-LINUX
+	$(MAKE) CFLAGS="$(dpkg-buildflags --get CFLAGS) ${CFLAGS}" LDFLAGS="$(dpkg-buildflags --get LDFLAGS) ${LDFLAGS}"  SYSTEM=LINUX -s DESTDIR=$(DESTDIR)
+	touch build-stamp
+
+clean:
+	rm -f build-stamp configure-stamp
+	${rm} -rf $(DESTDIR)
+	FAKED_MODE=1;export FAKED_MODE
+	$(MAKE) SYSTEM=LINUX -s clean||true
+	unset FAKED_MODE
+	dh_testdir
+	dh_testroot
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_prep || dh_clean -k
+	dh_installdirs
+	FAKED_MODE=1;export FAKED_MODE
+	$(MAKE) SYSTEM=LINUX -s install DESTDIR=$(DESTDIR)
+	if [ -f indimail-mta.perms ] ; then \
+		mkdir -p $(DESTDIR)$(qsysconfdir); \
+		install -m 0644 indimail-mta.perms "$(DESTDIR)$(qsysconfdir)"/indimail-mta.perms; \
+	fi
+	unset FAKED_MODE
+	mkdir -p $(DESTDIR)$(qsysconfdir)/control/defaultqueue
+	mkdir -p $(DESTDIR)$(qsysconfdir)/control/global_vars
+	head -1 conf-split > $(DESTDIR)/$(qsysconfdir)/control/global_vars/CONFSPLIT
+	${rm} -rf $(DESTDIR)$(mandir)/man3
+	if [ ! -d $(DESTDIR)$(sysconfdir)/apparmor.d/local ] ; then \
+		mkdir -p $(DESTDIR)$(sysconfdir)/apparmor.d/local; \
+	fi
+	if [ -f ../SOURCES/usr.sbin.clamd ] ; then \
+		${cp} ../SOURCES/usr.sbin.clamd $(DESTDIR)$(sysconfdir)/apparmor.d/local; \
+	fi
+	if [ -f ../SOURCES/usr.bin.freshclam ] ; then \
+		${cp} ../SOURCES/usr.bin.freshclam $(DESTDIR)$(sysconfdir)/apparmor.d/local; \
+	fi
+	if [ -f ../BUILD/debian/usr.sbin.clamd ] ; then \
+		${cp} ../BUILD/debian/usr.sbin.clamd $(DESTDIR)$(sysconfdir)/apparmor.d/local; \
+	fi
+	if [ -f ../BUILD/debian/usr.bin.freshclam ] ; then \
+		${cp} ../BUILD/debian/usr.bin.freshclam $(DESTDIR)$(sysconfdir)/apparmor.d/local; \
+	fi
+	# for indimail-mini we require an empty control directory
+	# so we create a directory and use that in indimail-mini.install
+	# and qmta.install
+	mkdir -p $(DESTDIR)/etc-mini/indimail/control/defaultqueue
+	mkdir -p $(DESTDIR)/etc-qmta/indimail/control/defaultqueue
+	mkdir -p $(DESTDIR)/etc-qmta/indimail/control/global_vars
+	echo "${prefix}/sbin/qmail-qmqpc" > $(DESTDIR)/etc-mini/indimail/control/defaultqueue/QMAILQUEUE
+	echo "${prefix}/sbin/qmail-queue" > $(DESTDIR)/etc-qmta/indimail/control/defaultqueue/QMAILQUEUE
+	echo "${qmaildir}/queue/qmta"     > $(DESTDIR)/etc-qmta/indimail/control/defaultqueue/QUEUEDIR
+	head -1 conf-split > $(DESTDIR)/etc-qmta/indimail/control/global_vars/CONFSPLIT
+	if [ -f indimail-mta.perms ] ; then \
+		install -m 0644 indimail-mta.perms  $(DESTDIR)/etc-mini/indimail/indimail-mini.perms; \
+		install -m 0644 indimail-mta.perms  $(DESTDIR)/etc-qmta/indimail/qmta.perms; \
+	fi
+	if [ -f qupgrade ] ; then \
+		mkdir -p $(DESTDIR)$(libexecdir); \
+		install -m 0755 qupgrade "$(DESTDIR)$(libexecdir)"/qupgrade; \
+	fi
+	if [ -f qlocal_upgrade ] ; then \
+		mkdir -p $(DESTDIR)$(libexecdir); \
+		install -m 0755 qlocal_upgrade "$(DESTDIR)$(libexecdir)"/qlocal_upgrade; \
+	fi
+
+binary-indep: build install
+	dh_testdir
+	dh_testroot
+	find $(DESTDIR)$(mandir) -name '*'.? -type f -exec gzip -q {} \;
+	sed -i -e 's,@libd\@,$(libd),g' debian/indimail-mta.install
+	sed -i -e 's,@libd\@,$(libd),g' debian/indimail-mini.install
+	sed -i -e 's,@libd\@,$(libd),g' debian/qmta.install
+	chmod 755 $(DESTDIR)${prefix}/sbin/qhpsi $(DESTDIR)${prefix}/sbin/run-cleanq $(DESTDIR)${prefix}/sbin/qmail-queue \
+		$(DESTDIR)${prefix}/sbin/qscanq $(DESTDIR)${prefix}/sbin/sys-checkpwd $(DESTDIR)${prefix}/sbin/qmail-dkim
+	dh_install --sourcedir=$(DESTDIR) -pindimail-mta
+	dh_install --sourcedir=$(DESTDIR) -pindimail-mini
+	dh_install --sourcedir=$(DESTDIR) -pqmta
+	dh_installchangelogs
+	dh_installcron
+	dh_installdocs
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_makeshlibs -V
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+# Build architecture-dependent files here. 
+binary-arch: build install
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
--- indimail-mta-3.1.orig/debian/changelog
+++ indimail-mta-3.1/debian/changelog
@@ -0,0 +1,13 @@
+indimail-mta (3.1-1.1+56.1) stable; urgency=low
+
+  * version number update by debtransform
+
+ -- debtransform <build@opensuse.org>  Thu, 23 Apr 2026 15:44:07 +0000
+
+indimail-mta (3.1-1.1) stable; urgency=low
+
+  * removed unused include file getln.h: filterto.c, qmail-inject.c, qmaildirwatch.c, qreceipt.c
+  * fixed line length: smtpd.c, spawn-filter.c
+  * indimail-mta.spec: fixed dkimkey file path
+
+ -- Manvendra Bhangui <indimail-mta@indimail.org>  Thu, 23 Apr 2026 13:37:27 +0000
--- indimail-mta-3.1.orig/debian/compat
+++ indimail-mta-3.1/debian/compat
@@ -0,0 +1,1 @@
+10
--- indimail-mta-3.1.orig/debian/control
+++ indimail-mta-3.1/debian/control
@@ -0,0 +1,53 @@
+Source: indimail-mta
+Section: mail
+Priority: extra
+Maintainer: Manvendra Bhangui <indimail-mta@indimail.org>
+Standards-Version: 3.9.5
+Build-Depends: cdbs, debhelper (>= 9), gcc, g++, binutils, automake, libdkim2-dev, libsrs2-dev, libqmail-dev (>= 1.4), libldap2-dev, libssl-dev, m4, gawk
+Homepage: https://github.com/indimail/indimail-mta
+
+Package: indimail-mta
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, daemontools, ucspi-tcp, net-tools, coreutils, diffutils, procps
+Provides: indimail-mini, default-mta, mail-transport-agent
+Conflicts: indimail-mini, qmta
+Replaces: indimail-mini, qmta
+Description: indimail-mta provides a MTA that is part of the IndiMail
+ messaging platform. The base is built on the following software code
+ written by Dan J. Bernstein <djb@cr.yp.to>
+ .
+ qmail,
+ serialmail,
+ qmailanalog,
+ dotforward,
+ fastforward,
+ mess822
+ .
+ The package provides most features required in a modern MTA missing
+ in qmail.
+
+Package: indimail-mini
+Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, diffutils, procps
+Provides: default-mta, mail-transport-agent
+Section: misc
+Architecture: any
+Breaks: indimail-mta, qmta
+Description: IndiMail - Mini Client Installation
+ This package contains sendmail, qmail-inject and qmail-qmqpc - Bare minimum
+ programs to have a indimail-mini installation.
+ .
+ A indimail-mini installation doesn't have a mail queue. It gives each new message to a
+ central server using QMQP.
+
+Package: qmta
+Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, diffutils, procps
+Provides: default-mta, mail-transport-agent
+Section: misc
+Architecture: any
+Breaks: indimail-mta, indimail-mini
+Description: qmta - A minimal Mail Transport Agent
+ This package contains the qmta-send mail transport agent and bare minimum
+ programs to deliver local and remote mails.
+ .
+ A qmta installation doesn't have multiple daemons handling a queue. The
+ queue is handled by a single daemon/binary - qmta-send
--- indimail-mta-3.1.orig/debian/usr.bin.freshclam
+++ indimail-mta-3.1/debian/usr.bin.freshclam
@@ -0,0 +1,5 @@
+# Site-specific additions and overrides for usr.bin.freshclam.
+# For more details, please see /etc/apparmor.d/local/README.
+
+  /var/indimail/clamd/ r,
+  /var/indimail/clamd/** krw,
--- indimail-mta-3.1.orig/debian/usr.sbin.clamd
+++ indimail-mta-3.1/debian/usr.sbin.clamd
@@ -0,0 +1,7 @@
+# Site-specific additions and overrides for usr.sbin.clamd.
+# For more details, please see /etc/apparmor.d/local/README.
+
+  capability setuid,
+  capability setgid,
+  /var/indimail/clamd/ r,
+  /var/indimail/clamd/** krw,
--- indimail-mta-3.1.orig/debian/indimail-mini.prerm
+++ indimail-mta-3.1/debian/indimail-mini.prerm
@@ -0,0 +1,84 @@
+#!/bin/sh
+# prerm script for indimail-mini
+#
+# see: dh_installdeb(1)
+
+set -e
+prefix=/usr
+rm=/bin/rm
+mv=/bin/mv
+
+ID=`id -u`
+if [ $ID -ne 0 ] ; then
+	echo "You are not root" >&2
+	exit 1
+fi
+
+case "$1" in
+    remove|upgrade|deconfigure)
+    ;;
+
+    failed-upgrade)
+    ;;
+
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+# we are doing upgrade
+if [ " $1" = " upgrade" -o " $1" = " deconfigure" ] ; then
+	exit 0
+fi
+
+# Remove IndiMail being started on system boot
+echo "adding sendmail startup"
+if [ -f /etc/init.d/sendmail ] ; then
+	if [ -f /sbin/chkconfig ] ; then
+		/sbin/chkconfig --add sendmail 2>/dev/null
+	fi
+fi
+if [ -x /usr/sbin/alternatives ] ; then
+	echo "removing ${prefix}/bin/sendmail as alternative"
+	/usr/sbin/alternatives --remove sendmail-msp ${prefix}/bin/sendmail || true
+	echo "adding default alternative for sendmail"
+	/usr/sbin/alternatives --auto sendmail-msp || true
+elif [ -x /usr/sbin/update-alternatives ] ; then
+	echo "removing ${prefix}/bin/sendmail as alternative"
+	if [ -f /usr/lib/sm.bin/sendmail ] ; then
+		/usr/sbin/update-alternatives --remove-all sendmail-msp || true
+		echo "adding default alternative for sendmail"
+		/usr/sbin/update-alternatives --install \
+			/usr/sbin/sendmail-msp sendmail-msp /usr/lib/sm.bin/sendmail 25 \
+			--slave /usr/share/man/man8/sendmail-msp.8.gz sendmail-msp.8.gz \
+				/usr/share/man/man8/sendmail.sendmail.8.gz \
+			--slave /usr/sbin/sendmail sendmail /usr/lib/sm.bin/sendmail \
+			--slave /usr/lib/sendmail lib.sendmail /usr/lib/sm.bin/sendmail \
+			--slave /usr/share/man/man8/sendmail.8.gz sendmail.8.gz \
+				/usr/share/man/man8/sendmail.sendmail.8.gz || true
+	else
+		/usr/sbin/update-alternatives --remove sendmail-msp ${prefix}/bin/sendmail || true
+		echo "adding default alternative for sendmail"
+		/usr/sbin/update-alternatives --auto sendmail-msp || true
+	fi
+fi
+for i in /usr/lib/sendmail /usr/sbin/sendmail /etc/pam.d/smtp; do
+	if [ -f $i.old -o -L $i.old ]; then
+		echo "restoring $i"
+		${rm} -f $i
+		${mv} $i.old $i
+	fi
+done
+for i in mailq newaliases; do
+	if [ -f /usr/share/man/man1/$i.old.1.gz ] ; then
+		echo "restoring /usr/share/man/man1/$i.1.gz"
+		${mv} /usr/share/man/man1/$i.old.1.gz /usr/share/man/man1/$i.1.gz
+	fi
+done
+exit 0
--- indimail-mta-3.1.orig/debian/indimail-mini.preinst
+++ indimail-mta-3.1/debian/indimail-mini.preinst
@@ -0,0 +1,68 @@
+#!/bin/sh
+set -e
+prefix=/usr
+qmaildir=/var/indimail
+rm=/bin/rm
+
+ID=`id -u`
+if [ $ID -ne 0 ] ; then
+	echo "You are not root" >&2
+	exit 1
+fi
+#
+# Create user/groups indimail. Do not report any problems if it already
+# exists.
+#
+
+case "$1" in
+	upgrade)
+	;;
+	install)
+	mkdir -p /tmp/indimail-mini
+	chmod 700 /tmp/indimail-mini
+	touch /tmp/indimail-mini/.install
+	nscd_up=`ps -ef |grep nscd |grep -v grep|wc -l`
+	if [ $nscd_up -ge 1 ] ; then
+		if [ -x /etc/init.d/nscd ] ; then
+			/etc/init.d/nscd stop
+		elif [ -f /etc/systemd/system/multi-user.target/nscd.service ] ; then
+			/bin/systemctl stop nscd.service >/dev/null 2>&1 || true
+		fi
+	fi
+	echo "Adding IndiMail users/groups"
+	set +e
+	/usr/bin/getent group indimail  > /dev/null || /usr/sbin/groupadd -r -g 555 indimail
+	if [ $? = 4 ] ; then
+		/usr/sbin/groupadd indimail || true
+	fi
+	/usr/bin/getent group qmail     > /dev/null || /usr/sbin/groupadd qmail    || true
+	/usr/bin/getent passwd indimail > /dev/null || /usr/sbin/useradd -r -g indimail -u 555 -d ${qmaildir} indimail
+	if [ $? = 4 ] ; then
+		/usr/sbin/useradd -r -g indimail -d ${prefix} indimail
+	fi
+	set -e
+	${rm} -f /var/spool/mail/indimail
+	if [ $nscd_up -ge 1 ] ; then
+		if [ -x /etc/init.d/nscd ] ; then
+			/etc/init.d/nscd start
+		elif [ -f /etc/systemd/system/multi-user.target/nscd.service ] ; then
+			/bin/systemctl start nscd.service >/dev/null 2>&1 || true
+		fi
+	fi
+	;;
+
+	abort-upgrade)
+	;;
+
+	*)
+	echo "preinst called with unknown argument \`$1'" >&2
+	exit 1
+	;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
--- indimail-mta-3.1.orig/debian/indimail-mini.postrm
+++ indimail-mta-3.1/debian/indimail-mini.postrm
@@ -0,0 +1,96 @@
+#!/bin/sh
+set -e
+prefix=/usr
+qsysconfdir=/etc/indimail
+rm=/bin/rm
+mv=/bin/mv
+rmdir=/bin/rmdir
+####################################
+ID=`id -u`
+if [ $ID -ne 0 ] ; then
+	echo "You are not root" >&2
+	exit 1
+fi
+
+case "$1" in
+    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+# we are doing upgrade or removal
+if [ " $1" = " upgrade" ] ; then
+	if [ ! "${prefix}" = "/usr" ] ; then
+		echo "recreating ld.so cache"
+		/sbin/ldconfig
+	fi
+	exit 0
+fi
+
+case "$1" in
+    failed-upgrade|abort-install|abort-upgrade|disappear)
+	exit 0
+    ;;
+esac
+#
+# Debian silliness
+#
+if [ " $1" = " remove" ] ; then
+	if [ ! "/usr" = "/usr" ] ; then
+		for i in bin sbin share/indimail
+		do
+			${rmdir} --ignore-fail-on-non-empty ${prefix}/$i 2>/dev/null || true
+		done
+	fi
+	${rmdir} --ignore-fail-on-non-empty ${prefix} 2>/dev/null || true
+fi
+${rmdir} --ignore-fail-on-non-empty ${qsysconfdir} 2>/dev/null || true
+if [ " $1" = " purge" ] ; then
+	nscd_up=`ps -ef |grep nscd |grep -v grep|wc -l`
+	if [ $nscd_up -ge 1 ] ; then
+		if [ -x /etc/init.d/nscd ] ; then
+			/etc/init.d/nscd stop
+		elif [ -f /etc/systemd/system/multi-user.target/nscd.service ] ; then
+			/bin/systemctl stop nscd.service >/dev/null 2>&1 || true
+		fi
+	fi
+	echo "removing user indimail"
+	/usr/bin/getent passwd indimail > /dev/null && /usr/sbin/userdel indimail >/dev/null || true
+	for i in indimail qmail; do
+		echo "removing group $i"
+		/usr/bin/getent group $i  > /dev/null && /usr/sbin/groupdel $i >/dev/null || true
+	done
+	if [ $nscd_up -ge 1 ] ; then
+		if [ -x /etc/init.d/nscd ] ; then
+			/etc/init.d/nscd start
+		elif [ -f /etc/systemd/system/multi-user.target/nscd.service ] ; then
+			/bin/systemctl start nscd.service >/dev/null 2>&1 || true
+		fi
+	fi
+	for i in idhost defaulthost defaultdomain plusdomain
+	do
+		${rm} -f ${qsysconfdir}/control/$i || true
+	done
+	${rmdir} --ignore-fail-on-non-empty ${qsysconfdir} 2>/dev/null || true
+	if [ ! "/usr" = "/usr" ] ; then
+		for i in bin sbin share/indimail
+		do
+			${rmdir} --ignore-fail-on-non-empty ${prefix}/$i 2>/dev/null || true
+		done
+		${rmdir} --ignore-fail-on-non-empty ${prefix} 2>/dev/null || true
+	fi
+fi
+if [ ! "${prefix}" = "/usr" ] ; then
+	echo "recreating ld.so cache"
+	/sbin/ldconfig
+fi
+exit 0
--- indimail-mta-3.1.orig/debian/indimail-mini.postinst
+++ indimail-mta-3.1/debian/indimail-mini.postinst
@@ -0,0 +1,162 @@
+#!/bin/sh
+# postinst script for indimail-mini
+set -e
+
+prefix=/usr
+mandir=/usr/share/man
+qsysconfdir=/etc/indimail
+rm=/bin/rm
+mv=/bin/mv
+
+setperm()
+{
+	local user="$1"; shift
+	local group="$1"; shift
+	local mode="$1"; shift
+	local file="$1"; shift
+	/usr/sbin/dpkg-statoverride --list "$file" >/dev/null && return 0
+	/usr/sbin/dpkg-statoverride --update --add "$user" "$group" "$mode" "$file"
+}
+
+fixperms()
+{
+	if [ $# -eq 3 ] ; then # directory
+		lin=$2
+		file=$3
+		if [ ! -d $file ] ; then
+			return 0
+		fi
+	elif [ $# = 2 ] ; then # file
+		lin=$1
+		file=$2
+		if [ ! -f $file ] ; then
+			return 0
+		fi
+	fi
+	perm=`echo $lin|cut -d\( -f2 | cut -d, -f1`
+	perm_f1=`echo $perm | cut -c1`
+	own=`echo $lin|cut -d\( -f2 | cut -d, -f2`
+	grp=`echo $lin|cut -d\( -f2 | cut -d, -f3|cut -d\) -f1`
+	if [ -f $file ] ; then
+		if [ $perm_f1 -eq 0 ] ; then # 4755, 0644
+			/bin/chown $own:$grp $file
+			/bin/chmod $perm $file
+		else
+			echo $file
+			if [ -f /usr/sbin/dpkg-statoverride ] ; then
+				setperm $own $grp $perm $file
+			else
+				/bin/chown $own:$grp $file
+				/bin/chmod $perm $file
+			fi
+		fi
+	elif [ -d $file ] ; then
+		/bin/chown $own:$grp $file
+		/bin/chmod $perm $file
+	fi
+}
+
+ID=$(id -u)
+if [ $ID -ne 0 ] ; then
+	echo "You are not root" 1>&2
+	exit 1
+fi
+upgrade=0
+case "$1" in
+    configure)
+	if [ -f /tmp/indimail-mini/.install ] ; then
+		upgrade=0
+		/bin/rm -rf /tmp/indimail-mini
+	else
+		if [ -n "$2" ] ; then
+			upgrade=1
+		fi
+	fi
+	;;
+
+	abort-upgrade|abort-remove|abort-deconfigure)
+	exit 0
+	;;
+
+	*)
+	echo "postinst called with unknown argument \`$1'" >&2
+	exit 1
+	;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+if [ -f ${qsysconfdir}/indimail-mini.perms ] ; then
+	(
+	/bin/grep -v "^#" ${qsysconfdir}/indimail-mini.perms | \
+		grep indimail-mini | cut -d# -f1 | while read line
+	do
+		if [ " $line" = " " ] ; then
+			continue
+		fi
+		fixperms $line
+	done
+	) > ${qsysconfdir}/indimail-mini-stat.override
+	if [ ! -s ${qsysconfdir}/indimail-mini-stat.override ] ; then
+		/bin/rm -f ${qsysconfdir}/indimail-mini-stat.override
+	fi
+fi
+if [ -f /etc/init.d/sendmail ] ; then
+	/etc/init.d/sendmail stop
+	if [ -f /sbin/chkconfig ] ; then
+		/sbin/chkconfig --del sendmail 2>/dev/null
+	fi
+fi
+
+if [ -f /etc/pam.d/smtp -a ! -L /etc/pam.d/smtp ] ; then
+	echo "! /etc/pam.d/smtp is a file, should be a link" 1>&2
+	${mv} /etc/pam.d/smtp /etc/pam.d/smtp.old
+fi
+for i in mailq newaliases; do
+	if [ -f /usr/share/man/man1/$i.1.gz -a ! -L /usr/share/man/man1/$i.1.gz ] ; then
+		echo "! /usr/share/man/man1/$i.1.gz is a file, should be a link" 1>&2
+		${mv} /usr/share/man/man1/$i.1.gz /usr/share/man/man1/$i.old.1.gz
+	fi
+done
+if [ -x /usr/sbin/update-alternatives ] ; then
+	if [ /usr/lib/sm.bin/sendmail ] ; then
+		/usr/sbin/update-alternatives --remove-all sendmail-msp || true
+	fi
+	for i in /usr/lib/sendmail /usr/sbin/sendmail; do
+		if [ -f $i -a ! -L $i ]; then
+			echo "! $i is a file, should be a link" 1>&2
+			${mv} $i $i.old
+		fi
+	done
+	/usr/sbin/update-alternatives --install \
+		/usr/sbin/sendmail-msp sendmail-msp ${prefix}/bin/sendmail 120 \
+		--slave /usr/share/man/man8/sendmail.8.gz sendmail.8.gz \
+			${mandir}/man8/isendmail.8.gz \
+		--slave /usr/share/man/man8/sendmail-msp.8.gz sendmail-msp.8.gz \
+			${mandir}/man8/isendmail.8.gz \
+		--slave /usr/sbin/sendmail sendmail ${prefix}/bin/sendmail \
+		--slave /usr/lib/sendmail lib.sendmail ${prefix}/bin/sendmail
+else
+	for i in /usr/lib/sendmail /usr/sbin/sendmail; do
+		if [ -f $i -a ! -L $i ]; then
+			echo "! $i is a file, should be a link"
+			${mv} $i $i.old
+			/bin/ln -s ${prefix}/bin/sendmail $i
+		elif [ -L $i ];then
+			${mv} $i $i.old
+			/bin/ln -s ${prefix}/bin/sendmail $i
+		elif [ ! -f $i ];then
+			echo "! $i is missing"
+			/bin/ln -s ${prefix}/bin/sendmail $i
+		fi
+	done
+fi
+
+if [ ! -f ${qsysconfdir}/control/idhost ] ; then
+	default_domain=$(echo $([ -n "$HOSTNAME" ] && echo "$HOSTNAME" || uname -n) | sed 's/^\([^\.]*\)\.\([^\.]*\)\./\2\./')
+	echo $default_domain > ${qsysconfdir}/control/idhost
+fi
+exit 0
--- indimail-mta-3.1.orig/debian/indimail-mini.install
+++ indimail-mta-3.1/debian/indimail-mini.install
@@ -0,0 +1,37 @@
+var/indimail/bin                               /var/indimail
+var/indimail/sbin                              /var/indimail
+var/indimail/control                           /var/indimail
+etc-mini/indimail/*                            /etc/indimail
+usr/bin/sendmail                               /usr/bin
+usr/bin/qmail-inject                           /usr/bin
+usr/bin/srsfilter                              /usr/bin
+usr/bin/predate                                /usr/bin
+usr/bin/datemail                               /usr/bin
+usr/bin/mailsubj                               /usr/bin
+usr/bin/irmail                                 /usr/bin
+usr/bin/qmail-showctl                          /usr/bin
+usr/sbin/qmail-qmqpc                           /usr/sbin
+usr/sbin/qmail-direct                          /usr/sbin
+usr/sbin/mini-smtpd                            /usr/sbin
+usr/share/man/man1/srsfilter.1.gz              /usr/share/man/man1
+usr/share/man/man5/indimail-srs.5.gz           /usr/share/man/man5
+usr/share/man/man5/indimail-control.5.gz       /usr/share/man/man5
+usr/share/man/man8/qmail-inject.8.gz           /usr/share/man/man8
+usr/share/man/man8/isendmail.8.gz              /usr/share/man/man8
+usr/share/man/man8/qmail-qmqpc.8.gz            /usr/share/man/man8
+usr/share/man/man8/qmail-direct.8.gz           /usr/share/man/man8
+usr/share/man/man1/predate.1.gz                /usr/share/man/man1
+usr/share/man/man1/datemail.1.gz               /usr/share/man/man1
+usr/share/man/man1/mailsubj.1.gz               /usr/share/man/man1
+usr/share/man/man8/irmail.8.gz                 /usr/share/man/man8
+usr/share/man/man8/mini-smtpd.8.gz             /usr/share/man/man8
+usr/share/man/man8/qmail-showctl.8.gz          /usr/share/man/man8
+usr/share/indimail/doc/INSTALL-MINI            /usr/share/indimail/doc
+usr/share/indimail/doc/COPYING-indimail-mta    /usr/share/indimail/doc
+usr/share/indimail/doc/README.licenses         /usr/share/indimail/doc
+usr/share/indimail/doc/LICENSE.qhpsi           /usr/share/indimail/doc
+usr/share/indimail/doc/softwarelicense1-1.html /usr/share/indimail/doc
+usr/share/indimail/doc/INSTALL-MINI            /usr/share/indimail/doc
+usr/share/indimail/doc/README.indimail-mta     /usr/share/indimail/doc
+usr/share/indimail/doc/README.srs              /usr/share/indimail/doc
+usr/share/indimail/doc/CREDITS.md              /usr/share/indimail/doc
--- indimail-mta-3.1.orig/debian/qmta.prerm
+++ indimail-mta-3.1/debian/qmta.prerm
@@ -0,0 +1,84 @@
+#!/bin/sh
+# prerm script for indimail-mini
+#
+# see: dh_installdeb(1)
+
+set -e
+prefix=/usr
+rm=/bin/rm
+mv=/bin/mv
+
+ID=`id -u`
+if [ $ID -ne 0 ] ; then
+	echo "You are not root" >&2
+	exit 1
+fi
+
+case "$1" in
+    remove|upgrade|deconfigure)
+    ;;
+
+    failed-upgrade)
+    ;;
+
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+# we are doing upgrade
+if [ " $1" = " upgrade" -o " $1" = " deconfigure" ] ; then
+	exit 0
+fi
+
+# Remove IndiMail being started on system boot
+echo "adding sendmail startup"
+if [ -f /etc/init.d/sendmail ] ; then
+	if [ -f /sbin/chkconfig ] ; then
+		/sbin/chkconfig --add sendmail 2>/dev/null
+	fi
+fi
+if [ -x /usr/sbin/alternatives ] ; then
+	echo "removing ${prefix}/bin/sendmail as alternative"
+	/usr/sbin/alternatives --remove sendmail-msp ${prefix}/bin/sendmail || true
+	echo "adding default alternative for sendmail"
+	/usr/sbin/alternatives --auto sendmail-msp || true
+elif [ -x /usr/sbin/update-alternatives ] ; then
+	echo "removing ${prefix}/bin/sendmail as alternative"
+	if [ -f /usr/lib/sm.bin/sendmail ] ; then
+		/usr/sbin/update-alternatives --remove-all sendmail-msp || true
+		echo "adding default alternative for sendmail"
+		/usr/sbin/update-alternatives --install \
+			/usr/sbin/sendmail-msp sendmail-msp /usr/lib/sm.bin/sendmail 25 \
+			--slave /usr/share/man/man8/sendmail-msp.8.gz sendmail-msp.8.gz \
+				/usr/share/man/man8/sendmail.sendmail.8.gz \
+			--slave /usr/sbin/sendmail sendmail /usr/lib/sm.bin/sendmail \
+			--slave /usr/lib/sendmail lib.sendmail /usr/lib/sm.bin/sendmail \
+			--slave /usr/share/man/man8/sendmail.8.gz sendmail.8.gz \
+				/usr/share/man/man8/sendmail.sendmail.8.gz || true
+	else
+		/usr/sbin/update-alternatives --remove sendmail-msp ${prefix}/bin/sendmail || true
+		echo "adding default alternative for sendmail"
+		/usr/sbin/update-alternatives --auto sendmail-msp || true
+	fi
+fi
+for i in /usr/lib/sendmail /usr/sbin/sendmail /etc/pam.d/smtp; do
+	if [ -f $i.old -o -L $i.old ]; then
+		echo "restoring $i"
+		${rm} -f $i
+		${mv} $i.old $i
+	fi
+done
+for i in mailq newaliases; do
+	if [ -f /usr/share/man/man1/$i.old.1.gz ] ; then
+		echo "restoring /usr/share/man/man1/$i.1.gz"
+		${mv} /usr/share/man/man1/$i.old.1.gz /usr/share/man/man1/$i.1.gz
+	fi
+done
+exit 0
--- indimail-mta-3.1.orig/debian/qmta.preinst
+++ indimail-mta-3.1/debian/qmta.preinst
@@ -0,0 +1,93 @@
+#!/bin/sh
+set -e
+prefix=/usr
+qmaildir=/var/indimail
+rm=/bin/rm
+
+ID=`id -u`
+if [ $ID -ne 0 ] ; then
+	echo "You are not root" >&2
+	exit 1
+fi
+#
+# Create user/groups indimail. Do not report any problems if it already
+# exists.
+#
+
+case "$1" in
+	upgrade)
+	set +e
+	if [ -d /run ] ; then
+		rundir=/run/qmta
+	else
+		rundir=/var/run/qmta
+	fi
+	count=$(ps -ef|grep qmta-send|grep -v grep|wc -l)
+	if [ $count -gt 0 ] ; then
+  		mkdir -p $rundir
+		touch $rundir/.qmta-send.down
+	else
+		${rm} -f $rundir/.qmta-send.down
+	fi
+	if test -f /etc/systemd/system/multi-user.target.wants/qmta-send.service
+	then
+		systemctl stop qmta-send >/dev/null 2>&1 || true
+	fi
+	set -e
+	sleep 5
+	;;
+    install)
+	mkdir -p /tmp/qmta
+	chmod 700 /tmp/qmta
+	touch /tmp/qmta/.install
+	nscd_up=`ps -ef |grep nscd |grep -v grep|wc -l`
+	if [ $nscd_up -ge 1 ] ; then
+		if [ -x /etc/init.d/nscd ] ; then
+			/etc/init.d/nscd stop
+		elif [ -f /etc/systemd/system/multi-user.target/nscd.service ] ; then
+			/bin/systemctl stop nscd.service >/dev/null 2>&1 || true
+		fi
+	fi
+	mkdir -p ${qmaildir}
+	echo "Adding IndiMail users/groups"
+	/usr/bin/getent group indimail  > /dev/null || /usr/sbin/groupadd -r -g 555 indimail || true
+	if [ $? = 4 ] ; then
+		/usr/sbin/groupadd indimail
+	fi
+	/usr/bin/getent group nofiles   > /dev/null || /usr/sbin/groupadd nofiles  || true
+	/usr/bin/getent group qmail     > /dev/null || /usr/sbin/groupadd qmail    || true
+	/usr/bin/getent group qscand    > /dev/null || /usr/sbin/groupadd qscand   || true
+	/usr/bin/getent passwd indimail > /dev/null || /usr/sbin/useradd -r -g indimail -u 555 -d ${qmaildir} indimail || true
+	if [ $? = 4 ] ; then
+		/usr/sbin/useradd -r -g indimail -d ${prefix} indimail
+	fi
+	/usr/bin/getent passwd alias    > /dev/null || /usr/sbin/useradd -M -g nofiles  -d ${qmaildir}/alias  -s /sbin/nologin alias  || true
+    /usr/bin/getent passwd qmailq   > /dev/null || /usr/sbin/useradd -M -g qmail    -d ${qmaildir}        -s /sbin/nologin qmailq || true
+    /usr/bin/getent passwd qmailr   > /dev/null || /usr/sbin/useradd -M -g qmail    -d ${qmaildir}        -s /sbin/nologin qmailr || true
+    /usr/bin/getent passwd qmails   > /dev/null || /usr/sbin/useradd -M -g qmail    -d ${qmaildir}        -s /sbin/nologin qmails || true
+	/usr/bin/getent passwd qscand   > /dev/null || /usr/sbin/useradd -M -g qscand   -d ${qmaildir}/qscanq -G qmail,qscand -s /sbin/nologin qscand || true
+	${rm} -f /var/spool/mail/indimail
+	if [ $nscd_up -ge 1 ] ; then
+		if [ -x /etc/init.d/nscd ] ; then
+			/etc/init.d/nscd start
+		elif [ -f /etc/systemd/system/multi-user.target/nscd.service ] ; then
+			/bin/systemctl start nscd.service >/dev/null 2>&1 || true
+		fi
+	fi
+	;;
+
+    abort-upgrade)
+    ;;
+
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
--- indimail-mta-3.1.orig/debian/qmta.postrm
+++ indimail-mta-3.1/debian/qmta.postrm
@@ -0,0 +1,102 @@
+#!/bin/sh
+set -e
+prefix=/usr
+qsysconfdir=/etc/indimail
+rm=/bin/rm
+mv=/bin/mv
+rmdir=/bin/rmdir
+####################################
+ID=`id -u`
+if [ $ID -ne 0 ] ; then
+	echo "You are not root" >&2
+	exit 1
+fi
+
+case "$1" in
+    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+# we are doing upgrade or removal
+if [ " $1" = " upgrade" ] ; then
+	if [ ! "${prefix}" = "/usr" ] ; then
+		echo "recreating ld.so cache"
+		/sbin/ldconfig
+	fi
+	exit 0
+fi
+
+case "$1" in
+    failed-upgrade|abort-install|abort-upgrade|disappear)
+	exit 0
+    ;;
+esac
+#
+# Debian silliness
+#
+if [ " $1" = " remove" ] ; then
+	if [ ! "/usr" = "/usr" ] ; then
+		for i in bin sbin share/indimail
+		do
+			${rmdir} --ignore-fail-on-non-empty ${prefix}/$i 2>/dev/null || true
+		done
+	fi
+	${rmdir} --ignore-fail-on-non-empty ${prefix} 2>/dev/null || true
+	for i in idhost defaulthost defaultdomain plusdomain
+	do
+		${rm} -f ${qsysconfdir}/control/$i || true
+	done
+	${rmdir} --ignore-fail-on-non-empty ${qsysconfdir} 2>/dev/null || true
+fi
+if [ " $1" = " purge" ] ; then
+	nscd_up=`ps -ef |grep nscd |grep -v grep|wc -l`
+	if [ $nscd_up -ge 1 ] ; then
+		if [ -x /etc/init.d/nscd ] ; then
+			/etc/init.d/nscd stop
+		elif [ -f /etc/systemd/system/multi-user.target/nscd.service ] ; then
+			/bin/systemctl stop nscd.service >/dev/null 2>&1 || true
+		fi
+	fi
+	for i in indimail alias qmailq qmailr qmails qscand; do
+		echo "removing user $i"
+		/usr/bin/getent passwd $i > /dev/null && /usr/sbin/userdel $i >/dev/null || true
+	done
+	for i in indimail nofiles qmail qscand; do
+		echo "removing group $i"
+		/usr/bin/getent group $i  > /dev/null && /usr/sbin/groupdel $i >/dev/null || true
+	done
+	if [ $nscd_up -ge 1 ] ; then
+		if [ -x /etc/init.d/nscd ] ; then
+			/etc/init.d/nscd start
+		elif [ -f /etc/systemd/system/multi-user.target/nscd.service ] ; then
+			/bin/systemctl start nscd.service >/dev/null 2>&1 || true
+		fi
+	fi
+	for i in idhost defaulthost defaultdomain plusdomain
+	do
+		${rm} -f ${qsysconfdir}/control/$i || true
+	done
+	${rmdir} --ignore-fail-on-non-empty ${qsysconfdir} 2>/dev/null || true
+	if [ ! "/usr" = "/usr" ] ; then
+		for i in bin sbin share/indimail
+		do
+			${rmdir} --ignore-fail-on-non-empty ${prefix}/$i 2>/dev/null || true
+		done
+		${rmdir} --ignore-fail-on-non-empty ${prefix} 2>/dev/null || true
+	fi
+fi
+if [ ! "${prefix}" = "/usr" ] ; then
+	echo "recreating ld.so cache"
+	/sbin/ldconfig
+fi
+exit 0
--- indimail-mta-3.1.orig/debian/qmta.postinst
+++ indimail-mta-3.1/debian/qmta.postinst
@@ -0,0 +1,204 @@
+#!/bin/sh
+# postinst script for qmta
+set -e
+
+prefix=/usr
+mandir=/usr/share/man
+qmaildir=/var/indimail
+qsysconfdir=/etc/indimail
+sysconfdir=/etc
+shareddir=/usr/share/indimail
+rm=/bin/rm
+mv=/bin/mv
+cp=/bin/cp
+
+setperm()
+{
+	local user="$1"; shift
+	local group="$1"; shift
+	local mode="$1"; shift
+	local file="$1"; shift
+	/usr/sbin/dpkg-statoverride --list "$file" >/dev/null && return 0
+	/usr/sbin/dpkg-statoverride --update --add "$user" "$group" "$mode" "$file"
+}
+
+fixperms()
+{
+	if [ $# -eq 3 ] ; then # directory
+		lin=$2
+		file=$3
+		if [ ! -d $file ] ; then
+			return 0
+		fi
+	elif [ $# = 2 ] ; then # file
+		lin=$1
+		file=$2
+		if [ ! -f $file ] ; then
+			return 0
+		fi
+	fi
+	perm=`echo $lin|cut -d\( -f2 | cut -d, -f1`
+	perm_f1=`echo $perm | cut -c1`
+	own=`echo $lin|cut -d\( -f2 | cut -d, -f2`
+	grp=`echo $lin|cut -d\( -f2 | cut -d, -f3|cut -d\) -f1`
+	if [ -f $file ] ; then
+		if [ $perm_f1 -eq 0 ] ; then # 4755, 0644
+			/bin/chown $own:$grp $file
+			/bin/chmod $perm $file
+		else
+			echo $file
+			if [ -f /usr/sbin/dpkg-statoverride ] ; then
+				setperm $own $grp $perm $file
+			else
+				/bin/chown $own:$grp $file
+				/bin/chmod $perm $file
+			fi
+		fi
+	elif [ -d $file ] ; then
+		/bin/chown $own:$grp $file
+		/bin/chmod $perm $file
+	fi
+}
+
+ID=$(id -u)
+if [ $ID -ne 0 ] ; then
+	echo "You are not root" 1>&2
+	exit 1
+fi
+upgrade=0
+case "$1" in
+    configure)
+	if [ -f /tmp/qmta/.install ] ; then
+		upgrade=0
+		/bin/rm -rf /tmp/qmta
+	else
+		if [ -n "$2" ] ; then
+			upgrade=1
+		fi
+	fi
+    ;;
+
+	abort-upgrade|abort-remove|abort-deconfigure)
+	exit 0
+   	;;
+
+	*)
+	echo "postinst called with unknown argument \`$1'" >&2
+	exit 1
+	;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+if [ -f ${qsysconfdir}/qmta.perms ] ; then
+	(
+	/bin/grep -v "^#" ${qsysconfdir}/qmta.perms | \
+		grep qmta | cut -d# -f1 | while read line
+	do
+		if [ " $line" = " " ] ; then
+			continue
+		fi
+		fixperms $line
+	done
+	) > ${qsysconfdir}/qmta-stat.override
+	if [ ! -s ${qsysconfdir}/qmta-stat.override ] ; then
+		/bin/rm -f ${qsysconfdir}/qmta-stat.override
+	fi
+fi
+
+if [ $upgrade -eq 1 ] ; then # upgrade
+  (
+  set +e
+  echo "checking if system boot scripts need upgrade"
+  if [ -x /bin/systemctl -a -d /lib/systemd/system ] ; then
+    cmp -s ${shareddir}/boot/qmta-send.sevice /lib/systemd/system/qmta-send.service >/dev/null 2>&1 || \
+      (${cp} ${shareddir}/boot/systemd /lib/systemd/system/qmta-send.service &&
+      /bin/systemctl daemon-reload && echo "installed new qmta-send service")
+  elif [ -x /bin/systemctl -a -d /usr/lib/systemd/system ] ; then
+    cmp -s ${shareddir}/boot/qmta-send.service /usr/lib/systemd/system/qmta-send.service >/dev/null 2>&1 || \
+      (${cp} ${shareddir}/boot/systemd /usr/lib/systemd/system/qmta-send.service &&
+      /bin/systemctl daemon-reload && echo "installed new qmta-send service")
+  fi
+  set -e
+  # restart qmta-send service if we find $rundir/.qmta-send.down
+  if [ -d /run ] ; then
+    rundir=/run/qmta
+  else
+    rundir=/var/run/qmta
+  fi
+  if [ -f $rundir/.qmta-send.down ] ; then
+    ${rm} -f $rundir/.qmta-send.down
+    echo "Starting qmta-send"
+    if test -f ${sysconfdir}/systemd/system/multi-user.target.wants/qmta-send.service
+    then
+      /bin/systemctl start qmta-send >/dev/null 2>&1 || true
+    fi
+  fi
+  ) >> /var/log/qmta-setup.log 2>&1
+  exit 0
+fi
+
+(
+if [ -f /etc/init.d/sendmail ] ; then
+	/etc/init.d/sendmail stop
+	if [ -f /sbin/chkconfig ] ; then
+		/sbin/chkconfig --del sendmail 2>/dev/null
+	fi
+fi
+
+if [ -f /etc/pam.d/smtp -a ! -L /etc/pam.d/smtp ] ; then
+	echo "! /etc/pam.d/smtp is a file, should be a link" 1>&2
+	${mv} /etc/pam.d/smtp /etc/pam.d/smtp.old
+fi
+for i in mailq newaliases; do
+	if [ -f /usr/share/man/man1/$i.1.gz -a ! -L /usr/share/man/man1/$i.1.gz ] ; then
+		echo "! /usr/share/man/man1/$i.1.gz is a file, should be a link" 1>&2
+		${mv} /usr/share/man/man1/$i.1.gz /usr/share/man/man1/$i.old.1.gz
+	fi
+done
+if [ -x /usr/sbin/update-alternatives ] ; then
+	if [ /usr/lib/sm.bin/sendmail ] ; then
+		/usr/sbin/update-alternatives --remove-all sendmail-msp || true
+	fi
+	for i in /usr/lib/sendmail /usr/sbin/sendmail; do
+		if [ -f $i -a ! -L $i ]; then
+			echo "! $i is a file, should be a link" 1>&2
+			${mv} $i $i.old
+		fi
+	done
+	/usr/sbin/update-alternatives --install \
+		/usr/sbin/sendmail-msp sendmail-msp ${prefix}/bin/sendmail 120 \
+		--slave /usr/share/man/man8/sendmail.8.gz sendmail.8.gz \
+			${mandir}/man8/isendmail.8.gz \
+		--slave /usr/share/man/man8/sendmail-msp.8.gz sendmail-msp.8.gz \
+			${mandir}/man8/isendmail.8.gz \
+		--slave /usr/sbin/sendmail sendmail ${prefix}/bin/sendmail \
+		--slave /usr/lib/sendmail lib.sendmail ${prefix}/bin/sendmail
+else
+	for i in /usr/lib/sendmail /usr/sbin/sendmail; do
+		if [ -f $i -a ! -L $i ]; then
+			echo "! $i is a file, should be a link"
+			${mv} $i $i.old
+			/bin/ln -s ${prefix}/bin/sendmail $i
+		elif [ -L $i ];then
+			${mv} $i $i.old
+			/bin/ln -s ${prefix}/bin/sendmail $i
+		elif [ ! -f $i ];then
+			echo "! $i is missing"
+			/bin/ln -s ${prefix}/bin/sendmail $i
+		fi
+	done
+fi
+if [ ! -f ${qsysconfdir}/control/idhost ] ; then
+	default_domain=$(echo $([ -n "$HOSTNAME" ] && echo "$HOSTNAME" || uname -n) | sed 's/^\([^\.]*\)\.\([^\.]*\)\./\2\./')
+	echo $default_domain > ${qsysconfdir}/control/idhost
+fi
+if [ ! -d ${qmaildir}/queue/qmta ] ; then
+	mkdir -p ${qmaildir}/queue
+	queue-fix -m ${qmaildir}/queue/qmta
+fi
+) >> /var/log/qmta-setup.log 2>&1
+exit 0
--- indimail-mta-3.1.orig/debian/qmta.install
+++ indimail-mta-3.1/debian/qmta.install
@@ -0,0 +1,71 @@
+var/indimail/bin                               /var/indimail
+var/indimail/sbin                              /var/indimail
+var/indimail/control                           /var/indimail
+var/indimail/users                             /var/indimail
+etc-qmta/indimail/*                            /etc/indimail
+usr/bin/sendmail                               /usr/bin
+usr/bin/qmail-inject                           /usr/bin
+usr/bin/irmail                                 /usr/bin
+usr/bin/forward                                /usr/bin
+usr/bin/predate                                /usr/bin
+usr/bin/datemail                               /usr/bin
+usr/bin/mailsubj                               /usr/bin
+usr/bin/qmail-showctl                          /usr/bin
+usr/bin/qmaildirmake                           /usr/bin
+usr/bin/maildir2mbox                           /usr/bin
+usr/bin/qmaildirwatch                          /usr/bin
+usr/bin/srsfilter                              /usr/bin
+usr/bin/queue-fix                              /usr/bin
+usr/sbin/qmail-qmqpc                           /usr/sbin
+usr/sbin/qmail-direct                          /usr/sbin
+usr/sbin/qmta-send                             /usr/sbin
+usr/sbin/mini-smtpd                            /usr/sbin
+usr/sbin/qmail-queue                           /usr/sbin
+usr/sbin/qmail-lspawn                          /usr/sbin
+usr/sbin/qmail-local                           /usr/sbin
+usr/sbin/qmail-rspawn                          /usr/sbin
+usr/sbin/qmail-remote                          /usr/sbin
+usr/sbin/qmail-clean                           /usr/sbin
+usr/sbin/qmail-tcpok                           /usr/sbin
+usr/sbin/qmail-tcpto                           /usr/sbin
+usr/sbin/qhpsi                                 /usr/sbin
+usr/share/indimail/boot/qmta-send.service      /usr/share/indimail/boot
+usr/share/man/man1/forward.1.gz                /usr/share/man/man1
+usr/share/man/man1/predate.1.gz                /usr/share/man/man1
+usr/share/man/man1/datemail.1.gz               /usr/share/man/man1
+usr/share/man/man1/mailsubj.1.gz               /usr/share/man/man1
+usr/share/man/man1/qmaildirmake.1.gz           /usr/share/man/man1
+usr/share/man/man1/maildir2mbox.1.gz           /usr/share/man/man1
+usr/share/man/man1/qmaildirwatch.1.gz          /usr/share/man/man1
+usr/share/man/man1/srsfilter.1.gz              /usr/share/man/man1
+usr/share/man/man5/indimail-srs.5.gz           /usr/share/man/man5
+usr/share/man/man5/indimail-control.5.gz       /usr/share/man/man5
+usr/share/man/man8/qmail-showctl.8.gz          /usr/share/man/man8
+usr/share/man/man8/irmail.8.gz                 /usr/share/man/man8
+usr/share/man/man8/qmail-queue.8.gz            /usr/share/man/man8
+usr/share/man/man8/qmail-direct.8.gz           /usr/share/man/man8
+usr/share/man/man8/qmail-lspawn.8.gz           /usr/share/man/man8
+usr/share/man/man8/qmail-local.8.gz            /usr/share/man/man8
+usr/share/man/man8/qmail-rspawn.8.gz           /usr/share/man/man8
+usr/share/man/man8/qmail-remote.8.gz           /usr/share/man/man8
+usr/share/man/man8/qmail-clean.8.gz            /usr/share/man/man8
+usr/share/man/man8/qmail-direct.8.gz           /usr/share/man/man8
+usr/share/man/man8/qmta-send.8.gz              /usr/share/man/man8
+usr/share/man/man8/mini-smtpd.8.gz             /usr/share/man/man8
+usr/share/man/man8/queue-fix.8.gz              /usr/share/man/man8
+usr/share/man/man8/qmail-tcpok.8.gz            /usr/share/man/man8
+usr/share/man/man8/qmail-tcpto.8.gz            /usr/share/man/man8
+usr/share/man/man8/isendmail.8.gz              /usr/share/man/man8
+usr/share/man/man8/qmail-inject.8.gz           /usr/share/man/man8
+usr/share/man/man8/qhpsi.8.gz                  /usr/share/man/man8
+usr/share/indimail/doc/COPYING-indimail-mta    /usr/share/indimail/doc
+usr/share/indimail/doc/README.licenses         /usr/share/indimail/doc
+usr/share/indimail/doc/LICENSE.qhpsi           /usr/share/indimail/doc
+usr/share/indimail/doc/softwarelicense1-1.html /usr/share/indimail/doc
+usr/share/indimail/doc/INSTALL-MINI            /usr/share/indimail/doc
+usr/share/indimail/doc/README.clamav           /usr/share/indimail/doc
+usr/share/indimail/doc/README.indimail-mta     /usr/share/indimail/doc
+usr/share/indimail/doc/README.qhpsi            /usr/share/indimail/doc
+usr/share/indimail/doc/README.queue-fix        /usr/share/indimail/doc
+usr/share/indimail/doc/README.srs              /usr/share/indimail/doc
+usr/share/indimail/doc/CREDITS.md              /usr/share/indimail/doc
--- indimail-mta-3.1.orig/debian/indimail-mta.cron.d
+++ indimail-mta-3.1/debian/indimail-mta.cron.d
@@ -0,0 +1,17 @@
+#
+# Regular cron jobs for the indimail-mta package
+#
+# Rotate the logs at midnight
+5    0 * * * root /usr/bin/svc -a /service*/*/log > /dev/null 2>&1
+# Generate reports
+0    0 * * * root /usr/sbin/svctool --report=all --attach --postmaster=postmaster
+#
+# qmail-smtpd TLS
+#
+01 01 * * * root /usr/libexec/indimail/update_tmprsadh > /dev/null 2>&1
+#
+# Clean Temp directories created by qscanq
+#
+12 * * * *	root /usr/sbin/run-cleanq
+# Backup indimail
+10 0 * * * root /usr/sbin/svctool --backup=/home/mail/backup --servicedir=/service --mysqlPrefix=/usr
--- indimail-mta-3.1.orig/debian/indimail-mta.install
+++ indimail-mta-3.1/debian/indimail-mta.install
@@ -0,0 +1,18 @@
+etc/indimail           /etc
+var/indimail/alias     /var/indimail
+var/indimail/autoturn  /var/indimail
+var/indimail/qscanq    /var/indimail
+var/indimail/bin       /var/indimail
+var/indimail/sbin      /var/indimail
+var/indimail/control   /var/indimail
+var/indimail/libexec   /var/indimail
+var/indimail/users     /var/indimail
+usr/bin                /usr
+usr/sbin               /usr
+usr/libexec            /usr
+usr/share/indimail/*   /usr/share/indimail
+usr/lib/indimail       /usr/lib
+usr/share/man/man1     /usr/share/man
+usr/share/man/man5     /usr/share/man
+usr/share/man/man7     /usr/share/man
+usr/share/man/man8     /usr/share/man
--- indimail-mta-3.1.orig/debian/source/format
+++ indimail-mta-3.1/debian/source/format
@@ -0,0 +1,1 @@
+3.0 (quilt)
