Blame SOURCES/dovecot-2.2.20-initbysystemd.patch

c83283
diff -up dovecot-2.3.0.1/dovecot-init.service.initbysystemd dovecot-2.3.0.1/dovecot-init.service
c83283
--- dovecot-2.3.0.1/dovecot-init.service.initbysystemd	2018-03-01 10:38:22.059716008 +0100
c83283
+++ dovecot-2.3.0.1/dovecot-init.service	2018-03-01 10:38:22.059716008 +0100
c83283
@@ -0,0 +1,13 @@
70765b
+[Unit]
70765b
+Description=One-time Dovecot init service
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
+
c83283
diff -up dovecot-2.3.0.1/dovecot.service.in.initbysystemd dovecot-2.3.0.1/dovecot.service.in
c83283
--- dovecot-2.3.0.1/dovecot.service.in.initbysystemd	2018-03-01 10:38:22.060716016 +0100
c83283
+++ dovecot-2.3.0.1/dovecot.service.in	2018-03-01 10:40:45.524901319 +0100
c83283
@@ -8,7 +8,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]
c83283
 Type=simple
c83283
diff -up dovecot-2.3.0.1/Makefile.am.initbysystemd dovecot-2.3.0.1/Makefile.am
c83283
--- dovecot-2.3.0.1/Makefile.am.initbysystemd	2018-02-28 15:28:57.000000000 +0100
c83283
+++ dovecot-2.3.0.1/Makefile.am	2018-03-01 10:38:22.060716016 +0100
c83283
@@ -63,9 +63,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: