aboutsummaryrefslogtreecommitdiff
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
parent8f97837c0312b96a3d1bd72828b3c48699b70fac (diff)
downloadalpine_aports-efa99500f7e82571d9ab461d982aa82003abb928.tar.bz2
alpine_aports-efa99500f7e82571d9ab461d982aa82003abb928.tar.xz
alpine_aports-efa99500f7e82571d9ab461d982aa82003abb928.zip
main/dovecot: fix post-install script to handle 2.0 config
fixes #608
-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 33ed4802fb..a1510ad339 100644
--- a/main/dovecot/APKBUILD
+++ b/main/dovecot/APKBUILD
@@ -2,7 +2,7 @@
2# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 2# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
3pkgname=dovecot 3pkgname=dovecot
4pkgver=2.0.12 4pkgver=2.0.12
5pkgrel=1 5pkgrel=2
6pkgdesc="IMAP and POP3 server" 6pkgdesc="IMAP and POP3 server"
7url="http://www.dovecot.org/" 7url="http://www.dovecot.org/"
8arch="all" 8arch="all"
diff --git a/main/dovecot/dovecot.post-install b/main/dovecot/dovecot.post-install
index d75f01ea20..e4d6bb281b 100644
--- a/main/dovecot/dovecot.post-install
+++ b/main/dovecot/dovecot.post-install
@@ -2,6 +2,8 @@
2 2
3# based on doc/mkcert.sh 3# based on doc/mkcert.sh
4 4
5# if ssl disabled then lets just exit
6doveconf ssl | grep -q 'yes' || exit 0
5# Generates a self-signed certificate. 7# Generates a self-signed certificate.
6 8
7OPENSSL=${OPENSSL-openssl} 9OPENSSL=${OPENSSL-openssl}
@@ -11,25 +13,33 @@ OPENSSLCONFIG=${OPENSSLCONFIG-/etc/dovecot/dovecot-openssl.cnf}
11CERTDIR=$SSLDIR 13CERTDIR=$SSLDIR
12KEYDIR=$SSLDIR 14KEYDIR=$SSLDIR
13 15
14# parse cert and key file from dovecot.conf 16# parse cert and key file from dovecot.conf (1.2) for upgraders
15dovecot_conf=/etc/dovecot/dovecot.conf 17dovecot_conf=/etc/dovecot/dovecot.conf
16ssl_cert_file= 18ssl_cert_file=
17ssl_key_file= 19ssl_key_file=
18if [ -r "$dovecot_conf" ]; then 20if [ -r "$dovecot_conf" ]; then
19 ssl_cert_file=$(awk -F'[[:space:]]*=[[:space:]]*' '/^ssl_cert_file/ { print $2}' $dovecot_conf) 21 ssl_cert_file=$(awk -F'[[:space:]]*=[[:space:]]*' '/^ssl_cert_file/ { print $2}' $dovecot_conf)
20 ssl_cert_file=$(awk -F'[[:space:]]*=[[:space:]]*' '/^ssl_key_file/ { print $2}' $dovecot_conf) 22 ssl_key_file=$(awk -F'[[:space:]]*=[[:space:]]*' '/^ssl_key_file/ { print $2}' $dovecot_conf)
21fi 23fi
22 24
25# check if we have ssl_cert and/or key (for dovecot-2.0+)
26# try expand the cert/key itself and if found, lets just keep it
27[ -n "$(doveconf -x ssl_cert 2>/dev/null)" ] && exit 0
28[ -n "$(doveconf -x ssl_cert 2>/dev/null)" ] && exit 0
29
30[ -z "$ssl_cert_file" ] && ssl_cert_file=$(doveconf ssl_cert | sed 's/.*= <//')
31[ -z "$ssl_key_file" ] && ssl_key_file=$(doveconf ssl_key | sed 's/.*= <//')
32
23CERTFILE=${ssl_cert_file:-$CERTDIR/server.pem} 33CERTFILE=${ssl_cert_file:-$CERTDIR/server.pem}
24KEYFILE=${ssl_key_file:-$KEYDIR/server.key} 34KEYFILE=${ssl_key_file:-$KEYDIR/server.key}
25 35
26if [ -e "$CERTFILE" ]; then 36if [ -e "$CERTFILE" ]; then
27 echo "Keeiping existing $CERTFILE" 37 echo "Keeping existing $CERTFILE"
28 exit 0 38 exit 0
29fi 39fi
30 40
31if [ -e "$KEYFILE" ]; then 41if [ -e "$KEYFILE" ]; then
32 echo "Keeiping existing $KEYFILE" 42 echo "Keeping existing $KEYFILE"
33 exit 0 43 exit 0
34fi 44fi
35 45