Mail archive
alpine-aports

[alpine-aports] [PATCH] main/dovecot: upgrade to 2.2.20. fixups in APKBUILD and default configs

From: Valery Kartel <valery.kartel_at_gmail.com>
Date: Wed, 9 Dec 2015 13:52:48 +0200

- sample-configs (conf.d) moved to main package because those are used by dovecot.conf
- dovecot-sample-config subpackage and corresponding dovecot-sample-config.post-install are removed
- configs related to ldap auth moved to dovecot-ldap subpackage
- new subpackage dovecot-sql with sql-related configs
- all sql drivers now depend on dovecot-sql
- init-script: default basedir set to /run/dovecot. added creation of basedir
---
 main/dovecot/APKBUILD                           | 118 +++++++++++++-----------
 main/dovecot/dovecot-sample-config.post-install |  10 --
 main/dovecot/dovecot.initd                      |   2 +-
 main/dovecot/dovecot.pre-install                |   4 +-
 4 files changed, 68 insertions(+), 66 deletions(-)
 delete mode 100644 main/dovecot/dovecot-sample-config.post-install
diff --git a/main/dovecot/APKBUILD b/main/dovecot/APKBUILD
index 32bac66..63bbaee 100644
--- a/main/dovecot/APKBUILD
+++ b/main/dovecot/APKBUILD
_at_@ -1,9 +1,10 @@
+# Contributor: Valery Kartel <valery.kartel_at_gmail.com>
 # Contributor: Ɓukasz Jendrysik <scadu_at_yandex.com>
 # Contributor: Michael Mason <ms13sp_at_gmail.com>
 # Maintainer: Natanael Copa <ncopa_at_alpinelinux.org>
 pkgname=dovecot
-pkgver=2.2.19
-pkgrel=2
+pkgver=2.2.20
+pkgrel=0
 pkgdesc="IMAP and POP3 server"
 url="http://www.dovecot.org/"
 arch="all"
_at_@ -14,31 +15,30 @@ 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
 	"
 source="http://www.dovecot.org/releases/${pkgver%.*}/$pkgname-$pkgver.tar.gz
-	$patches
+	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
+	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 \
_at_@ -54,35 +54,38 @@ build() {
 		--with-sqlite \
 		--with-pgsql \
 		--with-ssl=openssl \
+		--with-ssldir=/etc/ssl/dovecot \
+		--with-rundir=/run/dovecot \
 		|| 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"/dovecot.initd "$pkgdir"/etc/init.d/dovecot
+	install -Dm644 "$srcdir"/dovecot.logrotate "$pkgdir"/etc/logrotate.d/dovecot
 
 	# 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
-
-	# fix ssl dirs in default config and set defautl passdb to passwd
+	rm "$pkgdir"/etc/dovecot/*
+	rm "$pkgdir"/usr/share/doc/dovecot/mkcert.sh
+	mv "$pkgdir"/usr/share/doc/dovecot/dovecot-openssl.cnf "$pkgdir"/etc/dovecot/
+	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
 	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
-
-	# 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
+		"$pkgdir"/etc/dovecot/conf.d/10-ssl.conf || return 1
+	# set default passdb to passwd and create appropriate 'users' file
+	install -m 640 -o dovecot -g mail /dev/null "$pkgdir"/etc/dovecot/users
+	sed -i -e 's,!include auth-system.conf.ext,!include auth-passwdfile.conf.ext,' \
+		-e 's,#!include auth-passwdfile.conf.ext,#!include auth-system.conf.ext,' \
+		"$pkgdir"/etc/dovecot/conf.d/10-auth.conf || return 1
 }
 
 _mv() {
_at_@ -91,55 +94,64 @@ _mv() {
 		local dir=${1%/*}
 		mkdir -p "$subpkgdir"/$dir
 		mv "$pkgdir/$1" "$subpkgdir/$dir/"
+		[ "$(ls -A $pkgdir/$dir)" ] || rmdir "$pkgdir"/$dir
 		shift
 	done
 }
 
+dev() {
+	default_dev
+	mv "$pkgdir"/usr/lib/dovecot/dovecot-config \
+		"$subpkgdir"/usr/lib/dovecot/
+}
 
 pgsql() {
 	pkgdesc="postgresql driver for dovecot"
-	_mv $(cd "$pkgdir" && find usr -name '*pgsql.so')
+	depends="$pkgname-sql"
+	_mv $(cd "$pkgdir" && find usr -name '*_pgsql*')
 }
 
 mysql() {
 	pkgdesc="mysql driver for dovecot"
-	_mv $(cd "$pkgdir" && find usr -name '*mysql.so')
+	depends="$pkgname-sql"
+	_mv $(cd "$pkgdir" && find usr -name '*_mysql*')
 }
 
 sqlite() {
 	pkgdesc="sqlite driver for dovecot"
-	_mv $(cd "$pkgdir" && find usr -name '*sqlite.so')
+	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*')
 }
 
-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
+sql() {
+	pkgdesc="SQL plugin for dovecot"
+	depends="$pkgname"
+	_mv $(cd "$pkgdir" && find usr -name '*-sql.*')
+	_mv $(cd "$pkgdir" && find etc/dovecot -name '*-sql.conf*')
 }
 
-md5sums="95591b6556413edc2f0b160fb469d04c  dovecot-2.2.19.tar.gz
+md5sums="2dbeff4385eff699caa6f6b81b838d0f  dovecot-2.2.20.tar.gz
 49f7a03284cc657857fe2ae22b8c82a0  hide-dl-errors.patch
 1a88280b65efb6cb7f70bc5a88bf264c  dovecot.logrotate
-f730fd2f5e94cdb8ce0ff4df54ebb49b  dovecot.initd
-95cf57ecc835882228bbbb019ce3abf8  dovecot-sample-config.post-install"
-sha256sums="759e1e3f9d907cdaabad1f5fbacc793ca191d234c084bec3bba42966952a4e9f  dovecot-2.2.19.tar.gz
+40df7ea28c8c78480a0504cbdf8b1002  dovecot.initd"
+sha256sums="9d8fd10bfc0d4d78c38b55bab7d88398bd785ce401fcf2e7c2ffb9eae0152dcd  dovecot-2.2.20.tar.gz
 d6accdd6e271647c01ab8fa0a9491ee822486484961e2d5c252bf70e816d2bfa  hide-dl-errors.patch
 2ac04bb7b5c503cd87ba044482e651dbe5c9d84a4268891fb2aa9ba26e62f833  dovecot.logrotate
-6cad7099764c04b6ed1a1c4fbc308d66657ad31db627dd058cbbde4e883ccc00  dovecot.initd
-7dab0591eca7fe1473ae7b39ed9ae0d7d51617ffea01252ace5c3aa68150693f  dovecot-sample-config.post-install"
-sha512sums="1b9d605a6a5862ade9d1ca634a9e0171b7c212ab025fc2059051c3795470685b66516fa9fbe5ad91d84388268ea15795f2dcd70ffdf81736ce4d80fd284835e9  dovecot-2.2.19.tar.gz
+b75112ad728bc843b0060eec9eb53bd028feb783d9336ab8d3d315f1a1344c5f  dovecot.initd"
+sha512sums="ceb028d2481865d27eaeea82e8e16948b34437a4fd39ca64f762772d2cda42876f0eb4b69bd69f1307bff71817340a902a0e7ca89dfcab7b9f802b32be3ef1e8  dovecot-2.2.20.tar.gz
 1e9a1f2990019236546c7be581a4d6d0b430110d27a00bc3298f5c154ef9a4aadefa193d02a017912f826d771058fd5c6ef6cb454e14f0d15749fa8f3a68c64a  hide-dl-errors.patch
 58756fa06a063777ef7c4d1e67b63adbde5462264e14bd7a3187a318f498fff21ac2a8d53bb216f56fef4588206e14112da79542b6dfdf503988786f27bb6544  dovecot.logrotate
-f3f0dfce9713ee9fcb8e07f8b8f7f2c88906adee1a97e5272346c77ff7fc1099c7340c75271ba08972d32fb45b92a9272dec68d3fbbee8ee76eb0ea9c5630c10  dovecot.initd
-c5665334b0664ae29f52c022a8ffc2e520cfc506e399d2e614464dd5770caade794eeaf3406fe8ded1d927b06672d0597e2fe53d32fbfaf9f4cf025bce792a5b  dovecot-sample-config.post-install"
+321e2dfd99bc51150e4d040afae1786d7f1bf47636472dafacce8eeecb6fbaf9311a3c72a0b7ab876d70d2ccdf71fe62eefe674bc97c5013adb77513d2fdbe6c  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
_at_@ -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.initd b/main/dovecot/dovecot.initd
index fdfb5a9..6cc9cb0 100644
--- a/main/dovecot/dovecot.initd
+++ b/main/dovecot/dovecot.initd
_at_@ -29,7 +29,7 @@ checkconfig() {
 		eerror "dovecot not executable"
 		return 1
 	fi
-	DOVECOT_BASEDIR=${DOVECOT_BASEDIR:-/var/run/dovecot}
+	DOVECOT_BASEDIR=${DOVECOT_BASEDIR:-/run/dovecot}
 	DOVECOT_PIDFILE=${DOVECOT_BASEDIR}/master.pid
 }
 
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
_at_@ -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
-- 
2.6.3
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Wed Dec 09 2015 - 13:52:48 GMT