[chrony] use systemd macros if available (#850151)

Miroslav Lichvar mlichvar at fedoraproject.org
Tue Sep 11 17:54:42 UTC 2012


commit 71e2b44d83b4e984983529db5075b102830888c4
Author: Miroslav Lichvar <mlichvar at redhat.com>
Date:   Tue Sep 11 17:52:12 2012 +0200

    use systemd macros if available (#850151)

 chrony.spec |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/chrony.spec b/chrony.spec
index 657527b..78f329e 100644
--- a/chrony.spec
+++ b/chrony.spec
@@ -103,31 +103,39 @@ getent passwd chrony > /dev/null || /usr/sbin/useradd -r -g chrony \
 :
 
 %post
+%if 0%{?systemd_post:1}
+%systemd_post chronyd.service chrony-wait.service
+%else
 /bin/systemctl daemon-reload &> /dev/null
+%endif
 /sbin/install-info %{_infodir}/chrony.info.gz %{_infodir}/dir &> /dev/null
 :
 
-%triggerun -- chrony < 1.25
-if /sbin/chkconfig --level 3 chronyd; then
-        /bin/systemctl enable chronyd.service &> /dev/null
-fi
-:
-
 %preun
+%if 0%{?systemd_preun:1}
+%systemd_preun chronyd.service chrony-wait.service
+%else
 if [ "$1" -eq 0 ]; then
         /bin/systemctl --no-reload disable \
                 chrony-wait.service chronyd.service &> /dev/null
         /bin/systemctl stop chrony-wait.service chronyd.service &> /dev/null
+fi
+%endif
+if [ "$1" -eq 0 ]; then
         /sbin/install-info --delete %{_infodir}/chrony.info.gz \
                 %{_infodir}/dir &> /dev/null
 fi
 :
 
 %postun
+%if 0%{?systemd_postun_with_restart:1}
+%systemd_postun_with_restart chronyd.service
+%else
 /bin/systemctl daemon-reload &> /dev/null
 if [ "$1" -ge 1 ]; then
         /bin/systemctl try-restart chronyd.service &> /dev/null
 fi
+%endif
 :
 
 %files


More information about the scm-commits mailing list