--- indimail-access-1.3.orig/debian/changelog
+++ indimail-access-1.3/debian/changelog
@@ -0,0 +1,18 @@
+indimail-access (1.3-1.1+1.3) stable; urgency=low
+
+  * version number update by debtransform
+
+ -- debtransform <build@opensuse.org>  Sat, 14 Mar 2026 22:49:34 +0000
+
+indimail-access (1.3-1.1) stable; urgency=low
+
+  * courier-imap/libs/rfc1035/rfc1035str.c: Fix missing prototype for strcasecmp
+  * indimail-access.spec: use $HOME/rpmbuild/SOURCES for source directory
+  * indimail-access.spec: use python3-devel for mageia
+  * upgraded courier-imap to 5.2.7
+  * upgraded maildrop to 3.1.7
+  * Turn of AutoReqProv for suse builds
+  * fix gcc14 errors
+  * Fixed debian/rules dh_strip
+
+ -- Manvendra Bhangui <indimail-access@indimail.org>  Mon, 06 Oct 2025 03:32:22 +0000
--- indimail-access-1.3.orig/debian/compat
+++ indimail-access-1.3/debian/compat
@@ -0,0 +1 @@
+10
--- indimail-access-1.3.orig/debian/control
+++ indimail-access-1.3/debian/control
@@ -0,0 +1,20 @@
+Source: indimail-access
+Section: mail
+Priority: optional
+Maintainer: Manvendra Bhangui <indimail-access@indimail.org>
+Standards-Version: 4.5.0
+Build-Depends: debhelper (>= 9), gcc, g++, binutils, coreutils, automake, libpam0g-dev, libdb-dev, libgcrypt20-dev, libssl-dev, bison (>= 1.2), flex (>= 2.5), m4, gawk
+Homepage: https://github.com/mbhangui/indimail-virtualdomains
+
+Package: indimail-access
+Architecture: any
+Pre-Depends: indimail-mta (>2.6)
+Conflicts: indimail (< 3.2)
+Depends: ${shlibs:Depends}, ${misc:Depends}, net-tools, coreutils, findutils, procps
+Description: indimail-access package provides imap, pop3 and fetchmail retrieval for IndiMail
+ IMAP/POP3 protocol is provided by Courier Imap.
+ Mail retreival is provided by Fetchmail.
+ .
+ IndiMail provides ability for a single domain to have users
+ across multiple hosts (even across different geographical
+ locations) and tools to manage virtual domains.
--- indimail-access-1.3.orig/debian/copyright
+++ indimail-access-1.3/debian/copyright
@@ -0,0 +1,38 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: indimail-access
+Upstream-Contact: Manvendra Bhangui <indimail-access@indimail.org>
+Source: https://github.com/mbhangui/indimail-virtualdomains
+
+Files: *
+Copyright: 2020 Manvendra Bhangui <mbhangui@gmail.com>
+License: GPL-3.0+
+
+Files: debian/*
+Copyright: 2020 Manvendra Bhangui <mbhangui@gmail.com>
+License: GPL-3.0+
+
+License: GPL-3.0+
+ 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 package 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 <https://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
+
+# Please also look if there are files or directories which have a
+# different copyright/license attached and list them here.
+# Please avoid picking licenses with terms that are more restrictive than the
+# packaged work, as it may make Debian's contributions unacceptable upstream.
+#
+# If you need, there are some extra license texts available in two places:
+#   /usr/share/debhelper/dh_make/licenses/
+#   /usr/share/common-licenses/
--- indimail-access-1.3.orig/debian/indimail-access.install
+++ indimail-access-1.3/debian/indimail-access.install
@@ -0,0 +1,10 @@
+usr/bin                /usr
+usr/sbin               /usr
+usr/libexec/indimail   /usr/libexec
+usr/share/indimail     /usr/share
+usr/share/man/man1     /usr/share/man
+usr/share/man/man7     /usr/share/man
+usr/share/man/man8     /usr/share/man
+usr/lib/python*        /usr/lib
+usr/@libd@/*.so.*      /usr/@libd@
+etc/indimail           /etc
--- indimail-access-1.3.orig/debian/obs_deb_prep
+++ indimail-access-1.3/debian/obs_deb_prep
@@ -0,0 +1,27 @@
+#!/bin/sh
+set -e
+#
+# Unpacker for OpenSUSE build service
+#
+version=1.3
+courier_version=5.2.7
+fetchmail_version=6.5.0.beta9
+
+for i in courier-imap-"$courier_version" fetchmail-"$fetchmail_version"
+do
+	/bin/rm -rf $i
+	if [ -f ../SOURCES/$i.tar.gz ] ; then
+		echo "extracting $i.tar.gz"
+		gunzip -c ../SOURCES/$i.tar.gz |tar xf -
+	elif [ -f ../SOURCES/$i.tar.xz ] ; then
+		echo "extracting $i.tar.xz"
+		xz -d -c ../SOURCES/$i.tar.xz|tar xf -
+	elif [ -f ../SOURCES/$i.tar.bz2 ] ; then
+		echo "extracting $i.tar.bz2"
+		bzip2 -d -c ../SOURCES/$i.tar.bz2|tar xf -
+	else
+		echo "no source archive for $i"
+		exit 1
+	fi
+done
+exit 0
--- indimail-access-1.3.orig/debian/perm_list.imap
+++ indimail-access-1.3/debian/perm_list.imap
@@ -0,0 +1,2 @@
+%attr(4755,root,root)       /usr/libexec/indimail/imapmodules/authshadow
+%attr(4755,root,root)       /usr/libexec/indimail/imapmodules/authpam
--- indimail-access-1.3.orig/debian/postinst
+++ indimail-access-1.3/debian/postinst
@@ -0,0 +1,341 @@
+#!/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
+version=1.3
+indimaildir=/var/indimail
+mandir=/usr/share/man
+libexecdir=/usr/libexec/indimail
+qcount=5
+qbase=${indimaildir}/queue
+logdir=/var/log/svc
+servicedir=/service
+sysconfdir=/etc/indimail
+cp=/bin/cp
+rm=/bin/rm
+mv=/bin/mv
+####################################
+nocourierimap=0
+nofetchmail=0
+nodksignature=0
+dkimkeyfn=default
+default_domain=indimail.org
+build_on_obs=0
+
+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
+}
+
+ID=`id -u`
+if [ $ID -ne 0 ] ; then
+	echo "You are not root" >&2
+	exit 1
+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}/perm_list.imap ] ; then
+	echo "Fixing Permissions"
+	(
+	/bin/grep -v "^#" ${sysconfdir}/perm_list.imap | while read line
+	do
+		if [ " $line" = " " ] ; then
+			continue
+		fi
+		fixperms $line
+	done
+	) > ${sysconfdir}/indimail-access-stat.override
+fi
+
+# indimail-access.upgrade/indimail-access.install are created
+# by the preinst script
+if [ $upgrade -eq 1 ] ; then # upgrade
+  svc_list=""
+  for i in qmail-imapd.143 qmail-imapd-ssl.993 \
+    qmail-pop3d.110 qmail-pop3d-ssl.995
+  do
+	if [ ! -d ${servicedir}/$i ] ; then
+		continue
+	fi
+    if [ -z "$svc_list" ] ; then
+      svc_list="${servicedir}/$i"
+    else
+      svc_list="$svc_list ${servicedir}/$i"
+    fi
+  done
+  ${prefix}/sbin/svctool --servicedir=${servicedir} --refreshsvc="$svc_list"
+  set +e
+  if [ -d /run ] ; then
+    rundir=/run
+  elif [ -d /var/run ] ; then
+    rundir=/var/run
+  else
+    rundir=${servicedir}
+  fi
+  for i in qmail-imapd.143 qmail-imapd-ssl.993 \
+    qmail-pop3d.110 qmail-pop3d-ssl.995 \
+    fetchmail
+  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 >/dev/null 2>&1
+    fi
+  done
+  set -e
+  exit 0
+fi
+# Recreate ld.so links and cache
+if [ ! "${prefix}" = "/usr" ] ; then
+  /sbin/ldconfig
+fi
+
+echo "Doing Post Install"
+echo ""
+echo "1. Configure ${logdir} for multilog"
+echo "2. Configure ${servicedir}"
+echo "3. Configure fetchmail service"
+echo "4. Configure IMAP/POP3 services"
+echo "5. Configure tcprules database for IMAP, POP3"
+echo ""
+
+if [ -x /bin/touch ] ; then
+  TOUCH=/bin/touch
+elif [ -x /usr/bin/touch ] ; then
+  TOUCH=/usr/bin/touch
+else
+  TOUCH=/bin/touch
+fi
+(
+echo "Creating ${logdir}"
+for i in fetchmail imapd.143 imapd-ssl.993 pop3d.110 pop3d-ssl.995
+do
+  /bin/mkdir -p ${logdir}/$i
+  /bin/chown -R qmaill:nofiles ${logdir}/$i
+done
+
+if [ -d /run ] ; then
+  logfifo="/run/indimail/logfifo"
+elif [ -d /var/run ] ; then
+  logfifo="/var/run/indimail/logfifo"
+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 [ " $a_arch" = " x86_64" ] ; then
+ fetchmail_mem=104857600
+ imap_pop3_mem=104857600
+ imapspop3_mem=104857600
+else
+ fetchmail_mem=52428800
+ imap_pop3_mem=52428800
+ imapspop3_mem=52428800
+fi
+
+if [ $nofetchmail -eq 0 ] ; then
+	# fetchmail
+	if [ $nodksignature -eq 0 ] ; then
+		if [ -f ${sysconfdir}/control/domainkeys/default ] ; then
+			ver_opt="both"
+		else
+			ver_opt="none"
+		fi
+	else
+		ver_opt="none"
+	fi
+	extra_opt=""
+	if [ -x ${prefix}/bin/bogofilter ] ; then
+		extra_opt="--spamfilter=\"${prefix}/bin/bogofilter -p -d ${sysconfdir}\""
+		extra_opt="$extra_opt --logfilter=$logfifo --rejectspam=0 --spamexitcode=0"
+	fi
+	if [ -f /usr/sbin/clamd -a -f /usr/bin/clamdscan ] ; then
+		qhpsi="/usr/bin/clamdscan %s --config=${sysconfdir}/scan.conf --fdpass --quiet --no-summary"
+		extra_opt="$extra_opt --qhpsi=\"$qhpsi\""
+	fi
+	eval ${prefix}/sbin/svctool --fetchmail --servicedir=$servicedir \
+		--qbase=${qbase} --qcount=${qcount} --qstart=1 \
+		--cntrldir=control \
+		--memory=$fetchmail_mem --fsync --syncdir \
+		--dkverify=$ver_opt \
+		$extra_opt
+	#
+	# user has to create fetchmailrc before which fetchmail cannot be started
+	#
+	/bin/touch $servicedir/fetchmail/down
+fi
+
+# IMAP/POP3
+if [ $nocourierimap -eq 0 ] ; then
+	${prefix}/sbin/svctool --imap=143 --servicedir=$servicedir --localip=0 \
+		--maxdaemons=40 --maxperip=25 --infifo=infifo --default-domain=${default_domain} \
+		--starttls --memory=$imap_pop3_mem
+	${prefix}/sbin/svctool --imap=993 --servicedir=$servicedir --localip=0 \
+		--maxdaemons=40 --maxperip=25 --infifo=infifo --default-domain=${default_domain} \
+		--memory=$imapspop3_mem --ssl
+	${prefix}/sbin/svctool --pop3=110 --servicedir=$servicedir --localip=0 \
+		--maxdaemons=40 --maxperip=25 --infifo=infifo --default-domain=${default_domain} \
+		--starttls --memory=$imap_pop3_mem
+	${prefix}/sbin/svctool --pop3=995 --servicedir=$servicedir --localip=0 \
+		--maxdaemons=40 --maxperip=25 --infifo=infifo --default-domain=${default_domain} \
+		--memory=$imapspop3_mem --ssl
+
+	# add courier-imap auth module authindi
+	echo "adding authindi as IMAP/POP3 auth module"
+	set +e
+	if [ -f ${libexecdir}/imapmodules/authindi ] ; then
+		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
+	fi
+	set -e
+fi
+
+# rebuild cdb
+for i in imap pop3 poppass
+do
+	for j in `/bin/ls ${sysconfdir}/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
+			echo "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
+
+if [ -f ${mandir}/man7/authlib.7 ] ; then
+	gzip ${mandir}/man7/authlib.7
+fi
+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
+# turn off automatic refresh for services during first time installation
+svc_list=""
+for i in fetchmail qmail-imapd.143 qmail-imapd-ssl.993 \
+  qmail-pop3d.110 qmail-pop3d-ssl.995
+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
+done
+${prefix}/sbin/svctool --servicedir=${servicedir} --autorefresh="0 $svc_list"
+) >> /var/log/indimail-access-setup.log 2>&1
+echo
+echo "Check /var/log/indimail-access-setup.log for the detailed installation log!!!"
+exit 0
--- indimail-access-1.3.orig/debian/postrm
+++ indimail-access-1.3/debian/postrm
@@ -0,0 +1,160 @@
+#!/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
+sysconfdir=/etc/indimail
+servicedir=/service
+logdir=/var/log/svc
+rm=/bin/rm
+rmdir=/bin/rmdir
+mv=/bin/mv
+####################################
+nocourierimap=0
+nofetchmail=0
+
+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
+if [ -x /usr/bin/uname -o -x /bin/uname ] ; then
+  default_domain=$(echo $([ -n "$HOSTNAME" ] && echo "$HOSTNAME" || uname -n) | sed 's/^\([^\.]*\)\.\([^\.]*\)\./\2\./')
+else
+  defaultDomain=@defaultdomain@
+  default_domain=$(echo $([ -n "$HOSTNAME" ] && echo "$HOSTNAME" || echo ${defaultDomain}) | sed 's/^\([^\.]*\)\.\([^\.]*\)\./\2\./')
+fi
+#
+# Debian silliness
+#
+if [ $nocourierimap -eq 0 ] ; then
+	echo "removing startup services"
+	for i in qmail-imapd.143 qmail-imapd-ssl.993 \
+		qmail-pop3d.110 qmail-pop3d-ssl.995 \
+		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
+			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
+
+	echo "removing TCP configuration"
+	for i in imap pop3
+	do
+		${rm} -f ${sysconfdir}/tcp/tcp.$i.cdb ${sysconfdir}/tcp/tcp.$i
+	done
+	for i in indimail-access-stat.override \
+		imapd.cnf imapd.dist imapd-ssl.dist \
+		pop3d.cnf pop3d.dist pop3d-ssl.dist \
+		quotawarnmsg.example perm_list.imap
+	do
+		${rm} -f ${sysconfdir}/$i
+	done
+	${rm} -f ${sysconfdir}/imapd.pem ${sysconfdir}/pop3d.pem
+	${rm} -f ${sysconfdir}/imapd.cnf.* ${sysconfdir}/pop3d.cnf.*
+fi
+
+if [ $nofetchmail -eq 0 ] ; then
+	echo "removing startup services"
+	if [ -d ${servicedir}/fetchmail -o -L ${servicedir}/fetchmail ] ; then
+		touch ${servicedir}/fetchmail/down
+		svc -dx ${servicedir}/fetchmail >/dev/null 2>&1 || true
+	fi
+	if [ -d ${servicedir}/fetchmail/log -o -L ${servicedir}/fetchmail/log ] ; then
+		touch ${servicedir}/fetchmail/log/down
+		svc -dx ${servicedir}/fetchmail/log >/dev/null 2>&1 || true
+	fi
+	if [ -d ${servicedir}/fetchmail -o -L ${servicedir}/fetchmail ] ; then
+		${rm} -rf ${servicedir}/fetchmail
+	fi
+	${rm} -f ${sysconfdir}/fetchmailrc
+fi
+
+count=`/bin/ls ${servicedir} 2>/dev/null| /usr/bin/wc -l`
+if [ $count -eq 0 ] ; then # ignore disabled services
+	${rm} -rf ${servicedir} || true
+fi
+
+echo "removing logs"
+if [ -h ${logdir} ] ; then
+	log_dir=`/bin/ls -ld ${logdir} | /usr/bin/awk '{print $10}'`
+else
+	log_dir=${logdir}
+fi
+
+if [ $nocourierimap -eq 0 ] ; then
+	for i in fetchmail imapd.143 imapd-ssl.993 \
+		pop3d.110 pop3d-ssl.995 \
+		proxyIMAP.4143 proxyIMAP.9143 \
+		proxyPOP3.4110 proxyPOP3.9110
+	do
+		${rm} -rf $log_dir/$i
+	done
+fi
+
+if [ $nofetchmail -eq 0 ] ; then
+	${rm} -rf $log_dir/fetchmail
+fi
+
+if [ ! "${prefix}" = "/usr" ] ; then
+	echo "recreating ld.so cache"
+	/sbin/ldconfig
+fi
+exit 0
--- indimail-access-1.3.orig/debian/preinst
+++ indimail-access-1.3/debian/preinst
@@ -0,0 +1,61 @@
+#!/bin/sh
+# preinst script for indimail
+#
+# see: dh_installdeb(1)
+
+set -e
+prefix=/usr
+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
+
+case "$1" in
+    upgrade)
+	if [ -d /run ] ; then
+		rundir=/run
+	elif [ -d /var/run ] ; then
+		rundir=/var/run
+	else
+		rundir=${servicedir}
+	fi
+	set +e
+	for i in qmail-imapd.143 qmail-imapd-ssl.993 \
+		qmail-pop3d.110 qmail-pop3d-ssl.995 \
+		fetchmail
+	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 || true
+		fi
+	done
+	set -e
+	;;
+    install)
+	;;
+
+    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-access-1.3.orig/debian/prerm
+++ indimail-access-1.3/debian/prerm
@@ -0,0 +1,84 @@
+#!/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
+sysconfdir=/etc/indimail
+servicedir=/service
+rm=/bin/rm
+
+ID=`id -u`
+if [ $ID -ne 0 ] ; then
+	echo "You are not root" >&2
+	exit 1
+fi
+
+case "$1" in
+    remove|upgrade|deconfigure)
+	if [ -d /run ] ; then
+		rundir=/run
+	elif [ -d /var/run ] ; then
+		rundir=/var/run
+	else
+		rundir=${servicedir}
+	fi
+	set +e
+	for i in qmail-imapd.143 qmail-imapd-ssl.993 \
+		qmail-pop3d.110 qmail-pop3d-ssl.995 \
+		fetchmail
+	do
+		${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 || true
+		fi
+	done
+	set -e
+    ;;
+
+    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-access-stat.override -a -f /usr/sbin/dpkg-statoverride ] ; then
+	echo "reverting permissions"
+	/bin/cat ${sysconfdir}/indimail-access-stat.override | while read line
+	do
+		if [ -f $line ] ; then
+			echo "reverting permission for $line"
+			/usr/sbin/dpkg-statoverride --remove $line || true
+		fi
+	done
+	${rm} -f ${sysconfdir}/indimail-access-stat.override
+fi
+
+exit 0
--- indimail-access-1.3.orig/debian/rules
+++ indimail-access-1.3/debian/rules
@@ -0,0 +1,142 @@
+#!/usr/bin/make -f
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# This is the debhelper compatibility version to use.
+# export DH_COMPAT=4
+DPKG_EXPORT_BUILDFLAGS = 1
+include /usr/share/dpkg/buildflags.mk
+#
+
+prefix=/usr
+sysconfdir=/etc/indimail
+libexecdir=/usr/libexec/indimail
+shareddir=/usr/share/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)
+courier_version=5.2.7
+fetchmail_version=6.5.0.beta9
+version=1.3
+release=1.1
+rm=/bin/rm
+cp=/bin/cp
+
+DESTDIR=$(CURDIR)/debian/tmp
+
+
+build: build-stamp
+build-stamp:
+	dh_testdir
+	#
+	# Extract source archives
+	#
+	if [ -f ../BUILD/debian/obs_deb_prep ] ; then sh ../BUILD/debian/obs_deb_prep; fi
+	#
+	# run configure script
+	#
+	if [ -d courier-imap-$(courier_version) ] ; then \
+		cd courier-imap-$(courier_version); \
+		autoreconf -fiv; \
+		./configure $(shell dpkg-buildflags --export=cmdline) \
+			--prefix=${prefix} --libexecdir=${libexecdir} --bindir=${prefix}/bin \
+			--mandir=${mandir} --sysconfdir=${sysconfdir} --libdir=${prefix}/${libd} \
+			--datarootdir=${shareddir} --with-certsdir=${sysconfdir}/certs \
+			--with-mailer=${prefix}/bin/sendmail --disable-root-check \
+			--without-userdb --without-authcustom --without-authchangepwdir \
+			--without-authgeneric --with-authshadow --with-authpwd \
+			--enable-syslog=1; \
+		if [ ! -f depcomp -a -f libs/unicode/depcomp ] ; then \
+			cp libs/unicode/depcomp .; \
+		elif [ -f depcomp -a ! -f libs/unicode/depcomp ] ; then \
+			cp ./depcomp libs/unicode/depcomp; \
+		fi; \
+		cd ..; \
+	fi
+	if [ -d fetchmail-$(fetchmail_version) ] ; then \
+		cd fetchmail-$(fetchmail_version); \
+		autoreconf -fiv; \
+		./configure $(shell dpkg-buildflags --export=cmdline) \
+			--prefix=${prefix} --libexecdir=${libexecdir} --sysconfdir=${sysconfdir} \
+			--datarootdir=${shareddir} --mandir=${mandir} \
+			--enable-indimail --with-ssl; \
+		cd ..; \
+	fi
+	#
+	# run make
+	#
+	if [ -d courier-imap-$(courier_version) ] ; then $(MAKE) -s -C courier-imap-$(courier_version) DESTDIR=$(DESTDIR); fi
+	if [ -d fetchmail-$(fetchmail_version) ]  ; then $(MAKE) -s -C fetchmail-$(fetchmail_version) DESTDIR=$(DESTDIR); fi
+	${rm} -f  $(DESTDIR)$(prefix)/$(libd)/*.la
+	${rm} -f  $(DESTDIR)${prefix}/$(libd)/libcourier-unicode.a
+	${rm} -f  $(DESTDIR)${prefix}/$(libd)/libcourier-unicode.so
+	${rm} -rf $(DESTDIR)${shareddir}/aclocal
+	${rm} -rf $(DESTDIR)${prefix}/include
+	${rm} -rf $(DESTDIR)${mandir}/man3
+	( \
+	echo NAME=indimail-access; \
+	echo Description=\"IndiMail Authentication Package\"; \
+	echo ACCESS_version=$(version)-$(release); \
+	echo ID=indimail-access; \
+	echo HOME_URL="https://github.com/mbhangui/indimail-virtualdomains"; \
+	echo PACKAGE_BUGREPORT=\"'Manvendra Bhangui <indimail-access@indimail.org>'\"; \
+	) > indimail-access-release
+	if [ -f postinst -a -d /usr/src/packages/SOURCES.DEB ] ; then echo setting "build_on_obs=1"; sed -i 's{build_on_obs=.*{build_on_obs=1{' postinst; fi
+	touch build-stamp
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_prep || dh_clean -k
+	dh_installdirs
+	if [ -d courier-imap-$(courier_version) ] ; then $(MAKE) -s install -C courier-imap-$(courier_version) DESTDIR=$(DESTDIR); fi
+	if [ -d fetchmail-$(fetchmail_version) ]  ; then $(MAKE) -s install -C fetchmail-$(fetchmail_version) DESTDIR=$(DESTDIR); fi
+	mkdir -p $(DESTDIR)$(sysconfdir)
+	if [ -f perm_list.imap ] ; then \
+		install -m 0644 perm_list.imap "$(DESTDIR)$(sysconfdir)"/perm_list.imap; \
+	fi
+	install -m 0644 indimail-access-release "$(DESTDIR)$(sysconfdir)"/indimail-access-release
+	/bin/rm -f indimail-access-release
+
+clean:
+	if [ -d courier-imap-$(courier_version) ] ; then $(MAKE) -s clean -C courier-imap-$(courier_version) DESTDIR=$(DESTDIR) || true; fi
+	if [ -d fetchmail-$(fetchmail_version) ]  ; then $(MAKE) -s clean -C fetchmail-$(fetchmail_version) DESTDIR=$(DESTDIR) || true; fi
+	if [ -d courier-imap-$(courier_version) ] ; then $(MAKE) -s distclean -C courier-imap-$(courier_version) DESTDIR=$(DESTDIR) || true; fi
+	if [ -d fetchmail-$(fetchmail_version) ]  ; then $(MAKE) -s distclean -C fetchmail-$(fetchmail_version) DESTDIR=$(DESTDIR) || true; fi
+	${rm} -f build-stamp configure-stamp
+	${rm} -rf $(DESTDIR)
+	dh_testdir
+	dh_testroot
+	dh_clean
+	dh_auto_clean
+
+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-access.install
+	# do chmod because debian is a fckued packaging system
+	chmod 755 $(DESTDIR)${libexecdir}/imapmodules/authshadow $(DESTDIR)${libexecdir}/imapmodules/authpam
+	dh_install --sourcedir=$(DESTDIR) -pindimail-access
+	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
