Subject: [alpine-aports] [PATCH] main/dovecot: Bugfix upgrade to 2.2.21. Libtool *.la files moved to -dev subpackage. New init-script with legacy instances support.

From: Valery Kartel <[email-masked]>
Date: Wed, 23 Dec 2015 16:26:52 +0200

In init-script I remade setting-up a config file.
 - if $DOVECOT_CONF is defined - we use it as a config file name
 - if don't - set cfgfile name to ${SVCNAME}.conf and if it doesn't exists, drop to default /etc/dovecot/dovecot.conf
---
 main/dovecot/APKBUILD      | 17 ++++++++-------
 main/dovecot/dovecot.initd | 54 ++++++++++++++--------------------------------
 2 files changed, 25 insertions(+), 46 deletions(-)

diff --git a/main/dovecot/APKBUILD b/main/dovecot/APKBUILD
index 16356b2..4c2ed5b 100644
--- a/main/dovecot/APKBUILD
+++ b/main/dovecot/APKBUILD
@@ -3,8 +3,8 @@
 # Contributor: Michael Mason <[email-masked]>
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=dovecot
-pkgver=2.2.20
-pkgrel=1
+pkgver=2.2.21
+pkgrel=0
 pkgdesc="IMAP and POP3 server"
 url="http://www.dovecot.org/"
 arch="all"
@@ -103,6 +103,7 @@ dev() {
 	default_dev
 	mv "$pkgdir"/usr/lib/dovecot/dovecot-config \
 		"$subpkgdir"/usr/lib/dovecot/
+	_mv $(cd "$pkgdir" && find usr -name '*.la')
 }
 
 pgsql() {
@@ -143,15 +144,15 @@ sql() {
 	_mv $(cd "$pkgdir" && find etc/dovecot -name '*-sql.conf*')
 }
 
-md5sums="2dbeff4385eff699caa6f6b81b838d0f  dovecot-2.2.20.tar.gz
+md5sums="28c39ab78a20f00701c26960d9190cf0  dovecot-2.2.21.tar.gz
 49f7a03284cc657857fe2ae22b8c82a0  hide-dl-errors.patch
 1a88280b65efb6cb7f70bc5a88bf264c  dovecot.logrotate
-ddd77573827e0662be21303fb795eef3  dovecot.initd"
-sha256sums="9d8fd10bfc0d4d78c38b55bab7d88398bd785ce401fcf2e7c2ffb9eae0152dcd  dovecot-2.2.20.tar.gz
+db58b9b3185ce6abb9b8e1c9e19de128  dovecot.initd"
+sha256sums="7ab7139e59e1f0353bf9c24251f13c893cf1a6ef4bcc47e2d44de437108d0b20  dovecot-2.2.21.tar.gz
 d6accdd6e271647c01ab8fa0a9491ee822486484961e2d5c252bf70e816d2bfa  hide-dl-errors.patch
 2ac04bb7b5c503cd87ba044482e651dbe5c9d84a4268891fb2aa9ba26e62f833  dovecot.logrotate
-3f74548051297cedc7f8d203f1d1d9dc904fe89004b54b52921d2050520daa6f  dovecot.initd"
-sha512sums="ceb028d2481865d27eaeea82e8e16948b34437a4fd39ca64f762772d2cda42876f0eb4b69bd69f1307bff71817340a902a0e7ca89dfcab7b9f802b32be3ef1e8  dovecot-2.2.20.tar.gz
+33358b640e0b28f385a088f7225450e921e57f280067757c96f4d500733a509e  dovecot.initd"
+sha512sums="0d246d44e0c908ea40d324982fb279b19424ddcb642e51796078f600fc5bf530898d2fa387fcfd971d43758cff22590e5ea6918c31e9f4a63f13a8c525a23d9b  dovecot-2.2.21.tar.gz
 1e9a1f2990019236546c7be581a4d6d0b430110d27a00bc3298f5c154ef9a4aadefa193d02a017912f826d771058fd5c6ef6cb454e14f0d15749fa8f3a68c64a  hide-dl-errors.patch
 58756fa06a063777ef7c4d1e67b63adbde5462264e14bd7a3187a318f498fff21ac2a8d53bb216f56fef4588206e14112da79542b6dfdf503988786f27bb6544  dovecot.logrotate
-d7f67991e11979da91162eb64a0b924655d0ac155d97bcc42a40c758003d60b7c096945544e6b321aa8ecb3416fe17b14b5898f1dba5e5a4b3e4c9c21295c8cb  dovecot.initd"
+1c8c832b4abbf7031e805eac73aa2f9b19290857487934c53832fccf8d6fce6e8167e90d504485e22024d2a90b2cd81ef5c07768970747b8f414703e74427242  dovecot.initd"
diff --git a/main/dovecot/dovecot.initd b/main/dovecot/dovecot.initd
index 880a39f..93eee01 100644
--- a/main/dovecot/dovecot.initd
+++ b/main/dovecot/dovecot.initd
@@ -1,9 +1,17 @@
 #!/sbin/openrc-run
 
 description="Secure POP3/IMAP server"
-description_reload="Reload configuration"
-
+if [ "$DOVECOT_CONF" ]; then
+	cfgfile=$DOVECOT_CONF
+else
+	cfgfile=/etc/dovecot/${SVCNAME}.conf
+	[ -f $cfgfile ] || cfgfile=/etc/dovecot/dovecot.conf
+fi
+pidfile=$(/usr/bin/doveconf -c $cfgfile -h base_dir 2>/dev/null)/master.pid
+command=/usr/sbin/dovecot
+required_files="$cfgfile"
 extra_started_commands="reload"
+description_reload="Reload configuration"
 
 depend() {
 	need localmount net
@@ -12,46 +20,16 @@ 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:-/run/dovecot}
-	DOVECOT_PIDFILE=${DOVECOT_BASEDIR}/master.pid
-	checkpath --directory --owner dovecot:dovecot --mode 0755 \
-		${DOVECOT_BASEDIR}
-}
-
-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}"
+start_pre() {
+	ebegin
+	[ "$cfgfile" = "/etc/dovecot/dovecot.conf" ] || command_args="-c $cfgfile"
+	checkpath --directory ${pidfile%/*}
+	$command $command_args -a > /dev/null
 	eend $?
 }
 
 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}"
+	start_pre && start-stop-daemon --signal HUP --exec $command --pidfile $pidfile
 	eend $?
 }
-- 
2.6.4

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