[rwall: 3/4] Use new systemd macros (Resolves: #850303)

Honza Horak hhorak at fedoraproject.org
Tue Sep 11 08:12:38 UTC 2012


commit 925b1a4f232d92704c8f666ecd95136e1d3a553f
Author: Honza HorĂ¡k <hhorak at redhat.com>
Date:   Tue Sep 11 10:01:37 2012 +0200

    Use new systemd macros (Resolves: #850303)

 rwall.spec |   47 ++++++++++++++++++++++++++++++-----------------
 1 files changed, 30 insertions(+), 17 deletions(-)
---
diff --git a/rwall.spec b/rwall.spec
index b0ed936..9a66d50 100644
--- a/rwall.spec
+++ b/rwall.spec
@@ -83,29 +83,41 @@ make INSTALLROOT=${RPM_BUILD_ROOT} install
 install -m 755 %{SOURCE1} ${RPM_BUILD_ROOT}%{_unitdir}/
 
 %post server
-if [ $1 = 1 ]; then
-    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
-fi
+%if 0%{?systemd_post:1}
+  %systemd_post rwalld.service
+%else
+  if [ $1 = 1 ]; then
+      /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+  fi
 
-# Package with native systemd unit file is installed for the first time
-%triggerun -- rwall-server < 0.17-33
-%{_bindir}/systemd-sysv-convert --save rwalld >/dev/null 2>&1 ||:
+  # Package with native systemd unit file is installed for the first time
+  %triggerun -- rwall-server < 0.17-33
+  %{_bindir}/systemd-sysv-convert --save rwalld >/dev/null 2>&1 ||:
 
-# Run these because the SysV package being removed won't do them
-/sbin/chkconfig --del rwalld >/dev/null 2>&1 || :
-/bin/systemctl try-restart rwalld.service >/dev/null 2>&1 || :
+  # Run these because the SysV package being removed won't do them
+  /sbin/chkconfig --del rwalld >/dev/null 2>&1 || :
+  /bin/systemctl try-restart rwalld.service >/dev/null 2>&1 || :
+%endif
 
 %preun server
-if [ $1 = 0 ]; then
-    /bin/systemctl --no-reload disable rwalld.service >/dev/null 2>&1 || :
-    /bin/systemctl stop rwalld.service >/dev/null 2>&1 || :
-fi
+%if 0%{?systemd_preun:1}
+  %systemd_preun rwalld.service
+%else
+  if [ $1 = 0 ]; then
+      /bin/systemctl --no-reload disable rwalld.service >/dev/null 2>&1 || :
+      /bin/systemctl stop rwalld.service >/dev/null 2>&1 || :
+  fi
+%endif
 
 %postun server
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-if [ $1 -ge 1 ]; then
-    /bin/systemctl try-restart rwalld.service >/dev/null 2>&1 || :
-fi
+%if 0%{?systemd_postun_with_restart:1}
+  %systemd_postun_with_restart rwalld.service
+%else
+  /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+  if [ $1 -ge 1 ]; then
+      /bin/systemctl try-restart rwalld.service >/dev/null 2>&1 || :
+  fi
+%endif
 
 %files
 %{_bindir}/rwall
@@ -121,6 +133,7 @@ fi
 * Tue Sep 11 2012 Honza Horak <hhorak at redhat.com> - 0.17-34
 - added ordering dependencies to rpcbind
 - Minor spec file changes
+- Use new systemd macros (Resolves: #850303)
 
 * Mon Aug 01 2011 Honza Horak <hhorak at redhat.com> - 0.17-33
 - added systemd native unit file


More information about the scm-commits mailing list