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