[libvirt-qmf] Convert to systemd
Zane Bitter
zaneb at fedoraproject.org
Thu Sep 29 15:58:27 UTC 2011
commit 2822e5c657b1be59bd02ad96c8bd50fb6cb630e9
Author: Zane Bitter <zbitter at redhat.com>
Date: Thu Sep 29 17:20:00 2011 +0200
Convert to systemd
libvirt-qmf.service | 11 ++++++++
libvirt-qmf.spec | 66 +++++++++++++++++++++++++++++++-------------------
2 files changed, 52 insertions(+), 25 deletions(-)
---
diff --git a/libvirt-qmf.service b/libvirt-qmf.service
new file mode 100644
index 0000000..0c42817
--- /dev/null
+++ b/libvirt-qmf.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Matahari libvirt daemon using the AMQP protocol.
+After=syslog.target network.target matahari-broker.service
+Requires=syslog.target network.target
+
+[Service]
+EnvironmentFile=-/etc/sysconfig/matahari
+ExecStart=/usr/sbin/libvirt-qmf $MATAHARI_AGENT_ARGS $libvirt_qmf_AGENT_ARGS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/libvirt-qmf.spec b/libvirt-qmf.spec
index 30a6614..030af33 100644
--- a/libvirt-qmf.spec
+++ b/libvirt-qmf.spec
@@ -1,15 +1,17 @@
-Summary: QPid QMF interface to Libvirt
Name: libvirt-qmf
Version: 0.3.0
-Release: 2%{?dist}
-Source: https://github.com/matahari/libvirt-qmf/downloads/%{name}-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-root
+Release: 3%{?dist}
+Summary: QPid QMF interface to Libvirt
+Source0: https://github.com/matahari/libvirt-qmf/downloads/%{name}-%{version}.tar.gz
+Source1: libvirt-qmf.service
License: LGPLv2+
Group: Applications/System
Obsoletes: libvirt-qpid < 0.3.0
-Requires(post): /sbin/chkconfig
-Requires(preun): /sbin/chkconfig
-Requires(preun): initscripts
+Requires(post): systemd-sysv
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+BuildRequires: systemd-units
BuildRequires: qpid-cpp-client-devel >= 0.10
BuildRequires: libxml2-devel >= 2.7.1
BuildRequires: libvirt-devel >= 0.5.0
@@ -22,7 +24,6 @@ Patch101: err_msgs.patch
Patch102: bz729127-1-init-variables.patch
%description
-
libvirt-qmf provides an interface with libvirt using QMF (Qpid Management
Framework), which utilizes the AMQP protocol. The Advanced Message Queuing
Protocol (AMQP) is an open standard application layer protocol providing
@@ -34,7 +35,6 @@ a set of objects with properties and methods.
%prep
%setup -q
-
%patch100 -p1 -b .domain-prop-init
%patch101 -p1 -b .err_msgs
%patch102 -p1 -b .bz729127
@@ -44,39 +44,55 @@ a set of objects with properties and methods.
make %{?_smp_mflags}
%install
-rm -rf %{buildroot}
-%makeinstall
+make DESTDIR=%{buildroot} install
+mkdir -p %{buildroot}%{_unitdir}
+install -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}
+rm -rf %{buildroot}%{_sysconfdir}/rc.d/init.d/
%post
-/sbin/chkconfig --add libvirt-qmf --level -
-/sbin/service libvirt-qmf condrestart
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
%preun
-if [ $1 = 0 ]; then
- /sbin/service libvirt-qmf stop >/dev/null 2>&1 || :
- chkconfig --del libvirt-qmf
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable libvirt-qmf.service > /dev/null 2>&1 || :
+ /bin/systemctl stop libvirt-qmf.service > /dev/null 2>&1 || :
fi
%postun
-if [ "$1" -ge "1" ]; then
- /sbin/service libvirt-qmf condrestart >/dev/null 2>&1 || :
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ /bin/systemctl try-restart libvirt-qmf.service >/dev/null 2>&1 || :
fi
-%clean
-test "x%{buildroot}" != "x" && rm -rf %{buildroot}
-%files
+%triggerun -- libvirt-qmf < 0.3.0-3
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply libvirt-qmf
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save libvirt-qmf >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del libvirt-qmf >/dev/null 2>&1 || :
+/bin/systemctl try-restart libvirt-qmf.service >/dev/null 2>&1 || :
+
+%files
%defattr(644, root, root, 755)
+%doc AUTHORS COPYING
%dir %{_datadir}/libvirt-qmf/
%{_datadir}/libvirt-qmf/libvirt-schema.xml
-
%attr(755, root, root) %{_sbindir}/libvirt-qmf
-%attr(755, root, root) %{_sysconfdir}/rc.d/init.d/libvirt-qmf
-
-%doc AUTHORS COPYING
+%{_unitdir}/libvirt-qmf.service
%changelog
+* Thu Sep 29 2011 Zane Bitter <zbitter at redhat.com> - 0.3.0-3
+- Convert to systemd
+
* Mon Aug 29 2011 Zane Bitter <zbitter at redhat.com> - 0.3.0-2
- Ensure all Domain properties are initialized immediately
- Correct some erroneous error messages
More information about the scm-commits
mailing list