[spacenavd/el6] specfile: Re-add systemV init script for el6

John Morris zultron at fedoraproject.org
Wed Oct 17 21:51:51 UTC 2012


commit 895cf48a22098669b95710751612b09f58755b9a
Author: John Morris <john at zultron.com>
Date:   Tue Oct 16 12:44:12 2012 -0500

    specfile:  Re-add systemV init script for el6

 spacenavd.spec |   48 ++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 44 insertions(+), 4 deletions(-)
---
diff --git a/spacenavd.spec b/spacenavd.spec
index 4d6e377..602670c 100644
--- a/spacenavd.spec
+++ b/spacenavd.spec
@@ -7,14 +7,26 @@ Group:          User Interface/X Hardware Support
 License:        GPLv3+
 URL:            http://spacenav.sourceforge.net/
 Source0:        http://downloads.sourceforge.net/spacenav/%{name}-%{version}.tar.gz
+# systemd unit files, for fedora
 Source1:        spacenavd.service
+# systemV init script, for el6
+Source2:        spacenavd
 
 BuildRequires:  libX11-devel
+%if (0%{?fedora})
 BuildRequires:  systemd-units
+%endif
 
+%if (0%{?fedora})
 Requires(post): systemd-units
 Requires(preun): systemd-units
 Requires(postun): systemd-units
+%else
+Requires(post): /sbin/chkconfig
+Requires(post): /sbin/service
+Requires(preun): /sbin/chkconfig
+Requires(preun): /sbin/service
+%endif
 
 
 %description
@@ -38,9 +50,15 @@ make %{?_smp_mflags}
 %install
 make install
 
+%if (0%{?fedora})
 # Install systemd unit file
 mkdir -p %{buildroot}%{_unitdir}
 install -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}
+%else
+# Install systemV init script
+mkdir -p %{buildroot}%{_initrddir}
+install -p -m 0755 %{SOURCE2} %{buildroot}%{_initrddir}
+%endif
 
 
 %clean
@@ -50,31 +68,53 @@ rm -rf %{buildroot}
 %post
 if [ $1 -eq 1 ] ; then 
     # Initial installation
-    /bin/systemctl enable spacenavd.service >/dev/null 2>&1 || :
+%if (0%{?fedora})
+    /bin/systemctl enable spacenavd.service &> /dev/null || :
+%else
+    /sbin/chkconfig --add spacenavd &> /dev/null || :
+%endif
 fi
 
 %preun
 if [ $1 -eq 0 ] ; then
     # Package removal, not upgrade
-    /bin/systemctl --no-reload disable spacenavd.service > /dev/null 2>&1 || :
-    /bin/systemctl stop spacenavd.service > /dev/null 2>&1 || :
+%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
 
 %postun
+%if (0%{?fedora})
 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+%endif
 if [ $1 -ge 1 ] ; then
     # Package upgrade, not uninstall
-    /bin/systemctl try-restart spacenavd.service >/dev/null 2>&1 || :
+%if (0%{?fedora})
+    /bin/systemctl try-restart spacenavd.service &> /dev/null || :
+%else
+    /bin/service restart spacenavd &> /dev/null || :
+%endif
 fi
 
 
 %files
 %doc AUTHORS Changelog doc/* README
 %{_bindir}/*
+%if (0%{?fedora})
 %{_unitdir}/%{name}.service
+%else
+%{_initrddir}/%{name}
+%endif
 
 
 %changelog
+* Tue Oct 16 2012 John Morris <john at zultron.com> - 0.5-4
+- Re-add sysv init file for el6
+
 * Sat Jul 21 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.5-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
 


More information about the scm-commits mailing list