[whatsup/f16] convert to systemd

Tom Callaway spot at fedoraproject.org
Mon Sep 26 14:27:36 UTC 2011


commit 9666c1831254835b7dba4b4ce235b339e6c30580
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date:   Mon Sep 26 10:27:22 2011 -0400

    convert to systemd

 whatsup-pingd.service |   11 +++++++++
 whatsup.spec          |   57 ++++++++++++++++++++++++++++++++----------------
 2 files changed, 49 insertions(+), 19 deletions(-)
---
diff --git a/whatsup-pingd.service b/whatsup-pingd.service
new file mode 100644
index 0000000..fee69a1
--- /dev/null
+++ b/whatsup-pingd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=whatsup-pingd
+After=syslog.target network.target
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/pingd
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/whatsup.spec b/whatsup.spec
index cbf0a9d..7cc6fb8 100644
--- a/whatsup.spec
+++ b/whatsup.spec
@@ -9,16 +9,18 @@
 Summary:       Node up/down detection utility
 Name:          whatsup
 Version:       1.12
-Release:       4%{?dist}.1
+Release:       6%{?dist}
 Group:         Applications/Communications
 License:       GPLv2+
 URL:           https://computing.llnl.gov/linux/whatsup.html
 Source0:       http://master.dl.sourceforge.net/sourceforge/%{name}/%{name}-%{version}.tar.gz
 Source1:       %{name}-hostsfile
+Source2:       %{name}-pingd.service
 Patch0:        %{name}-move-initscript.patch
 Patch1:        %{name}-fix-initscript.patch 
 Patch2:        %{name}-install-into-vendorarch.patch
 BuildRequires: perl(ExtUtils::MakeMaker) expat-devel
+BuildRequires: systemd-units
 Requires:      %{libname} = %{version}-%{release}
 
 %description
@@ -73,6 +75,10 @@ pingd backend module for %{libname}
 Summary:       Pingd daemon for %{name}
 Group:         Applications/Communications
 Requires:      %{libname} = %{version}-%{release}
+Requires(post): systemd-sysv
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
 %description -n %{name}-pingd
 pingd daemon for %{name}
 
@@ -103,7 +109,10 @@ make %{?_smpflags}
 
 %install
 make DESTDIR=%{buildroot} install
-mkdir -vp %{buildroot}%{_initrddir}
+
+mkdir -vp %{buildroot}%{_unitdir}
+install -m 644 -p %{SOURCE2} %{buildroot}%{_unitdir}/
+rm -rf %{buildroot}%{_initrddir}
 
 # for whatsup-pingd
 install -m 644 -p %{SOURCE1} %{buildroot}%{_sysconfdir}/hostsfile
@@ -121,28 +130,42 @@ touch %{buildroot}%{_sysconfdir}/hostsfile
 %postun -n %{libname} -p /sbin/ldconfig
 
 %post -n %{name}-pingd
-/sbin/chkconfig --add %{name}-pingd
+if [ $1 -eq 1 ] ; then 
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 
 %preun -n %{name}-pingd
-if [ $1 -eq 0 ]; then
-    /sbin/chkconfig --del %{name}-pingd
-    /sbin/service %{name}-pingd stop >/dev/null 2>&1 || :
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable whatsup-pingd.service > /dev/null 2>&1 || :
+    /bin/systemctl stop whatsup-pingd.service > /dev/null 2>&1 || :
 fi
 
 %postun -n %{name}-pingd
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
 if [ $1 -ge 1 ] ; then
-    /sbin/service %{name}-pingd condrestart > /dev/null 2>&1 || :
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart whatsup-pingd.service >/dev/null 2>&1 || :
 fi
 
+%triggerun -n %{name}-pingd -- whatsup-pingd < 1.12-6
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply whatsup-pingd
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save whatsup-pingd >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del whatsup-pingd >/dev/null 2>&1 || :
+/bin/systemctl try-restart whatsup-pingd.service >/dev/null 2>&1 || :
+
 %files
-%defattr(-,root,root,-)
 %doc AUTHORS COPYING DISCLAIMER NEWS README ChangeLog
 %{_bindir}/whatsdown
 %{_bindir}/whatsup
 %{_mandir}/man1/*
 
 %files -n perl-%{libname}
-%defattr(-,root,root,-)
 %doc COPYING
 %{_mandir}/man3/Libnodeupdown.3*
 %{_mandir}/man3/Nodeupdown.3*
@@ -150,9 +173,8 @@ fi
 %exclude %dir %{perl_vendorarch}/auto/
 
 %files -n %{name}-pingd
-%defattr(-,root,root,-)
 %doc COPYING
-%{_initrddir}/%{name}-pingd
+%{_unitdir}/%{name}-pingd.service
 %{_sbindir}/pingd
 %dir %{_libdir}/pingd
 %{_libdir}/pingd/pingd_clusterlist_hostsfile.so
@@ -162,7 +184,6 @@ fi
 %{_sysconfdir}/pingd.conf
 
 %files -n %{libname}-devel
-%defattr(-,root,root,-)
 %doc COPYING
 %{_includedir}/nodeupdown.h
 %dir %{_includedir}/nodeupdown
@@ -171,7 +192,6 @@ fi
 %{_mandir}/man3/nodeupdown*
 
 %files -n %{libname}
-%defattr(-,root,root,-)
 %doc COPYING
 %{_libdir}/libnodeupdown*.so.*
 %dir %{_libdir}/nodeupdown
@@ -180,32 +200,31 @@ fi
 %{_sysconfdir}/nodeupdown.conf
 
 %files -n %{libname}-backend-ganglia
-%defattr(-,root,root,-)
 %doc COPYING
 %{_libdir}/nodeupdown/nodeupdown_backend_ganglia.so
 
 %if %{with_ib}
 %files -n %{libname}-backend-openib
-%defattr(-,root,root,-)
 %doc COPYING
 %{_libdir}/nodeupdown/nodeupdown_backend_openib.so
 %endif
 
 %files -n %{libname}-backend-pingd
-%defattr(-,root,root,-)
 %doc COPYING
 %{_libdir}/nodeupdown/nodeupdown_backend_pingd.so
 
 %files -n %{libname}-clusterlist-hostsfile
-%defattr(-,root,root,-)
 %doc COPYING
 %{_libdir}/nodeupdown/nodeupdown_clusterlist_hostsfile.so
 %config(noreplace) %{_sysconfdir}/hostsfile
 
 
 %changelog
-* Sat Sep 17 2011 Ruben Kerkhof <ruben at rubenkerkhof.com> 1.12-4.1
-- Bump for f16
+* Fri Sep 23 2011 Tom Callaway <spot at fedoraproject.org> - 1.12-6
+- convert to systemd
+
+* Tue Aug 02 2011 Ruben Kerkhof <ruben at rubenkerkhof.com> 1.12-5
+- Rebuild for new opensm
 
 * Mon Jul 25 2011 Ruben Kerkhof <ruben at rubenkerkhof.com> 1.12-4
 - Rebuild for new libopensm


More information about the scm-commits mailing list