[srptools] Provide native systemd support

Doug Ledford dledford at fedoraproject.org
Wed Dec 5 20:04:20 UTC 2012


commit 75afb6034e037a8a3329c4b1aff97b7d11d8b621
Author: Doug Ledford <dledford at redhat.com>
Date:   Wed Dec 5 15:03:22 2012 -0500

    Provide native systemd support
    
    Signed-off-by: Doug Ledford <dledford at redhat.com>

 srptools.service |   17 +++++++++++++++++
 srptools.spec    |   42 +++++++++++++++++++++++++++++++++++++-----
 2 files changed, 54 insertions(+), 5 deletions(-)
---
diff --git a/srptools.service b/srptools.service
new file mode 100644
index 0000000..045d10f
--- /dev/null
+++ b/srptools.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Start or stop the daemon that attaches to SRP devices
+Documentation=file:///etc/rdma/rdma.conf file:///etc/srp_daemon.conf
+DefaultDependencies=false
+Conflicts=emergency.target emergency.service
+Requires=rdma.service
+Wants=opensm.service
+After=rdma.service opensm.service
+After=network.target remote-fs-pre.target
+Before=remote-fs.target
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/srp_daemon.sh
+
+[Install]
+WantedBy=remote-fs.target
diff --git a/srptools.spec b/srptools.spec
index 63459cc..3f90f10 100644
--- a/srptools.spec
+++ b/srptools.spec
@@ -1,6 +1,6 @@
 Name: srptools
 Version: 0.0.4
-Release: 15%{?dist}
+Release: 16%{?dist}
 Summary: Tools for using the InfiniBand SRP protocol devices
 Group: System Environment/Base
 License: GPLv2 or BSD
@@ -8,14 +8,27 @@ Url: http://www.openfabrics.org/
 
 Source0: http://www.openfabrics.org/downloads/%{name}/%{name}-%{version}-0.1.gce1f64c.tar.gz
 Source1: srptools.init
-BuildRequires: libibumad-devel, libibverbs-devel > 1.1.3
-ExclusiveArch: %{ix86} x86_64 ia64 ppc ppc64 %{arm}
+Source2: srptools.service
+BuildRequires: libibumad-devel, libibverbs-devel > 1.1.3, systemd
+Requires(pre): systemd
+Requires(preun): systemd
+Requires(postun): systemd
+ExcludeArch: s390 s390x
 Obsoletes: openib-srptools <= 0.0.6
 
 %description
 In conjunction with the kernel ib_srp driver, srptools allows you to
 discover and use SCSI devices via the SCSI RDMA Protocol over InfiniBand.
 
+%package sysv
+Summary: Back-compatible SysV Init script for srptools
+Group: System Environment/Base
+Requires(pre): chkconfig
+Requires(preun): chkconfig /sbin/service
+
+%description sysv
+Backward compatible SysV Init script for srptools package
+
 %prep
 %setup -q
 
@@ -26,21 +39,32 @@ make CFLAGS="$CFLAGS -fno-strict-aliasing" %{?_smp_mflags}
 %install
 make DESTDIR=%{buildroot} install
 install -p -m 755 -D %{SOURCE1} %{buildroot}%{_initrddir}/srpd
+install -p -m 755 -D %{SOURCE2} %{buildroot}%{_unitdir}/srpd.service
 
 %post
+%systemd_post srpd.service
+
+%preun
+%systemd_preun srpd.service
+
+%postun
+%systemd_postun
+
+%post sysv
 if [ $1 = 1 ]; then
     /sbin/chkconfig --add srpd
 fi
 
-%preun
+%preun sysv
 if [ $1 = 0 ]; then
+    /sbin/service srpd stop
     /sbin/chkconfig --del srpd
 fi
 
 %files
 %defattr(-,root,root)
 %config(noreplace) %{_sysconfdir}/srp_daemon.conf
-%{_initrddir}/srpd
+%{_unitdir}/srpd.service
 %{_sbindir}/ibsrpdm
 %{_sbindir}/srp_daemon
 %{_sbindir}/srp_daemon.sh
@@ -49,7 +73,15 @@ fi
 %{_mandir}/man1/srp_daemon.1*
 %doc README NEWS ChangeLog COPYING
 
+%files sysv
+%defattr(-,root,root)
+%{_initrddir}/srpd
+
 %changelog
+* Wed Dec 05 2012 Doug Ledford <dledford at redhat.com> - 0.0.4-16
+- Add native systemd support
+- Resolves: bz884274
+
 * Sat Jul 21 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.0.4-15
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
 


More information about the scm-commits mailing list