[spacenavd] Update package for systemd macros in F18+.

Richard Shaw hobbes1069 at fedoraproject.org
Tue Dec 18 22:13:05 UTC 2012


commit b2ba1470f47bafaa2375d451c9fab8bf9c2cc13a
Author: Richard M. Shaw <hobbes1069 at gmail.com>
Date:   Tue Dec 18 16:13:02 2012 -0600

    Update package for systemd macros in F18+.

 spacenavd.spec |   74 +++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 49 insertions(+), 25 deletions(-)
---
diff --git a/spacenavd.spec b/spacenavd.spec
index 602670c..40e4c5a 100644
--- a/spacenavd.spec
+++ b/spacenavd.spec
@@ -1,6 +1,6 @@
 Name:           spacenavd
 Version:        0.5
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        A free, compatible alternative for 3Dconnexion's input drivers
 
 Group:          User Interface/X Hardware Support
@@ -13,14 +13,25 @@ Source1:        spacenavd.service
 Source2:        spacenavd
 
 BuildRequires:  libX11-devel
-%if (0%{?fedora})
+
+%if 0%{?fedora} >= 18
+BuildRequires:  systemd
+%else
+%if 0%{?fedora}
 BuildRequires:  systemd-units
 %endif
+%endif
 
 %if (0%{?fedora})
+%if %fedora >= 18
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
+%else
 Requires(post): systemd-units
 Requires(preun): systemd-units
 Requires(postun): systemd-units
+%endif
 %else
 Requires(post): /sbin/chkconfig
 Requires(post): /sbin/service
@@ -66,39 +77,49 @@ rm -rf %{buildroot}
 
 
 %post
-if [ $1 -eq 1 ] ; then 
-    # Initial installation
-%if (0%{?fedora})
-    /bin/systemctl enable spacenavd.service &> /dev/null || :
+%if 0%{?fedora} >= 18
+    %systemd_post spacenavd.service
 %else
-    /sbin/chkconfig --add spacenavd &> /dev/null || :
+    if [ $1 -eq 1 ] ; then 
+    %if 0%{?fedora}
+        /bin/systemctl enable spacenavd.service &> /dev/null || :
+    %else
+        /sbin/chkconfig --add spacenavd &> /dev/null || :
+    %endif
+    fi
 %endif
-fi
 
 %preun
-if [ $1 -eq 0 ] ; then
-    # Package removal, not upgrade
-%if (0%{?fedora})
-    /bin/systemctl --no-reload disable spacenavd.service &> /dev/null || :
-    /bin/systemctl stop spacenavd.service &> /dev/null || :
+%if 0%{?fedora} >= 18
+    %systemd_preun spacenavd.service
 %else
-    /sbin/service spacenavd stop &> /dev/null
-    /sbin/chkconfig --del spacenavd &> /dev/null || :
-%endif
+    if [ $1 -eq 0 ] ; then
+    %if 0%{?fedora}
+        /bin/systemctl --no-reload disable spacenavd.service &> /dev/null || :
+        /bin/systemctl stop spacenavd.service &> /dev/null || :
+    %else
+        /sbin/service spacenavd stop &> /dev/null
+        /sbin/chkconfig --del spacenavd &> /dev/null || :
+    %endif
 fi
+%endif
 
 %postun
-%if (0%{?fedora})
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-%endif
-if [ $1 -ge 1 ] ; then
-    # Package upgrade, not uninstall
-%if (0%{?fedora})
-    /bin/systemctl try-restart spacenavd.service &> /dev/null || :
+%if 0%{?fedora} >= 18
+    %systemd_postun_with_restart spacenavd.service
 %else
-    /bin/service restart spacenavd &> /dev/null || :
+    %if 0%{?fedora}
+        /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+        if [ $1 -ge 1 ] ; then
+            # Package upgrade, not uninstall
+            /bin/systemctl try-restart spacenavd.service &> /dev/null || :
+        fi
+    %else
+        if [ $1 -ge 1 ] ; then
+            /bin/service restart spacenavd &> /dev/null || :
+        fi
+    %endif
 %endif
-fi
 
 
 %files
@@ -112,6 +133,9 @@ fi
 
 
 %changelog
+* Tue Dec 18 2012 Richard Shaw <hobbes1069 at gmail.com> - 0.5-5
+- Update package for systemd macros in F18+.
+
 * Tue Oct 16 2012 John Morris <john at zultron.com> - 0.5-4
 - Re-add sysv init file for el6
 


More information about the scm-commits mailing list