[gpsd] use systemd macros (#850135)

Miroslav Lichvar mlichvar at fedoraproject.org
Wed Feb 27 11:18:56 UTC 2013


commit bdf750e12e28914f5b70be3ab71c9b0488b99fc7
Author: Miroslav Lichvar <mlichvar at redhat.com>
Date:   Wed Feb 27 11:48:52 2013 +0100

    use systemd macros (#850135)

 gpsd.spec |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/gpsd.spec b/gpsd.spec
index 5765d97..1c2175e 100644
--- a/gpsd.spec
+++ b/gpsd.spec
@@ -22,6 +22,7 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release}
 Requires: udev
 Requires(post): systemd-units
 Requires(preun): systemd-units
+Requires(postun): systemd-units
 
 %description 
 gpsd is a service daemon that mediates access to a GPS sensor
@@ -141,25 +142,19 @@ for i in %{buildroot}%{python_sitearch}/gps/*.so; do
 done
 
 %post
-/bin/systemctl daemon-reload &> /dev/null
-if [ -f %{_initrddir}/%{name} ] && /sbin/chkconfig --level 3 %{name}; then
-        /bin/systemctl enable %{name}.service &> /dev/null
-fi
-:
+%systemd_post gpsd.service
 
 %preun
-if [ $1 = 0 ]; then
-	/bin/systemctl --no-reload disable %{name}.service &> /dev/null
-	/bin/systemctl stop %{name}.service &> /dev/null
-fi
-:
+%systemd_preun gpsd.service
 
-%post libs -p /sbin/ldconfig
+%postun
+# Don't restart the service
+%systemd_postun
 
+%post libs -p /sbin/ldconfig
 
 %postun libs -p /sbin/ldconfig
 
-
 %files
 %doc README INSTALL COPYING
 %config(noreplace) %{_sysconfdir}/sysconfig/%{name}


More information about the scm-commits mailing list