summaryrefslogtreecommitdiffstats
path: root/main/dovecot
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-04-28 13:02:20 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-04-28 13:03:22 +0000
commitefa99500f7e82571d9ab461d982aa82003abb928 (patch)
tree313aef45697a4dfe4ff147decd668ab2471680ec /main/dovecot
parent8f97837c0312b96a3d1bd72828b3c48699b70fac (diff)
downloadaports-efa99500f7e82571d9ab461d982aa82003abb928.tar.bz2
aports-efa99500f7e82571d9ab461d982aa82003abb928.tar.xz
main/dovecot: fix post-install script to handle 2.0 config
fixes #608
Diffstat (limited to 'main/dovecot')
-rw-r--r--main/dovecot/APKBUILD2
-rw-r--r--main/dovecot/dovecot.post-install18
2 files changed, 15 insertions, 5 deletions
diff --git a/main/dovecot/APKBUILD b/main/dovecot/APKBUILD
index 33ed4802f..a1510ad33 100644
--- a/main/dovecot/APKBUILD
+++ b/main/dovecot/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=dovecot
pkgver=2.0.12
-pkgrel=1
+pkgrel=2
pkgdesc="IMAP and POP3 server"
url="http://www.dovecot.org/"
arch="all"
diff --git a/main/dovecot/dovecot.post-install b/main/dovecot/dovecot.post-install
index d75f01ea2..e4d6bb281 100644
--- a/main/dovecot/dovecot.post-install
+++ b/main/dovecot/dovecot.post-install
@@ -2,6 +2,8 @@
# based on doc/mkcert.sh
+# if ssl disabled then lets just exit
+doveconf ssl | grep -q 'yes' || exit 0
# Generates a self-signed certificate.
OPENSSL=${OPENSSL-openssl}
@@ -11,25 +13,33 @@ OPENSSLCONFIG=${OPENSSLCONFIG-/etc/dovecot/dovecot-openssl.cnf}
CERTDIR=$SSLDIR
KEYDIR=$SSLDIR
-# parse cert and key file from dovecot.conf
+# parse cert and key file from dovecot.conf (1.2) for upgraders
dovecot_conf=/etc/dovecot/dovecot.conf
ssl_cert_file=
ssl_key_file=
if [ -r "$dovecot_conf" ]; then
ssl_cert_file=$(awk -F'[[:space:]]*=[[:space:]]*' '/^ssl_cert_file/ { print $2}' $dovecot_conf)
- ssl_cert_file=$(awk -F'[[:space:]]*=[[:space:]]*' '/^ssl_key_file/ { print $2}' $dovecot_conf)
+ ssl_key_file=$(awk -F'[[:space:]]*=[[:space:]]*' '/^ssl_key_file/ { print $2}' $dovecot_conf)
fi
+# check if we have ssl_cert and/or key (for dovecot-2.0+)
+# try expand the cert/key itself and if found, lets just keep it
+[ -n "$(doveconf -x ssl_cert 2>/dev/null)" ] && exit 0
+[ -n "$(doveconf -x ssl_cert 2>/dev/null)" ] && exit 0
+
+[ -z "$ssl_cert_file" ] && ssl_cert_file=$(doveconf ssl_cert | sed 's/.*= <//')
+[ -z "$ssl_key_file" ] && ssl_key_file=$(doveconf ssl_key | sed 's/.*= <//')
+
CERTFILE=${ssl_cert_file:-$CERTDIR/server.pem}
KEYFILE=${ssl_key_file:-$KEYDIR/server.key}
if [ -e "$CERTFILE" ]; then
- echo "Keeiping existing $CERTFILE"
+ echo "Keeping existing $CERTFILE"
exit 0
fi
if [ -e "$KEYFILE" ]; then
- echo "Keeiping existing $KEYFILE"
+ echo "Keeping existing $KEYFILE"
exit 0
fi