[cluster-glue] convert to systemd

Tom Callaway spot at fedoraproject.org
Thu Sep 15 19:39:24 UTC 2011


commit 25d697edce9a4c69be96c98b9a6fda44658d4da4
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date:   Thu Sep 15 15:39:11 2011 -0400

    convert to systemd

 cluster-glue.spec |   53 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 logd.service      |   14 ++++++++++++++
 2 files changed, 64 insertions(+), 3 deletions(-)
---
diff --git a/cluster-glue.spec b/cluster-glue.spec
index 011a0b2..7a76c8b 100644
--- a/cluster-glue.spec
+++ b/cluster-glue.spec
@@ -4,7 +4,7 @@
 
 # When downloading directly from Mercurial, it will automatically add this prefix
 # Invoking 'hg archive' wont but you can add one with: hg archive -t tgz -p "Reusable-Cluster-Components-" -r $upstreamversion $upstreamversion.tar.gz
-%global specversion 6
+%global specversion 7
 %global upstreamprefix Reusable-Cluster-Components-
 %global upstreamversion 8286b46c91e3
 
@@ -19,7 +19,7 @@ License:	GPLv2+ and LGPLv2+
 Url:		http://linux-ha.org/wiki/Cluster_Glue
 Group:		System Environment/Base
 Source0:	http://hg.linux-ha.org/glue/archive/%{upstreamversion}.tar.bz2
-
+Source1:	logd.service
 # Directives to allow upgrade from combined heartbeat packages in Fedora11
 Provides:	heartbeat-stonith = 3.0.0-1
 Provides:	heartbeat-pils = 3.0.0-1
@@ -30,10 +30,17 @@ Obsoletes:	heartbeat-pils < 3.0.0-1
 
 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
+# Needed for systemd unit
+Requires(post): systemd-sysv
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+
 # Build dependencies
 Requires: perl-TimeDate
 BuildRequires: automake autoconf libtool pkgconfig chrpath libtool-ltdl-devel
 BuildRequires: bzip2-devel glib2-devel python-devel libxml2-devel
+BuildRequires: systemd-units
 
 # For documentation
 BuildRequires: libxslt docbook-style-xsl
@@ -75,6 +82,13 @@ find %{buildroot} -name '*.la' -exec rm {} \;
 rm -f %{buildroot}/%{_libdir}/stonith/plugins/stonith2/rhcs.*
 rm -f %{buildroot}/%{_sbindir}/hb_report
 
+# Nuke sysvinit bits
+rm -rf %{buildroot}%{_sysconfdir}/init.d/
+
+# Install systemd bits
+mkdir -p %{buildroot}%{_unitdir}
+install -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/
+
 %clean
 rm -rf %{buildroot}
 
@@ -86,6 +100,36 @@ such as Pacemaker.
 Provides a local resource manager that understands the OCF and LSB
 standards, and an interface to common STONITH devices.
 
+%post
+if [ $1 -eq 1 ] ; then 
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
+%preun
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable logd.service > /dev/null 2>&1 || :
+    /bin/systemctl stop logd.service > /dev/null 2>&1 || :
+fi
+
+%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart logd.service >/dev/null 2>&1 || :
+fi
+
+%triggerun -- cluster-glue < 1.0.6-7
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply httpd
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save logd >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del logd >/dev/null 2>&1 || :
+/bin/systemctl try-restart logd.service >/dev/null 2>&1 || :
+
 %files
 %defattr(-,root,root)
 %{_sbindir}/ha_logger
@@ -93,7 +137,7 @@ standards, and an interface to common STONITH devices.
 %{_sbindir}/meatclient
 %{_sbindir}/sbd
 %{_sbindir}/stonith
-%{_sysconfdir}/init.d/logd
+%{_unitdir}/logd.service
 
 %dir %{_libdir}/heartbeat
 %dir %{_libdir}/heartbeat/plugins
@@ -195,6 +239,9 @@ such as Pacemaker.
 %doc COPYING.LIB
 
 %changelog
+* Thu Sep 15 2011 Tom Callaway <spot at fedoraproject.org> - 1.0.6-7
+- convert to systemd
+
 * Thu Aug 04 2011 Andrew Beekhof <andrew at beekhof.net> - 1.0.6-6
 - Remove hb_report, people should use crm_report instead
 
diff --git a/logd.service b/logd.service
new file mode 100644
index 0000000..18ebd08
--- /dev/null
+++ b/logd.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=HA Logging Daemon
+After=syslog.target network.target
+
+[Service]
+Type=forking
+PIDFile=/var/run/logd.pid
+ExecStart=/usr/lib64/heartbeat/ha_logd -d
+ExecStop=/usr/lib64/heartbeat/ha_logd -k
+TimeoutSec=1
+
+[Install]
+WantedBy=multi-user.target
+


More information about the scm-commits mailing list