[Pkg-libvirt-commits] [libvirt] 02/04: Check if the directories exist before removing them

Guido Guenther agx at moszumanska.debian.org
Mon Nov 17 17:55:04 UTC 2014


This is an automated email from the git hooks/post-receive script.

agx pushed a commit to branch master
in repository libvirt.

commit e4f03cae0afbeb5c684d559d13c9b3d56aa35c30
Author: Guido Günther <agx at sigxcpu.org>
Date:   Sat Nov 1 21:05:48 2014 +0100

    Check if the directories exist before removing them
    
    rmdir returns nonzero otherwise and this is more strict than just using
    || true.
    
    Closes: #767672
---
 debian/libvirt-daemon-system.postrm | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/debian/libvirt-daemon-system.postrm b/debian/libvirt-daemon-system.postrm
index 2499c8a..62d9b4b 100644
--- a/debian/libvirt-daemon-system.postrm
+++ b/debian/libvirt-daemon-system.postrm
@@ -37,14 +37,15 @@ case "$1" in
 	rm -rf /var/log/libvirt \
 	       /var/cache/libvirt/qemu/capabilities
 
-	# Clean up created dirs if emtpy, they contain
-	# precious data otherwise
-	rmdir --ignore-fail-on-non-empty   \
-	    /var/lib/libvirt/qemu/save     \
-	    /var/lib/libvirt/qemu/snapshot \
-	    /var/lib/libvirt/qemu/dump     \
-	    /var/lib/libvirt/qemu          \
-	    /var/cache/libvirt/qemu
+	# Clean up created dirs if existend and emtpy, they contain precious
+	# data otherwise
+	for dir in /var/lib/libvirt/qemu/save     \
+		   /var/lib/libvirt/qemu/snapshot \
+		   /var/lib/libvirt/qemu/dump     \
+		   /var/lib/libvirt/qemu          \
+		   /var/cache/libvirt/qemu; do
+	    [ ! -d $dir ] || rmdir --ignore-fail-on-non-empty $dir
+	done
     ;;
     remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
     ;;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libvirt.git



More information about the Pkg-libvirt-commits mailing list