From 947de079b77e4aff3c1dcda1231fc617d93546fc Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Fri, 10 Aug 2018 12:53:42 +0200 Subject: [PATCH] fix PIDFile in local chronyd.service on upgrades from chrony < 3.3-2 --- chrony.spec | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/chrony.spec b/chrony.spec index 198c2d6..a703e11 100644 --- a/chrony.spec +++ b/chrony.spec @@ -157,6 +157,14 @@ getent passwd chrony > /dev/null || /usr/sbin/useradd -r -g chrony \ : %post +# fix PIDFile in local chronyd.service on upgrades from chrony < 3.3-2 +if grep -q 'PIDFile=%{_localstatedir}/run/chronyd.pid' \ + %{_sysconfdir}/systemd/system/chronyd.service 2> /dev/null && \ + ! grep -qi '^[ '$'\t'']*pidfile' %{_sysconfdir}/chrony.conf 2> /dev/null +then + sed -i '/PIDFile=/s|/run/|/run/chrony/|' \ + %{_sysconfdir}/systemd/system/chronyd.service +fi %systemd_post chronyd.service chrony-wait.service %preun