[Pkg-libvirt-maintainers] Bug#730604: [PATCH 2/2] Rename the .service file back to the upstream name

Laurent Bigonville bigon at debian.org
Tue Feb 25 23:07:39 UTC 2014


Rename libvirt-bin.service file back to the upstream (libvirtd.service)
name.

In the process systemd might become confused, so we need to be sure to
properly stop the libvirtd daemon before trying to restart it again

We also need to take care of removing all reference to
libvirt-bin.service, use the new "purge" verb that has ben introduced in
deb-systemd-helper 1.18.

Closes: #730604
---
 debian/control                                              |  2 +-
 debian/libvirt-bin.postinst                                 | 12 ++++++++++++
 debian/patches/debian/Debianize-systemd-service-files.patch | 11 +----------
 debian/rules                                                |  2 --
 4 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/debian/control b/debian/control
index 348b9f5..2d74337 100644
--- a/debian/control
+++ b/debian/control
@@ -5,7 +5,7 @@ Maintainer: Debian Libvirt Maintainers <pkg-libvirt-maintainers at lists.alioth.deb
 Uploaders: Guido Günther <agx at sigxcpu.org>, Laurent Léonard <laurent at open-minds.org>
 Build-Depends:
  debhelper (>= 7),
- dh-systemd (>= 1.3),
+ dh-systemd (>= 1.18),
  libxml2-dev,
  libncurses5-dev,
  libreadline-dev,
diff --git a/debian/libvirt-bin.postinst b/debian/libvirt-bin.postinst
index b3df139..05c4638 100644
--- a/debian/libvirt-bin.postinst
+++ b/debian/libvirt-bin.postinst
@@ -96,6 +96,18 @@ case "$1" in
         add_users_groups
         add_statoverrides
 
+	# When renaming the .service file, systemd might become confused, we
+	# need to ensure that the libvirtd daemon is fully stopped before
+	# trying to restart it again. (Bug: #730604)
+	if dpkg --compare-versions "$2" le-nl "1.2.1-3~"; then
+	    if [ -d /run/systemd/system ]; then
+	        start-stop-daemon --stop --quiet --pidfile /var/run/libvirtd.pid \
+		    --oknodo --exec /usr/sbin/libvirtd --retry 1
+	    fi
+	    # Remove everything we know about libvirt-bin.service
+	    deb-systemd-helper purge libvirt-bin.service >/dev/null
+	fi
+
 	# Make sure the directories don't get removed on package removal since
 	# logrotate chokes otherwise.
 	for dir in qemu uml lxc; do
diff --git a/debian/patches/debian/Debianize-systemd-service-files.patch b/debian/patches/debian/Debianize-systemd-service-files.patch
index afd078e..c0813a0 100644
--- a/debian/patches/debian/Debianize-systemd-service-files.patch
+++ b/debian/patches/debian/Debianize-systemd-service-files.patch
@@ -7,8 +7,6 @@ Subject: Debianize systemd service files
  tools/libvirt-guests.service.in | 4 ++--
  2 files changed, 4 insertions(+), 4 deletions(-)
 
-diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in
-index dc2433a..3c2a6b8 100644
 --- a/daemon/libvirtd.service.in
 +++ b/daemon/libvirtd.service.in
 @@ -13,8 +13,8 @@ Documentation=man:libvirtd(8)
@@ -22,16 +20,9 @@ index dc2433a..3c2a6b8 100644
  ExecReload=/bin/kill -HUP $MAINPID
  KillMode=process
  Restart=on-failure
-diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in
-index d8d7adf..e743edd 100644
 --- a/tools/libvirt-guests.service.in
 +++ b/tools/libvirt-guests.service.in
-@@ -1,11 +1,11 @@
- [Unit]
- Description=Suspend Active Libvirt Guests
--After=network.target libvirtd.service
-+After=network.target libvirt-bin.service
- Documentation=man:libvirtd(8)
+@@ -5,7 +5,7 @@ Documentation=man:libvirtd(8)
  Documentation=http://libvirt.org
  
  [Service]
diff --git a/debian/rules b/debian/rules
index 72c8af1..427334e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -140,8 +140,6 @@ override_dh_install:
 	    debian/libvirt-bin.libvirt-guests.init
 	cp tools/libvirt-guests.sysconf \
 	    debian/libvirt-bin.libvirt-guests.default
-	-mv debian/libvirt-bin/lib/systemd/system/libvirtd.service \
-	    debian/libvirt-bin/lib/systemd/system/libvirt-bin.service
 
 	for l in $(LOGROTATE); do \
 		cp $(CURDIR)/debian/build/daemon/$$l.logrotate \
-- 
1.9.0



More information about the Pkg-libvirt-maintainers mailing list