From 238b8d2f24dbe32c025cf86c46d8ac72cd18884d Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Nov 08 2012 16:26:53 +0000 Subject: fix network still not ready race condition (#871623) --- diff --git a/dovecot-2.1.10-waitonline.patch b/dovecot-2.1.10-waitonline.patch new file mode 100644 index 0000000..324094c --- /dev/null +++ b/dovecot-2.1.10-waitonline.patch @@ -0,0 +1,11 @@ +diff -up dovecot-2.1.10/dovecot.service.in.waitonline dovecot-2.1.10/dovecot.service.in +--- dovecot-2.1.10/dovecot.service.in.waitonline 2012-11-08 17:09:14.025772652 +0100 ++++ dovecot-2.1.10/dovecot.service.in 2012-11-08 17:10:06.472155786 +0100 +@@ -4,6 +4,7 @@ After=local-fs.target network.target + + [Service] + Type=simple ++ExecStartPre=/usr/libexec/dovecot/prestartscript + ExecStart=@sbindir@/dovecot -F + ExecReload=/bin/kill -HUP $MAINPID + PrivateTmp=true diff --git a/dovecot.spec b/dovecot.spec index 46402a1..fde15a8 100644 --- a/dovecot.spec +++ b/dovecot.spec @@ -3,7 +3,7 @@ Name: dovecot Epoch: 1 Version: 2.1.10 #global prever .rc6 -Release: 2%{?dist} +Release: 3%{?dist} #dovecot itself is MIT, a few sources are PD, pigeonhole is LGPLv2 License: MIT and LGPLv2 Group: System Environment/Daemons @@ -31,6 +31,10 @@ Patch3: dovecot-1.0.rc7-mkcert-paths.patch Patch4: dovecot-2.1.10-reload.patch Patch5: dovecot-2.1-privatetmp.patch +#wait for network +Patch6: dovecot-2.1.10-waitonline.patch +Source15: prestartscript + Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: openssl-devel, pam-devel, zlib-devel, bzip2-devel, libcap-devel BuildRequires: libtool, autoconf, automake, pkgconfig @@ -124,6 +128,7 @@ This package provides the development files for dovecot. %patch3 -p1 -b .mkcert-paths %patch4 -p1 -b .reload %patch5 -p1 -b .privatetmp +%patch6 -p1 -b .waitonline sed -i '/DEFAULT_INCLUDES *=/s|$| '"$(pkg-config --cflags libclucene-core)|" src/plugins/fts-lucene/Makefile.in %build @@ -200,6 +205,9 @@ install -p -D -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/dovecot #install man pages install -p -D -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_mandir}/man5/dovecot.conf.5 +#install waitonline script +install -p -D -m 755 %{SOURCE15} $RPM_BUILD_ROOT%{_libexecdir}/dovecot/prestartscript + # generate ghost .pem files mkdir -p $RPM_BUILD_ROOT%{ssldir}/certs mkdir -p $RPM_BUILD_ROOT%{ssldir}/private @@ -464,6 +472,9 @@ make check %{_libdir}/%{name}/dict/libdriver_pgsql.so %changelog +* Thu Nov 08 2012 Michal Hlavinka - 1:2.1.10-3 +- fix network still not ready race condition (#871623) + * Fri Nov 02 2012 Michal Hlavinka - 1:2.1.10-2 - add reload command to service file diff --git a/prestartscript b/prestartscript new file mode 100755 index 0000000..e4824e0 --- /dev/null +++ b/prestartscript @@ -0,0 +1,3 @@ +#!/bin/sh +/bin/systemctl -q is-enabled NetworkManager.service && /usr/bin/nm-online -q --timeout 30 ||: +