fix PIDFile in local chronyd.service on upgrades from chrony < 3.3-2

This commit is contained in:
Miroslav Lichvar 2018-08-10 12:53:42 +02:00
parent 1284f5a8d4
commit 947de079b7

View File

@ -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