Blame SOURCES/dovecot-2.2.20-initbysystemd.patch

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