Blame SOURCES/dovecot-2.2.20-initbysystemd.patch

70765b
diff -up dovecot-2.2.22/dovecot-init.service.initbysystemd dovecot-2.2.22/dovecot-init.service
70765b
--- dovecot-2.2.22/dovecot-init.service.initbysystemd	2016-03-16 13:48:25.996297203 +0100
70765b
+++ dovecot-2.2.22/dovecot-init.service	2016-03-16 13:48:25.996297203 +0100
70765b
@@ -0,0 +1,18 @@
70765b
+[Unit]
70765b
+Description=One-time Dovecot init service
70765b
+ConditionPathExists=|!/var/lib/dovecot/ssl-parameters.dat
70765b
+ConditionPathExists=|!/etc/pki/dovecot/certs/dovecot.pem
70765b
+
70765b
+[Service]
70765b
+Type=oneshot
70765b
+RemainAfterExit=no
70765b
+ExecStart=/bin/sh -c '\
70765b
+if [ ! -f /etc/pki/dovecot/certs/dovecot.pem ]; \
70765b
+then\
70765b
+  SSLDIR=/etc/pki/dovecot/ OPENSSLCONFIG=/etc/pki/dovecot/dovecot-openssl.cnf /usr/libexec/dovecot/mkcert.sh /dev/null 2>&1;\
70765b
+fi;\
70765b
+if [ ! -f /var/lib/dovecot/ssl-parameters.dat ]; \
70765b
+then\
70765b
+  /usr/libexec/dovecot/ssl-params >/dev/null 2>&1; \
70765b
+fi'
70765b
+
70765b
diff -up dovecot-2.2.22/dovecot.service.in.initbysystemd dovecot-2.2.22/dovecot.service.in
70765b
--- dovecot-2.2.22/dovecot.service.in.initbysystemd	2016-03-16 13:48:25.996297203 +0100
70765b
+++ dovecot-2.2.22/dovecot.service.in	2016-03-16 13:49:17.619039641 +0100
70765b
@@ -20,7 +20,8 @@
70765b
 Description=Dovecot IMAP/POP3 email server
70765b
 Documentation=man:dovecot(1)
70765b
 Documentation=http://wiki2.dovecot.org/
70765b
-After=local-fs.target network-online.target
70765b
+After=local-fs.target network-online.target dovecot-init.service
70765b
+Requires=dovecot-init.service
70765b
 
70765b
 [Service]
70765b
 Type=forking
70765b
diff -up dovecot-2.2.22/Makefile.am.initbysystemd dovecot-2.2.22/Makefile.am
70765b
--- dovecot-2.2.22/Makefile.am.initbysystemd	2016-03-04 12:04:33.000000000 +0100
70765b
+++ dovecot-2.2.22/Makefile.am	2016-03-16 13:48:25.996297203 +0100
70765b
@@ -51,9 +51,10 @@ if HAVE_SYSTEMD
70765b
 
70765b
 systemdsystemunit_DATA = \
70765b
         dovecot.socket \
70765b
-        dovecot.service
70765b
+        dovecot.service \
70765b
+        dovecot-init.service
70765b
 else
70765b
-EXTRA_DIST += dovecot.socket dovecot.service.in
70765b
+EXTRA_DIST += dovecot.socket dovecot.service.in dovecot-init.service
70765b
 endif
70765b
 
70765b
 install-exec-hook: