Subject: [alpine-aports] [PATCH] main/dovecot: many plugins are moved to subpackages, sample-config moved to main package, init script cleanups

From: Valery Kartel <[email-masked]>
Date: Fri, 4 Dec 2015 17:51:54 +0200

:: dovecot.pre_install: newly created users has a fixed uid-s.

:: dovecot.initd: made it much simplier then copy-pasted gentoo-one

:: sample-config (/etc/dovecot/conf.d) moved to main package
	because it's used by main /etc/dovecot/dovecot.conf

:: dovecot-sample-config and corresponding
	dovecot-sample-config.post-install script are removed

:: new subpkg dovecot-sql: main SQL plugin with related configs.
	marked as dependency for pgsql,mysql,sqlite drivers

:: new subpkg dovecot-acl: plugin for acl-s with related configs.

:: new subpkg dovecot-quota: quota plugin with related configs.

:: new subpkg dovecot-trash: trash for quota plugin with related configs.
	has dovecot-quota as dependency.

:: new subpkg dovecot-stats: Statistics plugin with related configs (used rarely).

:: new subpkg dovecot-zlib: maildir compression plugin with related configs (used rarely).

:: new subpkg dovecot-expire: message expire plugin with no configs (used rarely).

:: new subpkg dovecot-snarf: move mails from a "snarf mailbox" to user's real INBOX plugin with no configs (used rarely).

:: new subpkg dovecot-listescape: Listescape plugin with no configs (used rarely).

:: new subpkg dovecot-mail-filter: mail filter plugin with no configs (used rarely).

:: new subpkg dovecot-fts: full text search plugin with no configs (used rarely).
---
 main/dovecot/APKBUILD                           | 216 ++++++++++++++++++------
 main/dovecot/dovecot-sample-config.post-install |  10 --
 main/dovecot/dovecot-trash.conf.ext             |   8 +
 main/dovecot/dovecot.initd                      |  46 +----
 main/dovecot/dovecot.pre-install                |   4 +-
 main/dovecot/plugin-stats.conf                  |   6 +
 main/dovecot/plugin-trash.conf                  |   3 +
 main/dovecot/plugin-zlib.conf                   |   5 +
 main/dovecot/service-stats.conf                 |  10 ++
 9 files changed, 206 insertions(+), 102 deletions(-)
 delete mode 100644 main/dovecot/dovecot-sample-config.post-install
 create mode 100644 main/dovecot/dovecot-trash.conf.ext
 create mode 100644 main/dovecot/plugin-stats.conf
 create mode 100644 main/dovecot/plugin-trash.conf
 create mode 100644 main/dovecot/plugin-zlib.conf
 create mode 100644 main/dovecot/service-stats.conf

diff --git a/main/dovecot/APKBUILD b/main/dovecot/APKBUILD
index 32bac66..3c4be19 100644
--- a/main/dovecot/APKBUILD
+++ b/main/dovecot/APKBUILD
@@ -1,9 +1,10 @@
+# Contributor: Valery Kartel <[email-masked]>
 # Contributor: Łukasz Jendrysik <[email-masked]>
 # Contributor: Michael Mason <[email-masked]>
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=dovecot
 pkgver=2.2.19
-pkgrel=2
+pkgrel=3
 pkgdesc="IMAP and POP3 server"
 url="http://www.dovecot.org/"
 arch="all"
@@ -14,31 +15,37 @@ pkggroups="dovecot dovenull"
 makedepends="libcap-dev zlib-dev openssl-dev bzip2-dev postgresql-dev
 	mariadb-dev sqlite-dev heimdal-dev openldap-dev linux-headers"
 install="dovecot.pre-install dovecot.post-install"
-subpackages="$pkgname-sample-config:config $pkgname-doc $pkgname-dev
-	$pkgname-pgsql $pkgname-mysql $pkgname-sqlite $pkgname-gssapi
-	$pkgname-ldap"
-patches="
-	hide-dl-errors.patch
-	"
+subpackages="$pkgname-doc $pkgname-dev
+	$pkgname-sql $pkgname-pgsql $pkgname-mysql $pkgname-sqlite
+	$pkgname-gssapi $pkgname-ldap $pkgname-acl $pkgname-expire
+	$pkgname-snarf $pkgname-listescape $pkgname-quota $pkgname-trash
+	$pkgname-mail-filter:filter $pkgname-stats $pkgname-zlib $pkgname-fts"
 source="http://www.dovecot.org/releases/${pkgver%.*}/$pkgname-$pkgver.tar.gz
-	$patches
+	service-stats.conf
+	plugin-stats.conf
+	plugin-zlib.conf
+	plugin-trash.conf
+	dovecot-trash.conf.ext
+	hide-dl-errors.patch
 	dovecot.logrotate
 	dovecot.initd
-	dovecot-sample-config.post-install
 	"
 options="libtool"
 
+_builddir="$srcdir"/$pkgname-$pkgver
+
 prepare() {
-	cd "$srcdir"/$pkgname-$pkgver
-	for i in $patches; do
-		msg $i
-		patch -p1 -i "$srcdir"/$i || return 1
+	local i
+	cd "$_builddir"
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
 	done
 }
 
 build() {
-	cd "$srcdir/$pkgname-$pkgver"
-
+	cd "$_builddir"
 	./configure \
 		--build=$CBUILD \
 		--host=$CHOST \
@@ -54,35 +61,38 @@ build() {
 		--with-sqlite \
 		--with-pgsql \
 		--with-ssl=openssl \
+		--with-ssldir=/etc/ssl/$pkgname \
+		--with-rundir=/run/$pkgname \
 		|| return 1
-
 	make || return 1
 }
 
 package() {
-	cd "$srcdir/$pkgname-$pkgver"
+	cd "$_builddir"
 	make DESTDIR="$pkgdir" install || return 1
 
-	install -d "$pkgdir"/var/run/dovecot \
-		"$pkgdir"/etc/ssl/dovecot
-	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
-	install -D "$srcdir"/dovecot.logrotate "$pkgdir"/etc/logrotate.d/dovecot
+	install -d "$pkgdir"/etc/ssl/dovecot
+	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+	install -Dm644 "$srcdir"/$pkgname.logrotate "$pkgdir"/etc/logrotate.d/$pkgname
 
 	# default config
-	install doc/dovecot-openssl.cnf "$pkgdir"/etc/dovecot/
-	cp "$pkgdir"/usr/share/doc/dovecot/example-config/dovecot.conf \
-		"$pkgdir"/etc/dovecot/dovecot.conf || return 1
-	mkdir -p "$pkgdir"/etc/dovecot/conf.d
+	rm "$pkgdir"/etc/dovecot/*
+	install -Dm644 doc/dovecot-openssl.cnf "$pkgdir"/etc/dovecot/dovecot-openssl.cnf
+	mv "$pkgdir"/usr/share/doc/dovecot/example-config/dovecot* \
+		"$pkgdir"/usr/share/doc/dovecot/example-config/conf.d \
+		"$pkgdir"/etc/dovecot/ || return 1
+	rm -fr "$pkgdir"/usr/share/doc/dovecot/example-config
 
 	# fix ssl dirs in default config and set defautl passdb to passwd
 	sed -i -e 's,^ssl_cert =.*,ssl_cert = </etc/ssl/dovecot/server.pem,' \
 		-e 's,^ssl_key =.*,ssl_key = </etc/ssl/dovecot/server.key,' \
-		"$pkgdir"/usr/share/doc/dovecot/example-config/conf.d/10-ssl.conf\
-		|| return 1
+		"$pkgdir"/etc/dovecot/conf.d/10-ssl.conf || return 1
+}
 
-	# install ssl config by default
-	cp "$pkgdir"/usr/share/doc/dovecot/example-config/conf.d/10-ssl.conf\
-		"$pkgdir"/etc/dovecot/conf.d/ || return 1
+dev() {
+	default_dev
+	mv "$pkgdir"/usr/lib/$pkgname/$pkgname-config \
+		"$subpkgdir"/usr/lib/$pkgname/
 }
 
 _mv() {
@@ -90,56 +100,158 @@ _mv() {
 	while [ $# -gt 0 ]; do
 		local dir=${1%/*}
 		mkdir -p "$subpkgdir"/$dir
-		mv "$pkgdir/$1" "$subpkgdir/$dir/"
+		mv "$pkgdir"/$1 "$subpkgdir"/$dir/
 		shift
 	done
 }
 
-
 pgsql() {
-	pkgdesc="postgresql driver for dovecot"
-	_mv $(cd "$pkgdir" && find usr -name '*pgsql.so')
+	pkgdesc="postgresql sql driver for dovecot"
+	depends="$pkgname-sql"
+	_mv $(cd "$pkgdir" && find usr -name '*_pgsql*')
 }
 
 mysql() {
-	pkgdesc="mysql driver for dovecot"
-	_mv $(cd "$pkgdir" && find usr -name '*mysql.so')
+	pkgdesc="mysql sql driver for dovecot"
+	depends="$pkgname-sql"
+	_mv $(cd "$pkgdir" && find usr -name '*_mysql*')
 }
 
 sqlite() {
-	pkgdesc="sqlite driver for dovecot"
-	_mv $(cd "$pkgdir" && find usr -name '*sqlite.so')
+	pkgdesc="sqlite sql driver for dovecot"
+	depends="$pkgname-sql"
+	_mv $(cd "$pkgdir" && find usr -name '*_sqlite*')
 }
 
 gssapi() {
 	pkgdesc="GSSAPI auth plugin for dovecot"
-	_mv $(cd "$pkgdir" && find usr -name '*gssapi.so')
+	depends="$pkgname"
+	_mv $(cd "$pkgdir" && find usr -name '*_gssapi*')
 }
 
 ldap() {
-	pkgdesc="LDAP plugin for dovecot"
-	_mv $(cd "$pkgdir" && find usr -name '*ldap.so')
+	pkgdesc="LDAP auth plugin for dovecot"
+	depends="$pkgname"
+	_mv $(cd "$pkgdir" && find usr -name '*_ldap*')
+	_mv $(cd "$pkgdir" && find etc/dovecot -name '*-ldap.conf*')
+}
+
+sql() {
+	pkgdesc="SQL plugin for dovecot"
+	depends="$pkgname"
+	_mv $(cd "$pkgdir" && find usr -name '*-sql.*')
+	_mv $(cd "$pkgdir" && find etc/dovecot -name '*-sql.conf*')
+}
+
+acl() {
+	pkgdesc="ACL plugin for dovecot"
+	depends="$pkgname"
+	_mv $(cd "$pkgdir" && find usr -name '*_acl_*')
+	install -d "$subpkgdir"/etc/dovecot/conf.d
+	sed 's/global-acls/dovecot-acl/' \
+		"$pkgdir"/etc/dovecot/conf.d/90-acl.conf > \
+		"$subpkgdir"/etc/dovecot/conf.d/90-acl.conf
+	rm "$pkgdir"/etc/dovecot/conf.d/90-acl.conf
+	touch "$subpkgdir"/etc/dovecot/dovecot-acl
+}
+
+expire() {
+	pkgdesc="Expire plugin for dovecot"
+	depends="$pkgname"
+	_mv $(cd "$pkgdir" && find usr -name '*_expire_*')
 }
 
-config() {
-	pkgdesc="Sample configuration files for dovecot"
-	install="dovecot-sample-config.post-install"
-	_mv usr/share/doc/dovecot/example-config
-	mkdir -p "$subpkgdir"/etc/dovecot/conf.d
+filter() {
+	pkgdesc="Mail Filter plugin for dovecot"
+	depends="$pkgname"
+	_mv $(cd "$pkgdir" && find usr -name '*_mail_filter_*')
+}
+
+listescape() {
+	pkgdesc="Listescape plugin for dovecot"
+	depends="$pkgname"
+	_mv $(cd "$pkgdir" && find usr -name '*_listescape_*')
+}
+
+quota() {
+	pkgdesc="Quota plugin for dovecot"
+	depends="$pkgname"
+	#depends="$pkgname
+	_mv $(cd "$pkgdir" && find usr -name '*_quota_*')
+	_mv $(cd "$pkgdir" && find etc/dovecot -name '*-quota.conf*')
+}
+
+trash() {
+	pkgdesc="Trash quota plugin for dovecot"
+	depends="$pkgname $pkgname-quota"
+	_mv $(cd "$pkgdir" && find usr -name '*_trash_*')
+	install -Dm644 "$srcdir"/dovecot-trash.conf.ext \
+		"$subpkgdir"/etc/dovecot/dovecot-trash.conf.ext
+	install -Dm644 "$srcdir"/plugin-trash.conf \
+		"$subpkgdir"/etc/dovecot/conf.d/90-trash.conf
+}
+
+zlib() {
+	pkgdesc="Zlib plugin for dovecot"
+	depends="$pkgname"
+	_mv $(cd "$pkgdir" && find usr -name '*_zlib_*')
+	install -Dm644 "$srcdir"/plugin-zlib.conf \
+		"$subpkgdir"/etc/dovecot/conf.d/90-zlib.conf
+}
+
+stats() {
+	pkgdesc="Statistics plugin for dovecot"
+	depends="$pkgname"
+	_mv $(cd "$pkgdir" && find usr -name '*_stats_*')
+	mv "$pkgdir"/usr/lib/dovecot/stats "$subpkgdir"/usr/lib/dovecot/
+	install -Dm644 "$srcdir"/service-stats.conf \
+		"$subpkgdir"/etc/dovecot/conf.d/10-stats.conf
+	install -Dm644 "$srcdir"/plugin-stats.conf \
+		"$subpkgdir"/etc/dovecot/conf.d/90-stats.conf
+}
+
+snarf() {
+	pkgdesc="Snarf plugin for dovecot"
+	depends="$pkgname"
+	_mv $(cd "$pkgdir" && find usr -name '*_snarf_*')
+}
+
+# this subpackage must be the last in build list.
+# It removes all unneded (empty) folders.
+fts() {
+	pkgdesc="Full Text Search plugin for dovecot"
+	depends="$pkgname"
+	_mv $(cd "$pkgdir" && find usr -name '*_fts_*')
+
+	mv "$pkgdir"/usr/share "$subpkgdir"/usr/
+	rmdir "$pkgdir"/usr/lib/dovecot/dict || return 1
+	rmdir "$pkgdir"/usr/lib/dovecot/doveadm || return 1
 }
 
 md5sums="95591b6556413edc2f0b160fb469d04c  dovecot-2.2.19.tar.gz
+edca278638ed6381dfbd5bb7acb9f261  service-stats.conf
+c01c4f5f1b0b5068fe068450b3376f19  plugin-stats.conf
+132f3354137ca2bf475756173f8b6f3b  plugin-zlib.conf
+6846b9a11fcde217de8c719a4f9c4d14  plugin-trash.conf
+6533f76539436962fa0f8ea8a3ae869b  dovecot-trash.conf.ext
 49f7a03284cc657857fe2ae22b8c82a0  hide-dl-errors.patch
 1a88280b65efb6cb7f70bc5a88bf264c  dovecot.logrotate
-f730fd2f5e94cdb8ce0ff4df54ebb49b  dovecot.initd
-95cf57ecc835882228bbbb019ce3abf8  dovecot-sample-config.post-install"
+881f4078b1e6a6ae70419e30ae153d8b  dovecot.initd"
 sha256sums="759e1e3f9d907cdaabad1f5fbacc793ca191d234c084bec3bba42966952a4e9f  dovecot-2.2.19.tar.gz
+415a1227719401ea6c33685619d729985bbd945c5e242deae4060759f4aa8cd8  service-stats.conf
+dbebd296437f0b695ae46b70c9cc44f3c9455a0876b9e449b4f0a0e65b34c07d  plugin-stats.conf
+8761a34d926d38309e9e94badf7957cce47ac5e7271ede2eec6cfdc10bf5c77f  plugin-zlib.conf
+a5cc2195aa036e78fc5f1ee5294273dd49d3dba705b0eb609b1c570f490cd651  plugin-trash.conf
+42aad2169f548b6edb87482fd1ab75d934cf4335d6b7bf1cb0d26fa408996141  dovecot-trash.conf.ext
 d6accdd6e271647c01ab8fa0a9491ee822486484961e2d5c252bf70e816d2bfa  hide-dl-errors.patch
 2ac04bb7b5c503cd87ba044482e651dbe5c9d84a4268891fb2aa9ba26e62f833  dovecot.logrotate
-6cad7099764c04b6ed1a1c4fbc308d66657ad31db627dd058cbbde4e883ccc00  dovecot.initd
-7dab0591eca7fe1473ae7b39ed9ae0d7d51617ffea01252ace5c3aa68150693f  dovecot-sample-config.post-install"
+8071820a57d56616d344dbf7a67db0308b83e062b7da53fe5069c7662b4f00c7  dovecot.initd"
 sha512sums="1b9d605a6a5862ade9d1ca634a9e0171b7c212ab025fc2059051c3795470685b66516fa9fbe5ad91d84388268ea15795f2dcd70ffdf81736ce4d80fd284835e9  dovecot-2.2.19.tar.gz
+1f756643b8de394113e165dbb43f6b9d1de37c30fc86a679af6abd490d6ebeb0641086dca6ad9d7d6e73f04c536e9326175f3ff1e36ac8c2f646233e3a5cd4af  service-stats.conf
+959e47cc28d072dfd6bddbe48b28b3f443a69dd0a09b4bf6267d97694fd8d18d8133eaf25c6bf23eec0759030ac9eca97c85d1eba29f833b7d15ea4c1c23df0a  plugin-stats.conf
+14f95c0ef6043e7da70be0d339fa7a8e932a4cc12ddda94f3a8588d8a1d5177f68491f588e7d69a109f67abcfc3ae0c863b20cf887ef70f76be07c1fb2a7b7cf  plugin-zlib.conf
+f99287b15a4c72658c367533290fcd0d246715d6e160710ce483b9865a523fd76ba4350fd03f868eca29a9442ddf9f041b1660c47db17c8e3fae933a882f8dc3  plugin-trash.conf
+dbd267fbeda52a60b5c30a60bca067e4e2f6ca8800a7d6b8e65f59fc06c9efaa47976d9ca3852606184124aa3cbc8c78a7f72a61c2350544b48e4efecad3d3e8  dovecot-trash.conf.ext
 1e9a1f2990019236546c7be581a4d6d0b430110d27a00bc3298f5c154ef9a4aadefa193d02a017912f826d771058fd5c6ef6cb454e14f0d15749fa8f3a68c64a  hide-dl-errors.patch
 58756fa06a063777ef7c4d1e67b63adbde5462264e14bd7a3187a318f498fff21ac2a8d53bb216f56fef4588206e14112da79542b6dfdf503988786f27bb6544  dovecot.logrotate
-f3f0dfce9713ee9fcb8e07f8b8f7f2c88906adee1a97e5272346c77ff7fc1099c7340c75271ba08972d32fb45b92a9272dec68d3fbbee8ee76eb0ea9c5630c10  dovecot.initd
-c5665334b0664ae29f52c022a8ffc2e520cfc506e399d2e614464dd5770caade794eeaf3406fe8ded1d927b06672d0597e2fe53d32fbfaf9f4cf025bce792a5b  dovecot-sample-config.post-install"
+c6f19f287b6333e2fa81b0d25be4ccc15d30cb58afd760bb20c40d12504c6667937a85cf37466702cd0120e32a06426c213399869d4dc986314a7673b32b6aa0  dovecot.initd"
diff --git a/main/dovecot/dovecot-sample-config.post-install b/main/dovecot/dovecot-sample-config.post-install
deleted file mode 100644
index 7f1a204..0000000
--- a/main/dovecot/dovecot-sample-config.post-install
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-cd /usr/share/doc/dovecot/example-config || exit 0
-
-for i in dovecot.conf conf.d/*; do
-	if ! [ -e /etc/dovecot/$i ]; then
-		cp $i /etc/dovecot/$i
-	fi
-done
-
diff --git a/main/dovecot/dovecot-trash.conf.ext b/main/dovecot/dovecot-trash.conf.ext
new file mode 100644
index 0000000..4689935
--- /dev/null
+++ b/main/dovecot/dovecot-trash.conf.ext
@@ -0,0 +1,8 @@
+# Spam mailbox is emptied before Trash
+1 Spam
+# Trash mailbox is emptied before Sent
+2 Trash
+# If both Sent and "Sent Messages" mailboxes exist, the next oldest message
+# to be deleted is looked up from both of the mailboxes.
+3 Sent
+3 Sent Messages
diff --git a/main/dovecot/dovecot.initd b/main/dovecot/dovecot.initd
index fdfb5a9..e7bff6d 100644
--- a/main/dovecot/dovecot.initd
+++ b/main/dovecot/dovecot.initd
@@ -1,9 +1,11 @@
 #!/sbin/openrc-run
 
 description="Secure POP3/IMAP server"
-description_reload="Reload configuration"
-
+command="/usr/sbin/dovecot"
+pidfile=$(doveconf | grep base_dir | awk '{print $3}')/master.pid
+required_files="/etc/dovecot/dovecot.conf"
 extra_started_commands="reload"
+description_reload="Reload configuration"
 
 depend() {
 	need localmount net
@@ -12,44 +14,12 @@ depend() {
 	use logger
 }
 
-checkconfig() {
-	DOVECOT_INSTANCE=${SVCNAME##*.}
-	if [ -n "${DOVECOT_INSTANCE}" -a "${SVCNAME}" != "dovecot" ]; then
-		DOVECOT_CONF=/etc/dovecot/dovecot.${DOVECOT_INSTANCE}.conf
-	else
-		DOVECOT_CONF=/etc/dovecot/dovecot.conf
-	fi
-	if [ ! -e ${DOVECOT_CONF} ]; then
-		eerror "You will need an ${DOVECOT_CONF} first"
-		return 1
-	fi
-	if [ -x /usr/sbin/dovecot ]; then
-		DOVECOT_BASEDIR=$(/usr/sbin/dovecot -c ${DOVECOT_CONF} -a | grep '^base_dir = ' | sed 's/^base_dir = //')
-	else
-		eerror "dovecot not executable"
-		return 1
-	fi
-	DOVECOT_BASEDIR=${DOVECOT_BASEDIR:-/var/run/dovecot}
-	DOVECOT_PIDFILE=${DOVECOT_BASEDIR}/master.pid
-}
-
-start() {
-	checkconfig || return 1
-	ebegin "Starting ${SVCNAME}"
-	start-stop-daemon --start --exec /usr/sbin/dovecot --pidfile "${DOVECOT_PIDFILE}" -- -c "${DOVECOT_CONF}"
-	eend $?
-}
-
-stop() {
-	checkconfig || return 1
-	ebegin "Stopping ${SVCNAME}"
-	start-stop-daemon --stop --exec /usr/sbin/dovecot --pidfile "${DOVECOT_PIDFILE}"
-	eend $?
+start_pre() {
+	checkpath --directory "${pidfile%/*}"
 }
 
 reload() {
-	checkconfig || return 1
-	ebegin "Reloading ${SVCNAME} configs and restarting auth/login processes"
-	start-stop-daemon --signal HUP --exec /usr/sbin/dovecot --pidfile "${DOVECOT_PIDFILE}"
+	ebegin "Reloading ${SVCNAME}"
+	start-stop-daemon --signal HUP --pidfile ${pidfile} --name ${SVCNAME}
 	eend $?
 }
diff --git a/main/dovecot/dovecot.pre-install b/main/dovecot/dovecot.pre-install
index a1b2d08..432a3b8 100644
--- a/main/dovecot/dovecot.pre-install
+++ b/main/dovecot/dovecot.pre-install
@@ -1,5 +1,5 @@
 #!/bin/sh
 
-adduser -H -h /dev/null -s /sbin/nologin -D dovecot 2>/dev/null
-adduser -H -h /dev/null -s /sbin/nologin -D dovenull 2>/dev/null
+adduser -u 90 -H -h /dev/null -s /sbin/nologin -D dovecot 2>/dev/null
+adduser -u 91 -H -h /dev/null -s /sbin/nologin -D dovenull 2>/dev/null
 exit 0
diff --git a/main/dovecot/plugin-stats.conf b/main/dovecot/plugin-stats.conf
new file mode 100644
index 0000000..23490f2
--- /dev/null
+++ b/main/dovecot/plugin-stats.conf
@@ -0,0 +1,6 @@
+plugin {
+  # how often to session statistics (must be set)
+  stats_refresh = 30 secs
+  # track per-IMAP command statistics (optional)
+  stats_track_cmds = yes
+}
diff --git a/main/dovecot/plugin-trash.conf b/main/dovecot/plugin-trash.conf
new file mode 100644
index 0000000..cb31edf
--- /dev/null
+++ b/main/dovecot/plugin-trash.conf
@@ -0,0 +1,3 @@
+plugin {
+  trash = /etc/dovecot/dovecot-trash.conf.ext
+}
diff --git a/main/dovecot/plugin-zlib.conf b/main/dovecot/plugin-zlib.conf
new file mode 100644
index 0000000..5325da7
--- /dev/null
+++ b/main/dovecot/plugin-zlib.conf
@@ -0,0 +1,5 @@
+# Enable these only if you want compression while saving:
+plugin {
+  #zlib_save_level = 6 # 1..9; default is 6
+  #zlib_save = gz # or bz2, xz or lz4
+}
diff --git a/main/dovecot/service-stats.conf b/main/dovecot/service-stats.conf
new file mode 100644
index 0000000..33b21fb
--- /dev/null
+++ b/main/dovecot/service-stats.conf
@@ -0,0 +1,10 @@
+service stats {
+  fifo_listener stats-mail {
+    user = dovecot
+    mode = 0600
+  }
+#  inet_listener {
+#    address = 127.0.0.1
+#    port = 24242
+#  }
+}
-- 
2.6.3

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---