dodan openssl-dovecot.cnf
[dovecot-cn.git] / debian / postinst
index 6ecc8f6..4cc3cb3 100755 (executable)
@@ -46,15 +46,16 @@ cp_check_and_sed 'ssl = no' \
 
 if ! grep -q ^ssl_cert /etc/dovecot/conf.d/10-ssl.conf \
   && ! grep -q ^ssl_key /etc/dovecot/conf.d/10-ssl.conf; then
+
+  echo "CN: Generating certificate and key..."
+  /usr/share/dovecot-cn/mkcert.sh > /dev/null
+
   cp_check_and_sed '#ssl_cert = </etc/dovecot/dovecot.pem' \
                   's|#ssl_cert = </etc/dovecot/dovecot.pem|ssl_cert = </etc/dovecot/dovecot.pem|g' \
                   /etc/dovecot/conf.d/10-ssl.conf || true
   cp_check_and_sed '#ssl_key = </etc/dovecot/private/dovecot.pem' \
                   's|#ssl_key = </etc/dovecot/private/dovecot.pem|ssl_key = </etc/dovecot/private/dovecot.pem|g' \
                   /etc/dovecot/conf.d/10-ssl.conf || true
-
-  echo "CN: Generating certificate and key..."
-  /usr/share/dovecot-cn/mkcert.sh > /dev/null
 fi