diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-04-28 13:02:20 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-04-28 13:03:22 +0000 |
commit | efa99500f7e82571d9ab461d982aa82003abb928 (patch) | |
tree | 313aef45697a4dfe4ff147decd668ab2471680ec | |
parent | 8f97837c0312b96a3d1bd72828b3c48699b70fac (diff) | |
download | alpine_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/APKBUILD | 2 | ||||
-rw-r--r-- | main/dovecot/dovecot.post-install | 18 |
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> |
3 | pkgname=dovecot | 3 | pkgname=dovecot |
4 | pkgver=2.0.12 | 4 | pkgver=2.0.12 |
5 | pkgrel=1 | 5 | pkgrel=2 |
6 | pkgdesc="IMAP and POP3 server" | 6 | pkgdesc="IMAP and POP3 server" |
7 | url="http://www.dovecot.org/" | 7 | url="http://www.dovecot.org/" |
8 | arch="all" | 8 | arch="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 | ||
6 | doveconf ssl | grep -q 'yes' || exit 0 | ||
5 | # Generates a self-signed certificate. | 7 | # Generates a self-signed certificate. |
6 | 8 | ||
7 | OPENSSL=${OPENSSL-openssl} | 9 | OPENSSL=${OPENSSL-openssl} |
@@ -11,25 +13,33 @@ OPENSSLCONFIG=${OPENSSLCONFIG-/etc/dovecot/dovecot-openssl.cnf} | |||
11 | CERTDIR=$SSLDIR | 13 | CERTDIR=$SSLDIR |
12 | KEYDIR=$SSLDIR | 14 | KEYDIR=$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 |
15 | dovecot_conf=/etc/dovecot/dovecot.conf | 17 | dovecot_conf=/etc/dovecot/dovecot.conf |
16 | ssl_cert_file= | 18 | ssl_cert_file= |
17 | ssl_key_file= | 19 | ssl_key_file= |
18 | if [ -r "$dovecot_conf" ]; then | 20 | if [ -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) |
21 | fi | 23 | fi |
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 | |||
23 | CERTFILE=${ssl_cert_file:-$CERTDIR/server.pem} | 33 | CERTFILE=${ssl_cert_file:-$CERTDIR/server.pem} |
24 | KEYFILE=${ssl_key_file:-$KEYDIR/server.key} | 34 | KEYFILE=${ssl_key_file:-$KEYDIR/server.key} |
25 | 35 | ||
26 | if [ -e "$CERTFILE" ]; then | 36 | if [ -e "$CERTFILE" ]; then |
27 | echo "Keeiping existing $CERTFILE" | 37 | echo "Keeping existing $CERTFILE" |
28 | exit 0 | 38 | exit 0 |
29 | fi | 39 | fi |
30 | 40 | ||
31 | if [ -e "$KEYFILE" ]; then | 41 | if [ -e "$KEYFILE" ]; then |
32 | echo "Keeiping existing $KEYFILE" | 42 | echo "Keeping existing $KEYFILE" |
33 | exit 0 | 43 | exit 0 |
34 | fi | 44 | fi |
35 | 45 | ||