Blame SOURCES/dovecot-2.2.20-initbysystemd.patch

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