Subject: [alpine-aports] [PATCH] main/dovecot: split some plugins to subpackages

From: Valery Kartel <[email-masked]>
Date: Thu, 10 Dec 2015 01:44:14 +0200

-acl: plugin for acl-s with related configs
-quota: quota plugin with related configs
-trash: trash for quota plugin with related configs. has dovecot-quota as dependency
-stats: Statistics plugin with related configs
-zlib: maildir compression plugin with related configs

-expire: message expire plugin with no configs
-snarf: move mails from a "snarf mailbox" to user's real INBOX plugin with no configs
-listescape: Listescape plugin with no configs
-mail-filter: mail filter plugin with no configs
-fts: full text search plugin with no configs
---
 main/dovecot/APKBUILD               | 110 ++++++++++++++++++++++++++++++++++--
 main/dovecot/dovecot-trash.conf.ext |   8 +++
 main/dovecot/dovecot.initd          |   3 +-
 main/dovecot/plugin-stats.conf      |   6 ++
 main/dovecot/plugin-trash.conf      |   3 +
 main/dovecot/plugin-zlib.conf       |   5 ++
 main/dovecot/service-stats.conf     |  10 ++++
 7 files changed, 139 insertions(+), 6 deletions(-)
 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 16356b2..79ec38a 100644
--- a/main/dovecot/APKBUILD
+++ b/main/dovecot/APKBUILD
@@ -17,12 +17,20 @@ makedepends="libcap-dev zlib-dev openssl-dev bzip2-dev postgresql-dev
 install="dovecot.pre-install dovecot.post-install"
 subpackages="$pkgname-doc $pkgname-dev
 	$pkgname-sql $pkgname-pgsql $pkgname-mysql $pkgname-sqlite
-	$pkgname-gssapi $pkgname-ldap
+	$pkgname-gssapi $pkgname-ldap $pkgname-acl $pkgname-quota
+	$pkgname-trash $pkgname-zlib $pkgname-stats $pkgname-expire
+	$pkgname-mail-filter:filter $pkgname-listescape $pkgname-snarf
+	$pkgname-fts"
 	"
 source="http://www.dovecot.org/releases/${pkgver%.*}/$pkgname-$pkgver.tar.gz
 	hide-dl-errors.patch
 	dovecot.logrotate
 	dovecot.initd
+	dovecot-trash.conf.ext
+	plugin-trash.conf
+	plugin-stats.conf
+	plugin-zlib.conf
+	service-stats.conf
 	"
 options="libtool"
 
@@ -143,15 +151,109 @@ 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
+	echo "* owner lrwstipekxa" > "$subpkgdir"/etc/dovecot/dovecot-acl
+}
+
+quota() {
+	pkgdesc="Quota plugin for dovecot"
+	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-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
+}
+
+expire() {
+	pkgdesc="Expire plugin for dovecot"
+	depends="$pkgname"
+	_mv $(cd "$pkgdir" && find usr -name '*_expire_*')
+}
+
+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_*')
+}
+
+snarf() {
+	pkgdesc="Snarf plugin for dovecot"
+	depends="$pkgname"
+	_mv $(cd "$pkgdir" && find usr -name '*_snarf_*')
+}
+
+fts() {
+	pkgdesc="Full Text Search plugin for dovecot"
+	depends="$pkgname"
+	_mv $(cd "$pkgdir" && find usr -name '*_fts_*')
+	mv "$pkgdir"/usr/share "$subpkgdir"/usr/
+}
+
 md5sums="2dbeff4385eff699caa6f6b81b838d0f  dovecot-2.2.20.tar.gz
 49f7a03284cc657857fe2ae22b8c82a0  hide-dl-errors.patch
 1a88280b65efb6cb7f70bc5a88bf264c  dovecot.logrotate
-ddd77573827e0662be21303fb795eef3  dovecot.initd"
+852b04a215e953cb63fbb31f349382ed  dovecot.initd
+6533f76539436962fa0f8ea8a3ae869b  dovecot-trash.conf.ext
+6846b9a11fcde217de8c719a4f9c4d14  plugin-trash.conf
+c01c4f5f1b0b5068fe068450b3376f19  plugin-stats.conf
+16a11292f8084a3ee89a75680d8048e8  plugin-zlib.conf
+edca278638ed6381dfbd5bb7acb9f261  service-stats.conf"
 sha256sums="9d8fd10bfc0d4d78c38b55bab7d88398bd785ce401fcf2e7c2ffb9eae0152dcd  dovecot-2.2.20.tar.gz
 d6accdd6e271647c01ab8fa0a9491ee822486484961e2d5c252bf70e816d2bfa  hide-dl-errors.patch
 2ac04bb7b5c503cd87ba044482e651dbe5c9d84a4268891fb2aa9ba26e62f833  dovecot.logrotate
-3f74548051297cedc7f8d203f1d1d9dc904fe89004b54b52921d2050520daa6f  dovecot.initd"
+63250f9dea928603d5b09dd164c5e5b42f5ee182bdc3d5a827bea188df4e3819  dovecot.initd
+42aad2169f548b6edb87482fd1ab75d934cf4335d6b7bf1cb0d26fa408996141  dovecot-trash.conf.ext
+a5cc2195aa036e78fc5f1ee5294273dd49d3dba705b0eb609b1c570f490cd651  plugin-trash.conf
+dbebd296437f0b695ae46b70c9cc44f3c9455a0876b9e449b4f0a0e65b34c07d  plugin-stats.conf
+7a3ce37383cb4d708795b331865b0f527837f48bb73a2ef05f486e3cd8c40f6d  plugin-zlib.conf
+415a1227719401ea6c33685619d729985bbd945c5e242deae4060759f4aa8cd8  service-stats.conf"
 sha512sums="ceb028d2481865d27eaeea82e8e16948b34437a4fd39ca64f762772d2cda42876f0eb4b69bd69f1307bff71817340a902a0e7ca89dfcab7b9f802b32be3ef1e8  dovecot-2.2.20.tar.gz
 1e9a1f2990019236546c7be581a4d6d0b430110d27a00bc3298f5c154ef9a4aadefa193d02a017912f826d771058fd5c6ef6cb454e14f0d15749fa8f3a68c64a  hide-dl-errors.patch
 58756fa06a063777ef7c4d1e67b63adbde5462264e14bd7a3187a318f498fff21ac2a8d53bb216f56fef4588206e14112da79542b6dfdf503988786f27bb6544  dovecot.logrotate
-d7f67991e11979da91162eb64a0b924655d0ac155d97bcc42a40c758003d60b7c096945544e6b321aa8ecb3416fe17b14b5898f1dba5e5a4b3e4c9c21295c8cb  dovecot.initd"
+8e7867b4bff7b82de7c519a3152aa1c96c1d10e66a5035b23b6a8da46348588163ab3256f8846ec0c1766fb36426ab2af275ab184e3d0a032543b55b596905a2  dovecot.initd
+dbd267fbeda52a60b5c30a60bca067e4e2f6ca8800a7d6b8e65f59fc06c9efaa47976d9ca3852606184124aa3cbc8c78a7f72a61c2350544b48e4efecad3d3e8  dovecot-trash.conf.ext
+f99287b15a4c72658c367533290fcd0d246715d6e160710ce483b9865a523fd76ba4350fd03f868eca29a9442ddf9f041b1660c47db17c8e3fae933a882f8dc3  plugin-trash.conf
+959e47cc28d072dfd6bddbe48b28b3f443a69dd0a09b4bf6267d97694fd8d18d8133eaf25c6bf23eec0759030ac9eca97c85d1eba29f833b7d15ea4c1c23df0a  plugin-stats.conf
+fe7875c1198179e09ff2008f993762af4fba8ba4237c278fa4a55b2e9782507276afb70d4ee4dcd60495266880ff3b9111ff8f45b0f05912f4a1b16e845c6a79  plugin-zlib.conf
+1f756643b8de394113e165dbb43f6b9d1de37c30fc86a679af6abd490d6ebeb0641086dca6ad9d7d6e73f04c536e9326175f3ff1e36ac8c2f646233e3a5cd4af  service-stats.conf"
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 880a39f..ca6852f 100644
--- a/main/dovecot/dovecot.initd
+++ b/main/dovecot/dovecot.initd
@@ -31,8 +31,7 @@ checkconfig() {
 	fi
 	DOVECOT_BASEDIR=${DOVECOT_BASEDIR:-/run/dovecot}
 	DOVECOT_PIDFILE=${DOVECOT_BASEDIR}/master.pid
-	checkpath --directory --owner dovecot:dovecot --mode 0755 \
-		${DOVECOT_BASEDIR}
+	checkpath --directory ${DOVECOT_BASEDIR}
 }
 
 start() {
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..f0cfcd0
--- /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]
---