[ntp/f18] use systemd macros if available (#850235)

Miroslav Lichvar mlichvar at fedoraproject.org
Wed Oct 24 16:33:24 UTC 2012


commit 87620f6988d29cacb903f23381878131acd6783c
Author: Miroslav Lichvar <mlichvar at redhat.com>
Date:   Wed Oct 24 18:12:17 2012 +0200

    use systemd macros if available (#850235)

 ntp.spec |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/ntp.spec b/ntp.spec
index a2032e0..bdd24dc 100644
--- a/ntp.spec
+++ b/ntp.spec
@@ -268,41 +268,83 @@ popd
 /usr/sbin/useradd -u 38 -g 38 -s /sbin/nologin -M -r -d %{_sysconfdir}/ntp ntp 2>/dev/null || :
 
 %post
+%if 0%{?systemd_post:1}
+%systemd_post ntpd.service
+%else
 /bin/systemctl daemon-reload &> /dev/null || :
+%endif
 
 %post -n ntpdate
+%if 0%{?systemd_post:1}
+%systemd_post ntpdate.service
+%else
 /bin/systemctl daemon-reload &> /dev/null || :
+%endif
 
 %post perl
+%if 0%{?systemd_post:1}
+%systemd_post ntp-wait.service
+%else
 /bin/systemctl daemon-reload &> /dev/null || :
+%endif
 
 %preun
+%if 0%{?systemd_preun:1}
+%systemd_preun ntpd.service
+%else
 if [ "$1" -eq 0 ]; then
 	/bin/systemctl --no-reload disable ntpd.service &> /dev/null
 	/bin/systemctl stop ntpd.service &> /dev/null
 fi
 :
+%endif
 
 %preun -n ntpdate
+%if 0%{?systemd_preun:1}
+%systemd_preun ntpdate.service
+%else
 if [ "$1" -eq 0 ]; then
 	/bin/systemctl --no-reload disable ntpdate.service &> /dev/null
 	/bin/systemctl stop ntpdate.service &> /dev/null
 fi
 :
+%endif
 
 %preun perl
+%if 0%{?systemd_preun:1}
+%systemd_preun ntp-wait.service
+%else
 if [ "$1" -eq 0 ]; then
 	/bin/systemctl --no-reload disable ntp-wait.service &> /dev/null
 	/bin/systemctl stop ntp-wait.service &> /dev/null
 fi
 :
+%endif
 
 %postun
+%if 0%{?systemd_postun_with_restart:1}
+%systemd_postun_with_restart ntpd.service
+%else
 /bin/systemctl daemon-reload &> /dev/null
 if [ "$1" -ge 1 ]; then
 	/bin/systemctl try-restart ntpd.service &> /dev/null
 fi
 :
+%endif
+
+%postun -n ntpdate
+%if 0%{?systemd_postun:1}
+%systemd_postun
+%else
+/bin/systemctl daemon-reload &> /dev/null || :
+%endif
+
+%postun perl
+%if 0%{?systemd_postun:1}
+%systemd_postun
+%else
+/bin/systemctl daemon-reload &> /dev/null || :
+%endif
 
 %files
 %dir %{ntpdocdir}


More information about the scm-commits mailing list