--- indimail-3.4.8.orig/debian/changelog
+++ indimail-3.4.8/debian/changelog
@@ -0,0 +1,17 @@
+indimail (3.4.8-1.1+1.3) stable; urgency=low
+
+  * version number update by debtransform
+
+ -- debtransform <build@opensuse.org>  Sun, 17 May 2026 09:45:18 +0000
+
+indimail (3.4.8-1.1) stable; urgency=low
+
+  * remove VIRTUAL_PKG_LIB env variable on package removal
+  * added libindimail, libmysql control file to control files list in controlfiles.i
+  * fix gcc14 errors
+  * islocalif.c: fixed possible memory leak by calling freeaddrinfo
+  * crc.c: added -t option to tag files/directories
+  * crcdiff.c: display file name when file has error in data input
+  * proxylogin.c: fixed gcc14 warning/error
+
+ -- Manvendra Bhangui <indimail-virtualdomains@indimail.org>  Tue, 07 Oct 2025 03:00:05 +0000
--- indimail-3.4.8.orig/debian/compat
+++ indimail-3.4.8/debian/compat
@@ -0,0 +1 @@
+10
--- indimail-3.4.8.orig/debian/control
+++ indimail-3.4.8/debian/control
@@ -0,0 +1,41 @@
+Source: indimail
+Section: mail
+Priority: extra
+Maintainer: Manvendra Bhangui <indimail-virtualdomains@indimail.org>
+Standards-Version: 3.9.1
+Build-Depends: cdbs, debhelper (>= 9), gcc, g++, binutils, automake, libqmail-dev (>> 1.1), libssl-dev, m4, gawk
+Homepage: https://github.com/mbhangui/indimail-virtualdomains
+
+Package: indimail
+Architecture: any
+Pre-Depends: indimail-mta (>= 3.0.4), indimail-access, virtual-mysql-server, mrtg
+Recommends: indimail-auth
+Conflicts: indimail (< 2.0)
+Depends: ${shlibs:Depends}, ${misc:Depends}, net-tools, coreutils, findutils, procps
+Provides: libindimail
+Replaces: libindimail
+Description: IndiMail is a messaging platform providing multi-cluster domain support.
+ It provides IMAP/POP3 protocol using Courier Imap, SPAM filtering using
+ bogofilter (A Bayesian Spam Filter), mail retreival using Fetchmail.
+ Additionally it packages other useful utilities like mpack, unpack,
+ altermime, ripmime, fortune, flash.
+ .
+ IndiMail provides ability for a single domain to have users across multiple
+ hosts (even across different geographical locations) and tools to manage
+ virtual domains.
+
+Package: indimail-dev
+Depends: libindimail (= ${binary:Version}), ${misc:Depends}
+Section: devel
+Architecture: any
+Description: IndiMail - Development header files and libraries
+ This package contains the development header files and libraries
+ necessary to develop IndiMail client applications.
+
+Package: libindimail
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Section: libs
+Architecture: any
+Description: IndiMail - Development libraries
+ This package contains the development libraries
+ necessary to develop IndiMail client applications.
--- indimail-3.4.8.orig/debian/copyright
+++ indimail-3.4.8/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-virtualdomains@indimail.org>
+Source: http://indimail.sourceforge.net/
+
+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-3.4.8.orig/debian/docs
+++ indimail-3.4.8/debian/docs
@@ -0,0 +1 @@
+NEWS
--- indimail-3.4.8.orig/debian/indimail-dev.install
+++ indimail-3.4.8/debian/indimail-dev.install
@@ -0,0 +1,3 @@
+usr/include /usr
+usr/share/man/man3 /usr/share/man
+usr/@libd@/*.so /usr/@libd@
--- indimail-3.4.8.orig/debian/indimail-dev.postinst
+++ indimail-3.4.8/debian/indimail-dev.postinst
@@ -0,0 +1,54 @@
+#!/bin/sh
+set -e
+prefix=/usr
+mandir=/usr/share/man
+sysconfdir=/etc/indimail
+
+ID=`id -u`
+if [ $ID -ne 0 ] ; then
+	echo "You are not root" >&2
+	exit 1
+fi
+
+case "$1" in
+    configure)
+		if [ " $2" = " " ] ; then
+			echo "installing indimail-dev 3.4.8"
+		else
+			echo "upgrading to indimail-dev $2"
+		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 [ -d ${mandir}/man3 ] ; then
+	echo "compressing man pages"
+	find ${mandir}/man3 -type f -exec gzip -q {} \;
+fi
+echo "recreating ld.so cache"
+if [ ! "${prefix}" = "/usr" ] ; then
+if [ -d /etc/ld.so.conf.d ] ; then
+	(
+		if [ -d ${prefix}/lib64 ] ; then
+			echo ${prefix}/lib64
+		else
+			echo ${prefix}/lib
+		fi
+	) > /etc/ld.so.conf.d/indimail-`uname -m`.conf
+fi
+/sbin/ldconfig
+fi
+exit 0
--- indimail-3.4.8.orig/debian/indimail-dev.postrm
+++ indimail-3.4.8/debian/indimail-dev.postrm
@@ -0,0 +1,53 @@
+#!/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
+mandir=/usr/share/man
+libdir=/usr/lib
+rm=/bin/rm
+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#
+if [ "$1" = "remove" ]; then
+	echo "removing static libraries"
+	${rm} -f ${libdir}/libeps.a
+	${rm} -f ${libdir}/libindimail.a
+fi
+exit 0
--- indimail-3.4.8.orig/debian/indimail.cron.d
+++ indimail-3.4.8/debian/indimail.cron.d
@@ -0,0 +1,19 @@
+#
+# Regular cron jobs for the indimail package
+#
+#2,32 * * * * indimail /usr/sbin/hostsync -d indimail.org
+5,35 * * * * indimail /usr/sbin/clearopensmtp
+#0    5 * * * root /usr/sbin/vdeloldusers -d indimail.org -u -1 -t 2 >/dev/null 2>&1
+#7    * * * * root /usr/sbin/vfstab -b
+#
+#chowkidar
+#
+#24 0,4,8,12,16,20 * * * indimail /usr/sbin/chowkidar -f /var/log/indimail/deliver.25/current -o /etc/indimail/control/badmailfrom -n 300 -B > /dev/null 2>&1
+#0 0 * * * indimail /usr/sbin/chowkidar -r -B -q > /dev/null 2>&1
+#24 0,4,8,12,16,20 * * * indimail /usr/sbin/chowkidar -f /var/log/indimail/deliver.25/current -o /etc/indimail/control/badrcptto -n 300 -T > /dev/null 2>&1
+#0 0 * * * indimail /usr/sbin/chowkidar -r -T -q > /dev/null 2>&1
+#
+# Build fast CDB spam database
+#
+#24 0,4,8,12,16,20 * * * indimail /usr/sbin/chowkidar -f /var/log/indimail/smtpd.25/current -o /etc/indimail/control/spamdb -n 1 -S > /dev/null 2>&1
+#0 0 * * * indimail /usr/sbin/chowkidar -r -S -q > /dev/null 2>&1
--- indimail-3.4.8.orig/debian/indimail.install
+++ indimail-3.4.8/debian/indimail.install
@@ -0,0 +1,12 @@
+etc/indimail           /etc
+var/indimail/domains   /var/indimail
+usr/bin                /usr
+usr/sbin               /usr
+usr/share/indimail/*   /usr/share/indimail
+usr/libexec/indimail/* /usr/libexec/indimail
+usr/share/man/man1     /usr/share/man
+usr/share/man/man7     /usr/share/man
+usr/share/man/man8     /usr/share/man
+usr/lib/indimail       /usr/lib
+usr/lib/pkgconfig      /usr/lib
+usr/@libd@/*.so.*      /usr/@libd@
--- indimail-3.4.8.orig/debian/indimail.postinst
+++ indimail-3.4.8/debian/indimail.postinst
@@ -0,0 +1,542 @@
+#!/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
+indimaildir=/var/indimail
+mandir=/usr/share/man
+libexecdir=/usr/libexec/indimail
+qcount=5
+qbase=${indimaildir}/queue
+mbase=/home/mail
+logdir=/var/log/svc
+mysqlPrefix=/usr
+servicedir=/service
+sysconfdir=/etc/indimail
+default_domain=runnervmwhb2z
+build_on_obs=0
+####################################
+noproxy=0
+tcpserver_plugin=1
+mysqlSocket=/var/run/mysqld/mysqld.sock
+
+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()
+{
+#%attr(0555,root,qmail) /usr/bin/rsmtp
+	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 # perm_f1 is 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#
+
+#
+# We need to do this for debian. SIGH!!
+#
+if [ -f ${sysconfdir}/indimail.perms ] ; then
+	echo "Fixing Permissions"
+	(
+	/bin/grep -v "^#" ${sysconfdir}/indimail.perms | while read line
+	do
+		if [ " $line" = " " ] ; then
+			continue
+		fi
+		fixperms $line
+	done
+	) > ${sysconfdir}/indimail-stat.override
+fi
+
+if [ -d /run ] ; then
+	rundir=/run
+elif [ -d /var/run ] ; then
+	rundir=/var/run
+else
+	rundir=""
+fi
+if [ -d ${prefix}/lib/tmpfiles.d -a -n "${rundir}" ] ; then
+  mkdir -p /tmp/indimail
+  chmod 700 /tmp/indimail
+  (
+  echo "d ${rundir}/indimail 0755 root root"
+  echo "p ${rundir}/indimail/logfifo 0666 root root"
+  echo "d ${rundir}/indimail/pwdlookup 0775 root indimail"
+  echo "d ${rundir}/indimail/inlookup 0770 indimail qmail"
+  echo "p ${rundir}/indimail/inlookup/infifo.1 0660 qmaild indimail"
+  echo "p ${rundir}/indimail/inlookup/infifo.2 0660 qmaild indimail"
+  echo "p ${rundir}/indimail/inlookup/infifo.3 0660 qmaild indimail"
+  echo "p ${rundir}/indimail/inlookup/infifo.4 0660 qmaild indimail"
+  echo "p ${rundir}/indimail/inlookup/infifo.5 0660 qmaild indimail"
+  echo "d ${rundir}/indimail/inquery 2770 qmaild indimail"
+  ) > /tmp/indimail/indimail.conf.$$
+  if [ ! -f ${prefix}/lib/tmpfiles.d/indimail.conf ] ; then
+    mv /tmp/indimail/indimail.conf.$$ ${prefix}/lib/tmpfiles.d/indimail.conf 
+  else
+    cmp -s /tmp/indimail/indimail.conf.$$ ${prefix}/lib/tmpfiles.d/indimail.conf 2>/dev/null
+    if [ $? -eq 0 ] ; then
+      rm -f /tmp/indimail/indimail.conf.$$
+    else
+      mv /tmp/indimail/indimail.conf.$$ ${prefix}/lib/tmpfiles.d/indimail.conf 
+    fi
+  fi
+fi
+
+if [ $upgrade -eq 1 ] ; then # upgrade
+	(
+	if [ -f ${libexecdir}/iupgrade.sh ] ; then
+		log_it "Running Custom Upgrade Script for post upgrade"
+		/bin/sh ${libexecdir}/iupgrade.sh post upgrade 3.4.8 $* | tai64n | tai64nlocal
+	fi
+
+    # refresh indimail services
+    svc_list=""
+    for i in mrtg mysql.3306 indisrvr.4000 inlookup.infifo \
+    qmail-poppass.106
+    do
+      if [ ! -d ${servicedir}/$i ] ; then
+        continue
+      fi
+      svc_list="$svc_list ${servicedir}/$i"
+    done
+    if [ $noproxy -eq 0 ] ; then
+      for i in proxy-imapd.4143 proxy-imapd-ssl.9143 \
+        proxy-pop3d.4110 proxy-pop3d-ssl.9110
+      do
+        if [ ! -d ${servicedir}/$i ] ; then
+          continue
+        fi
+        svc_list="$svc_list ${servicedir}/$i"
+      done
+    fi
+	${prefix}/sbin/svctool --servicedir=${servicedir} --refreshsvc="$svc_list" | tai64n | tai64nlocal
+
+	# start indimail services after upgrade
+	if [ -d /run ] ; then
+		rundir=/run/svscan
+	elif [ -d /var/run ] ; then
+		rundir=/var/run/svscan
+	else
+		rundir=${servicedir}
+	fi
+	set +e
+	for i in mrtg mysql.3306 indisrvr.4000 inlookup.infifo \
+		qmail-poppass.106 qmail-logfifo proxy-imapd.4143 \
+		proxy-imapd-ssl.9143 proxy-pop3d.4110 proxy-pop3d-ssl.9110
+	do
+		if [ ! -d ${servicedir}/$i ] ; then
+			continue
+		fi
+		${prefix}/bin/svok ${servicedir}/$i >/dev/null 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
+
+	#update VIRTUAL_PKG_LIB for smtp service
+	indlib=`ls -d /usr/lib/*-linux-gnu/libindimail.so.*.*.* /usr/lib*/libindimail.so.*.*.* 2>/dev/null || true`
+	for port in 25 465 587
+	do
+		if [ -n "$indlib" -a -f "$indlib" ] ; then
+			if [ -f ${servicedir}/qmail-smtpd.$port/variables ] ; then
+				echo $indlib > ${servicedir}/qmail-smtpd.$port/variables/VIRTUAL_PKG_LIB
+			fi
+		fi
+	done
+	if [ -n "$indlib" -a -f "$indlib" ] ; then
+		if [ -f ${servicedir}/qmail-send.25/variables ] ; then
+			echo $indlib > ${servicedir}/qmail-send.25/variables/VIRTUAL_PKG_LIB
+		fi
+	fi
+	) >> /var/log/indimail-setup.log 2>&1
+	exit 0
+fi
+# Recreate ld.so links and cache
+if [ ! "${prefix}" = "/usr" ] ; then
+	echo "recreating ld.so cache"
+	if [ -d /etc/ld.so.conf.d ] ; then
+		(
+		if [ -d ${prefix}/lib64 ] ; then
+			echo ${prefix}/lib64
+		else
+			echo ${prefix}/lib
+		fi
+		) > /etc/ld.so.conf.d/indimail-`uname -m`.conf
+	fi
+	/sbin/ldconfig
+fi
+
+log_it "Doing Post Install"
+echo ""
+echo "1. Configure ${logdir} for multilog"
+echo "2. Configure ${servicedir}"
+echo "3. Configure IndiMail settings"
+echo "4. Configure ${sysconfdir}/indimail.cnf for MySQL service"
+echo "5. Configure MySQL DB in ${indimaildir}/mysqldb/data"
+echo "6. Configure indsrvr, inlookup, poppass services"
+echo "7. Configure tcprules database for popass"
+echo "8. Configure apparmor configuration"
+echo "9. Configure default cron entries"
+echo ""
+
+if [ -x /bin/touch ] ; then
+  TOUCH=/bin/touch
+elif [ -x /usr/bin/touch ] ; then
+  TOUCH=/usr/bin/touch
+else
+  TOUCH=/bin/touch
+fi
+(
+log_it "Creating ${logdir}"
+if [ $noproxy -eq 0 ] ; then
+for i in proxyIMAP.4143 proxyPOP3.4110
+do
+  /bin/mkdir -p ${logdir}/$i
+  /bin/chown -R qmaill:nofiles ${logdir}/$i
+done
+fi
+
+if [ -d /run ] ; then
+  logfifo="/run/indimail/logfifo"
+  /bin/mkdir -p /run/indimail
+elif [ -d /var/run ] ; then
+  logfifo="/var/run/indimail/logfifo"
+  /bin/mkdir /var/run/indimail
+else
+  logfifo="/tmp/logfifo"
+fi
+
+if [ $build_on_obs -eq 0 ] ; then
+	if [ -x /usr/bin/uname -o -x /bin/uname ] ; then
+		default_domain=$(echo $([ -n "$HOSTNAME" ] && echo "$HOSTNAME" || uname -n) | sed 's/^\([^\.]*\)\.\([^\.]*\)\./\2\./')
+	else
+		default_domain=$([ -n "$HOSTNAME" ] && echo "$HOSTNAME" | sed 's/^\([^\.]*\)\.\([^\.]*\)\./\2\./' || echo ${default_domain})
+	fi
+fi
+
+a_arch=`uname -m`
+if [ $noproxy -eq 0 ] ; then
+  if [ " $a_arch" = " x86_64" ] ; then
+    imap_pop3_mem=104857600
+    imapspop3_mem=104857600
+  else
+    imap_pop3_mem=52428800
+    imapspop3_mem=52428800
+  fi
+  ${prefix}/sbin/svctool --imap=4143 --servicedir=$servicedir --localip=0 \
+	  --maxdaemons=40 --maxperip=25 --infifo=infifo \
+	  --memory=$imap_pop3_mem --proxy=143 --starttls | tai64n | tai64nlocal
+  ${prefix}/sbin/svctool --imap=9143 --servicedir=$servicedir --localip=0 \
+	  --maxdaemons=40 --maxperip=25 --infifo=infifo \
+	  --memory=$imapspop3_mem --proxy=143 --ssl | tai64n | tai64nlocal
+  ${prefix}/sbin/svctool --pop3=4110 --servicedir=$servicedir --localip=0 \
+	  --maxdaemons=40 --maxperip=25 --infifo=infifo \
+	  --memory=$imap_pop3_mem --proxy=110 --starttls | tai64n | tai64nlocal
+  ${prefix}/sbin/svctool --pop3=9110 --servicedir=$servicedir --localip=0 \
+	  --maxdaemons=40 --maxperip=25 --infifo=infifo \
+	  --memory=$imapspop3_mem --proxy=110 --ssl | tai64n | tai64nlocal
+
+  # add courier-imap auth module authindi
+  set +e
+  log_it "adding authindi as Proxy IMAP/POP3 auth module"
+  for i in `ls -d ${servicedir}/proxy-pop3d* ${servicedir}/proxy-imapd*`
+  do
+    if [ -s $i/variables/IMAPMODULES ] ; then
+      grep authindi $i/variables/IMAPMODULES > /dev/null
+      if [ $? -ne 0 ] ; then
+        AUTHM="`cat $i/variables/IMAPMODULES` authindi"
+        echo $AUTHM > $i/variables/IMAPMODULES
+      fi
+    fi
+  done
+  set -e
+fi
+
+# add checkpassword auth module vchkpass
+set +e
+log_it "adding vchkpass as SMTP auth module"
+for i in 465 587
+do
+  if [ -s ${servicedir}/qmail-smtpd.$i/variables/AUTHMODULES ] ; then
+    grep vchkpass ${servicedir}/qmail-smtpd.$i/variables/AUTHMODULES > /dev/null
+    if [ $? -ne 0 ] ; then
+      AUTHM="`cat ${servicedir}/qmail-smtpd.$i/variables/AUTHMODULES` /usr/sbin/vchkpass"
+      echo $AUTHM > ${servicedir}/qmail-smtpd.$i/variables/AUTHMODULES
+    fi
+  fi
+done
+set -e
+
+# add courier-imap auth module authindi
+set +e
+log_it "adding authindi as IMAP/POP3 auth module"
+for i in `ls -d ${servicedir}/qmail-pop3d* ${servicedir}/qmail-imapd*`
+do
+  if [ -s $i/variables/IMAPMODULES ] ; then
+    grep authindi $i/variables/IMAPMODULES > /dev/null
+    if [ $? -ne 0 ] ; then
+      AUTHM="`cat $i/variables/IMAPMODULES` authindi"
+      echo $AUTHM > $i/variables/IMAPMODULES
+    fi
+  fi
+done
+set -e
+
+# fifolog service
+${prefix}/sbin/svctool --fifologger=$logfifo --servicedir=${servicedir} | tai64n | tai64nlocal
+
+# mrtg service
+if [ -x /usr/bin/mrtg ] ; then
+	${prefix}/sbin/svctool --config=snmpdconf | tai64n | tai64nlocal
+	${prefix}/sbin/svctool --mrtg=/var/www/html/mailmrtg --servicedir=${servicedir} | tai64n | tai64nlocal
+fi
+
+log_it "Creating default indimail mysql config indimail.cnf"
+${prefix}/sbin/svctool --config=indimail --mysqlhost=localhost --mysqluser=indimail \
+  --mysqlpass=ssh-1.5- --mysqlsocket=${mysqlSocket} | tai64n | tai64nlocal
+
+log_it "Creating Database/Service for MySQL"
+# MySQL Config Creation
+if [ -x ${mysqlPrefix}/libexec/mysqld -o -x ${mysqlPrefix}/sbin/mysqld ] ; then
+  error=`ps -e|grep mysqld|grep -v grep|wc -l`
+  ${prefix}/sbin/svctool --config=mysql --mysqlPrefix=${mysqlPrefix} --mysqlsocket=${mysqlSocket} \
+    --databasedir=${indimaildir}/mysqldb | tai64n | tai64nlocal
+  # MySQL Database Creation
+  ${prefix}/sbin/svctool --config=mysqldb --mysqlPrefix=${mysqlPrefix} --mysqluser=indimail --mysqlpass=ssh-1.5- \
+    --databasedir=${indimaildir}/mysqldb --base_path=${mbase} --mysqlsocket="${mysqlSocket}".tmp | tai64n | tai64nlocal
+  # MySQL Supervise creation
+  ${prefix}/sbin/svctool --mysql=3306 --servicedir=${servicedir} --mysqlPrefix=${mysqlPrefix} \
+    --databasedir=${indimaildir}/mysqldb --config=${sysconfdir}/indimail.cnf | tai64n | tai64nlocal
+  if [ ! -f ${indimaildir}/mysqldb/data/indimail/indimail.frm -a ! -f ${indimaildir}/mysqldb/data/indimail/indimail.ibd ] ; then
+    error=1
+  fi
+  if [ $error -gt 0 ] ; then
+    log_it "Disabling mysqld service"
+    $TOUCH ${servicedir}/mysql.3306/down
+  fi
+else
+  log_it "WARNING!!! Did not find mysqld in ${mysqlPrefix}/{libexec,sbin}. Skipping MySQL configuration" 1>&2
+fi
+
+log_it "Configuring apparmor"
+# MySQL apparmor
+if [ -x /etc/init.d/apparmor ] ; then
+ set +e
+ if [ -f ${sysconfdir}/apparmor.d/local/usr.sbin.mysqld -a -d /etc/apparmor.d/local ] ; then
+   cp ${sysconfdir}/apparmor.d/local/usr.sbin.mysqld /etc/apparmor.d/local
+ fi
+ if [ -f /etc/apparmor.d/local/usr.sbin.mysqld ] ; then
+   log_it "Reloading apparmor profiles..."
+   /usr/sbin/service apparmor reload || true
+ else
+   log_it "Shutting down apparmor..."
+   /usr/sbin/service apparmor stop || true
+   /usr/sbin/service apparmor teardown || true
+ fi
+ set -e
+fi
+
+log_it "Configuring indimail daemons indisrvr"
+# IndiMail Daemons
+${prefix}/sbin/svctool --indisrvr=4000 --servicedir=$servicedir \
+	--localip=0 --maxdaemons=40 --maxperip=25 --avguserquota=2097152 \
+	--certfile=${sysconfdir}/certs/servercert.pem --ssl \
+	--hardquota=52428800 --base_path=${mbase} | tai64n | tai64nlocal
+${prefix}/sbin/svctool --inlookup=infifo --servicedir=$servicedir \
+	--cntrldir=control --threads=5 --activeDays=60 --password-cache \
+	--use-btree --max-btree-count=10000 | tai64n | tai64nlocal
+
+log_it "Configuring poppass"
+if [ " $a_arch" = " x86_64" ] ; then
+  poppass_mem=104857600
+else
+  poppass_mem=52428800
+fi
+${prefix}/sbin/svctool --poppass=106 --localip=0 --maxdaemons=40 --maxperip=25 \
+	--memory=$poppass_mem --certfile=${sysconfdir}/certs/servercert.pem --ssl \
+	--setpassword=${prefix}/sbin/vsetpass --servicedir=$servicedir | tai64n | tai64nlocal
+
+log_it "Creating default indimail tcp access control files"
+# rebuild cdb
+for j in `/bin/ls ${sysconfdir}/tcp/tcp.poppass 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
+
+#update VIRTUAL_PKG_LIB for smtp service
+log_it "Updating VIRTUAL_PKG_LIB env variable for SMTP and delivery"
+indlib=`ls -d /usr/lib/*-linux-gnu/libindimail.so.*.*.* /usr/lib*/libindimail.so.*.*.* 2>/dev/null || true`
+for port in 25 465 587
+do
+  if [ -n "$indlib" -a -f "$indlib" ] ; then
+    if [ -f ${servicedir}/qmail-smtpd.$port/variables ] ; then
+      echo $indlib > ${servicedir}/qmail-smtpd.$port/variables/VIRTUAL_PKG_LIB
+    fi
+  fi
+done
+if [ -n "$indlib" -a -f "$indlib" ] ; then
+  if [ -f ${servicedir}/qmail-send.25/variables ] ; then
+    echo $indlib > ${servicedir}/qmail-send.25/variables/VIRTUAL_PKG_LIB
+  fi
+fi
+
+log_it "Turning off automatic refresh"
+# turn off automatic refresh for services during first time installation
+svc_list=""
+for i in mrtg mysql.3306 indisrvr.4000 inlookup.infifo \
+qmail-poppass.106
+do
+  if [ ! -d ${servicedir}/$i ] ; then
+    continue
+  fi
+  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
+done
+
+if [ $noproxy -eq 0 ] ; then
+for i in proxy-imapd.4143 proxy-imapd-ssl.9143 \
+  proxy-pop3d.4110 proxy-pop3d-ssl.9110
+do
+  if [ ! -d ${servicedir}/$i ] ; then
+    continue
+  fi
+  svc_list="$svc_list ${servicedir}/$i"
+  ${prefix}/sbin/svctool --servicedir=${servicedir} --service-name=$i \
+    --export-variables=${servicedir}/$i/variables/.variables  --force | tai64n | tai64nlocal
+done
+fi
+${prefix}/sbin/svctool --servicedir=${servicedir} --autorefresh="0 $svc_list" | tai64n | tai64nlocal
+${prefix}/sbin/svctool --fixsharedlibs | tai64n | tai64nlocal
+
+if [ -f ${libexecdir}/iupgrade.sh ] ; then
+  log_it "Running Custom Installation Script for post install"
+  /bin/sh ${libexecdir}/iupgrade.sh post install 3.4.8 $* | tai64n | tai64nlocal
+fi
+) >> /var/log/indimail-setup.log 2>&1
+
+if [ -f /etc/init/svscan.conf -o -f /etc/event.d/svscan ] ; then
+	echo "1. Execute /sbin/initctl emit qmailstart to start services"
+	count=1
+elif [ -f /etc/systemd/system/multi-user.target.wants/svscan.service ] ; then
+	echo "1. Execute /bin/systemctl start svscan to start services"
+	count=1
+else
+	echo "1. Execute ${prefix}/sbin/initsvc -on"
+	echo "2. Execute /sbin/init q to start services"
+	count=2
+fi
+echo "   You can also use the 'service' command to start indimail"
+echo "   sudo service indimail start"
+count=`expr $count + 1`
+echo "$count. If you want to use IndiMail to manage MySQL startup, remove"
+echo "   ${servicedir}/mysql.3306/down"
+count=`expr $count + 1`
+echo "$count. Change your default domain in ${sysconfdir}/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 ${sysconfdir}/certs/servercert.pem ] ; then
+count=`expr $count + 1`
+echo "$count. You need to create CERTS for STARTTLS."
+echo "   Run the following command to create Certificate for TLS/SSL"
+echo "   ${prefix}/sbin/svctool --config=cert --postmaster=postmaster@${default_domain} --common_name=${default_domain}"
+fi
+echo
+log_it "Check /var/log/indimail-setup.log for the detailed installation log!!!"
+
+exit 0
--- indimail-3.4.8.orig/debian/indimail.postrm
+++ indimail-3.4.8/debian/indimail.postrm
@@ -0,0 +1,202 @@
+#!/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
+mandir=/usr/share/man
+indimaildir=/var/indimail
+libexecdir=/usr/libexec/indimail
+sysconfdir=/etc/indimail
+servicedir=/service
+default_domain=runnervmwhb2z
+logdir=/var/log/svc
+rm=/bin/rm
+rmdir=/bin/rmdir
+mv=/bin/mv
+build_on_obs=0
+####################################
+noproxy=0
+
+log_it()
+{
+  echo "$(echo  ""|tai64n|tai64nlocal)$*"
+}
+
+case "$1" in
+    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+	if [ -f ${libexecdir}/iupgrade.sh ] ; then
+	(
+		log_it "Running Custom Upgrade Script for pre $1"
+		/bin/sh ${libexecdir}/iupgrade.sh postrm $1 3.4.8 $* | tai64n | tai64nlocal
+	) >> /var/log/indimail-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
+if [ $build_on_obs -eq 0 ] ; then
+	if [ -x /usr/bin/uname -o -x /bin/uname ] ; then
+		default_domain=$(echo $([ -n "$HOSTNAME" ] && echo "$HOSTNAME" || uname -n) | sed 's/^\([^\.]*\)\.\([^\.]*\)\./\2\./')
+	else
+		default_domain=$([ -n "$HOSTNAME" ] && echo "$HOSTNAME" | sed 's/^\([^\.]*\)\.\([^\.]*\)\./\2\./' || echo ${default_domain})
+	fi
+fi
+#
+# Debian silliness
+#
+(
+if [ " $1" = " purge" ] ; then
+	log_it "removing database and configuration"
+	${rm} -rf ${indimaildir}/mysqldb || true
+	if [ -f /etc/mysql/indimail.cnf ] ; then
+		${rm} -f /etc/mysql/indimail.cnf
+	fi
+	# remove all virtual domains
+	for i in `ls ${indimaildir}/domains`
+	do
+		grep -wv "^+$i-" ${sysconfdir}/users/assign > ${sysconfdir}/assign.tmp
+		${mv} ${sysconfdir}/assign.tmp ${sysconfdir}/users/assign
+	done
+	if [ -x ${prefix}/sbin/qmail-newu ] ; then
+		${prefix}/sbin/qmail-newu
+	fi
+fi
+
+for i in .qmail-nonspam .qmail-register-nonspam .qmail-register-spam .qmail-spam
+do
+	${rm} -f ${indimaildir}/domains/${default_domain}/$i
+done
+
+for port in 465 25 587
+do
+	> ${servicedir}/qmail-smtpd.$port/variables/VIRTUAL_PKG_LIB
+done
+> ${servicedir}/qmail-send.25/variables/VIRTUAL_PKG_LIB
+${rm} -f ${sysconfdir}/indimail.mrtg.ok ${sysconfdir}/system.mrtg.ok
+log_it "removing startup services"
+
+if [ $noproxy -eq 0 ] ; then
+for i in proxy-imapd.4143 proxy-imapd-ssl.9143 \
+proxy-pop3d.4110 proxy-pop3d-ssl.9110
+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 || true
+		svc -dx ${servicedir}/$i/log >/dev/null 2>&1 || true
+	fi
+	if [ -d ${servicedir}/$i -o -L ${servicedir}/$i ] ; then
+		${rm} -rf ${servicedir}/$i || true
+ 	fi
+done
+fi
+
+for i in indisrvr.4000 inlookup.infifo mysql.3306 \
+qmail-poppass.106 mrtg qmail-logfifo
+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}/log/$i -o -L ${servicedir}/log/$i ] ; 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/log ] ; then
+		${rm} -rf ${servicedir}/$i || true
+	fi
+done
+
+count=`/bin/ls ${servicedir} 2>/dev/null| /usr/bin/wc -l`
+if [ $count -eq 0 ] ; then # ignore disabled services
+	${rm} -rf ${servicedir} || true
+fi
+
+if [ -d /etc/cron.d ] ; then
+	log_it "removing cron entries"
+	${rm} -f /etc/cron.d/indimail.cron.d
+fi
+
+log_it "removing TCP configuration"
+${rm} -f ${sysconfdir}/tcp/tcp.poppass.cdb ${sysconfdir}/tcp/tcp.poppass
+${rm} -f ${sysconfdir}/control/controlfiles
+for i in indimail.cnf indimail-stat.override backup.conf headerlist \
+	indimail.mrtg.cfg procmailrc indimail.settings osh.table perm_list.indimail \
+	qmailprog.list services.log
+do
+	${rm} -f ${sysconfdir}/$i
+done
+
+log_it "removing logs"
+${rm} -f ${indimaildir}/mysqldb/logs/logisam.log
+${rm} -f ${indimaildir}/mysqldb/logs/logquery
+${rm} -f ${indimaildir}/mysqldb/logs/logslow
+
+if [ -h ${logdir} ] ; then
+	log_dir=`/bin/ls -ld ${logdir} | /usr/bin/awk '{print $10}'`
+else
+	log_dir=${logdir}
+fi
+
+if [ $noproxy -eq 0 ] ; then
+for i in proxyIMAP.4143 proxyIMAP.9143 \
+proxyPOP3.4110 proxyPOP3.9110
+do
+	${rm} -rf $log_dir/$i
+done
+fi
+
+for i in indisrvr.4000 inlookup.infifo \
+mrtg mysql.3306 poppass.106 logfifo
+do
+	${rm} -rf $log_dir/$i
+done
+
+if [ ! "${prefix}" = "/usr" ] ; then
+	log_it "recreating ld.so cache"
+	/sbin/ldconfig
+fi
+) >> /var/log/indimail-setup.log
+exit 0
--- indimail-3.4.8.orig/debian/indimail.preinst
+++ indimail-3.4.8/debian/indimail.preinst
@@ -0,0 +1,109 @@
+#!/bin/sh
+# preinst script for indimail
+#
+# see: dh_installdeb(1)
+
+set -e
+prefix=/usr
+indimaildir=/var/indimail
+libexecdir=/usr/libexec/indimail
+sysconfdir=/etc/indimail
+servicedir=/service
+
+# 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)$*"
+}
+
+log_it "Checking for mandatory user/group mysql.."
+/usr/bin/getent group  mysql > /dev/null || (echo "group mysql does not exist. Aborting..." && false)
+/usr/bin/getent passwd mysql > /dev/null || (echo "user  mysql does not exist. Aborting..." && false)
+
+case "$1" in
+    install)
+	if [ -f ${libexecdir}/iupgrade.sh ] ; then
+		(
+		log_it "Running Custom Upgrade Script for pre $1"
+		/bin/sh ${libexecdir}/iupgrade.sh pre $1 3.4.8 $* | tai64n | tai64nlocal
+		) >> /var/log/indimail-setup.log 2>&1
+	fi
+	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
+			systemctl stop nscd.service
+		fi
+	fi
+	#
+	# Create a users and groups. Do not report any problems if they already
+	# exists.
+	#
+	(
+	log_it "Adding IndiMail users/groups"
+	/usr/bin/getent group indimail  > /dev/null || \
+		/usr/sbin/groupadd -r -g 555 indimail || /usr/sbin/groupadd indimail || true
+	# add for roundcube/php to access certs
+	/usr/bin/getent group apache    > /dev/null && /usr/sbin/usermod -aG qcerts apache || true
+	
+	/usr/bin/getent passwd indimail > /dev/null || \
+		/usr/sbin/useradd -r -g indimail -u 555 -d ${indimaildir} indimail || \
+		/usr/sbin/useradd -r -g indimail -d ${indimaildir} indimail || true
+	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
+			systemctl stop nscd.service
+		fi
+	fi
+	) >> /var/log/indimail-setup.log 2>&1
+	;;
+	upgrade)
+	# stop indimail services before upgrade
+	if [ -d /run ] ; then
+		rundir=/run/svscan
+	elif [ -d /var/run ] ; then
+		rundir=/var/run/svscan
+	else
+		rundir=${servicedir}
+	fi
+	set +e
+	for i in mrtg mysql.3306 indisrvr.4000 inlookup.infifo \
+		qmail-poppass.106 qmail-logfifo proxy-imapd.4143 \
+		proxy-imapd-ssl.9143 proxy-pop3d.4110 proxy-pop3d-ssl.9110
+	do
+		if [ ! -d ${servicedir}/$i ] ; then
+			continue
+		fi
+		${prefix}/bin/svstat ${servicedir}/$i >/dev/null 2>&1
+		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
+	;;
+	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-3.4.8.orig/debian/indimail.prerm
+++ indimail-3.4.8/debian/indimail.prerm
@@ -0,0 +1,125 @@
+#!/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
+indimaildir=/var/indimail
+sysconfdir=/etc/indimail
+libexecdir=/usr/libexec/indimail
+servicedir=/service
+mandir=/usr/share/man
+rm=/bin/rm
+mv=/bin/mv
+
+log_it()
+{
+  echo "$(echo  ""|tai64n|tai64nlocal)$*"
+}
+
+case "$1" in
+    remove|upgrade|deconfigure)
+	(
+	if [ -f ${libexecdir}/iupgrade.sh ] ; then
+		log_it "Running Custom Upgrade Script for prerm $1"
+		/bin/sh ${libexecdir}/iupgrade.sh prerm $1 3.4.8 $* | tai64n | tai64nlocal
+	fi
+	# stop indimail services before upgrade
+	if [ -d /run ] ; then
+		rundir=/run/svscan
+	elif [ -d /var/run ] ; then
+		rundir=/var/run/svscan
+	else
+		rundir=${servicedir}
+	fi
+	set +e
+	for i in mrtg mysql.3306 indisrvr.4000 inlookup.infifo \
+		qmail-poppass.106 qmail-logfifo proxy-imapd.4143 \
+		proxy-imapd-ssl.9143 \ proxy-pop3d.4110 proxy-pop3d-ssl.9110
+	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-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 ${sysconfdir}/indimail-stat.override -a -f /usr/sbin/dpkg-statoverride ] ; then
+	log_it "reverting permissions"
+	/bin/cat ${sysconfdir}/indimail-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
+	${rm} -f ${sysconfdir}/indimail-stat.override
+fi
+if [ -f ${mandir}/man8/rmail_i.8.gz ] ; then
+${mv} ${mandir}/man8/rmail_i.8.gz ${mandir}/man8/rmail.8.gz || true
+fi
+if [ -f ${mandir}/man8/rmail_i.8 ] ; then
+${mv} ${mandir}/man8/rmail_i.8 ${mandir}/man8/rmail.8 || true
+fi
+if [ -f ${mandir}/man1/newaliases_i.1.gz ] ; then
+${mv} ${mandir}/man1/newaliases_i.1.gz ${mandir}/man1/newaliases.1.gz || true
+fi
+if [ -f ${mandir}/man1/newaliases_i.1 ] ; then
+${mv} ${mandir}/man1/newaliases_i.1 ${mandir}/man1/newaliases.1 || true
+fi
+if [ -f ${prefix}/bin/newaliases_i ] ; then
+${mv} ${prefix}/bin/newaliases_i ${prefix}/bin/newaliases || true
+fi
+if [ -f ${prefix}/bin/rmail_i ] ; then
+${mv} ${prefix}/bin/rmail_i ${prefix}/bin/rmail || true
+fi
+
+for i in lib sbin
+do
+	if [ -f /usr/$i/sendmail.old ] ; then
+		${mv} /usr/$i/sendmail.old /usr/$i/sendmail || true
+	fi
+done
+
+if [ -f ${libexecdir}/iupgrade.sh ] ; then
+log_it "Running Custom Upgrade Script for prerm $1"
+/bin/sh ${libexecdir}/iupgrade.sh prerm uninstall 3.4.8 $* | tai64n | tai64nlocal
+fi
+) >> /var/log/indimail-setup.log 2>&1
+exit 0
--- indimail-3.4.8.orig/debian/libindimail.install
+++ indimail-3.4.8/debian/libindimail.install
@@ -0,0 +1,2 @@
+usr/@libd@/*.so.* /usr/@libd@
+usr/lib/pkgconfig/libindimail.pc /usr/lib/pkgconfig
--- indimail-3.4.8.orig/debian/rules
+++ indimail-3.4.8/debian/rules
@@ -0,0 +1,113 @@
+#!/usr/bin/make -f
+
+# 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
+indimaildir=/var/indimail
+domaindir=/var/indimail
+version=3.4.8
+sysconfdir=/etc/indimail
+libexecdir=/usr/libexec/indimail
+mandir=/usr/share/man
+arch=$(shell uname -m)
+# 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)
+default_domain=indimail.org
+rm=/bin/rm
+cp=/bin/cp
+
+DESTDIR=$(CURDIR)/debian/tmp
+
+libdir=/usr/lib
+pkgconfigdir=/usr/lib/pkgconfig
+
+build: build-stamp
+build-stamp:
+	dh_testdir
+	#
+	# run configure script
+	#
+	./configure $(shell dpkg-buildflags --export=cmdline) \
+		--prefix=$(prefix) --libdir=$(prefix)/$(libd) \
+		--with-pkgconfigdir=$(pkgconfigdir) --libexecdir=$(libexecdir) \
+		--mandir=$(prefix)/share/man --datarootdir=$(prefix)/share/indimail \
+		--mandir=$(mandir) --sysconfdir=$(sysconfdir) \
+		--enable-qmaildir=$(indimaildir) --enable-domaindir=$(domaindir) \
+		--enable-tcprules-prog=$(prefix)/bin/tcprules \
+		--enable-tcpserver-file=$(sysconfdir)/tcp/tcp.smtp \
+		--enable-default-domain=$(default_domain) \
+		--enable-mysqlprefix=/usr `cat config/indimail.opts`
+	#
+	# run make
+	#
+	$(MAKE) -s
+	${rm} -f $(DESTDIR)$(prefix)/$(libd)/*.la
+	if [ -d /usr/src/packages/SOURCES.DEB ] ; then \
+		if [ -f indimail.postinst ] ; then \
+			echo setting "build_on_obs=1 for indimail.postinst"; \
+			sed -i 's{build_on_obs=.*{build_on_obs=1{' indimail.postinst; \
+		fi; \
+		if [ -f indimail.postrm ] ; then \
+			echo setting "build_on_obs=1 for indimail.postrm"; \
+			sed -i 's{build_on_obs=.*{build_on_obs=1{' indimail.postrm; \
+		fi; \
+	fi
+	touch build-stamp
+
+clean:
+	${rm} -f build-stamp configure-stamp
+	${rm} -rf $(DESTDIR)
+	$(MAKE) -s clean || true
+	$(MAKE) -s distclean || true
+	dh_testdir
+	dh_testroot
+	dh_clean
+	dh_auto_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_prep || dh_clean -k
+	dh_installdirs
+	$(MAKE) -s DESTDIR=$(DESTDIR) install
+	mkdir -p $(DESTDIR)$(domaindir)/domains
+
+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.install
+	sed -i -e 's,@libd\@,$(libd),g' debian/indimail-dev.install
+	sed -i -e 's,@libd\@,$(libd),g' debian/libindimail.install
+	dh_install --sourcedir=$(DESTDIR) -pindimail
+	dh_install --sourcedir=$(DESTDIR) -pindimail-dev
+	dh_install --sourcedir=$(DESTDIR) -plibindimail
+	dh_installchangelogs
+	dh_installcron
+	dh_installdocs
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_makeshlibs -V
+	dh_shlibdeps
+	dh_gencontrol
+	dh_installcron
+	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
