[Pkg-libvirt-commits] [libvirt] 10/18: Don't fail chmod/chdir if a file doesn't exist

Guido Guenther agx at moszumanska.debian.org
Sun Sep 28 12:31:47 UTC 2014


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

agx pushed a commit to annotated tag debian/0.9.12.3-1+deb7u1
in repository libvirt.

commit 43817d5570c8c23d440a465ad2ff28b37004106b
Author: Guido Günther <agx at sigxcpu.org>
Date:   Sun Oct 13 21:09:28 2013 +0200

    Don't fail chmod/chdir if a file doesn't exist
    
    We don't use -f since we want to detect other errors (ro media, etc.)
---
 debian/libvirt-bin.postinst | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/debian/libvirt-bin.postinst b/debian/libvirt-bin.postinst
index 510bee7..d427f06 100644
--- a/debian/libvirt-bin.postinst
+++ b/debian/libvirt-bin.postinst
@@ -65,26 +65,26 @@ add_statoverrides()
 
     for dir in ${ROOT_DIRS}; do
         if ! dpkg-statoverride --list "${dir}" >/dev/null 2>&1; then
-            chown root:root "${dir}"
-            chmod 0711 "${dir}"
+            [ ! -e "${dir}" ] || chown root:root "${dir}"
+            [ ! -e "${dir}" ] || chmod 0711 "${dir}"
         fi
     done
 
     for dir in ${QEMU_DIRS}; do
         if ! dpkg-statoverride --list "${dir}" >/dev/null 2>&1; then
-            chown libvirt-qemu:kvm "${dir}"
-            chmod 0750 "${dir}"
+            [ ! -e "${dir}" ] || chown libvirt-qemu:kvm "${dir}"
+            [ ! -e "${dir}" ] || chmod 0750 "${dir}"
         fi
     done
 
     if ! dpkg-statoverride --list "${SANLOCK_DIR}" >/dev/null 2>&1; then
-        chown root:root "${SANLOCK_DIR}"
-        chmod 0700 "${SANLOCK_DIR}"
+        [ ! -e "${dir}" ] || chown root:root "${SANLOCK_DIR}"
+        [ ! -e "${dir}" ] || chmod 0700 "${SANLOCK_DIR}"
     fi
 
     if ! dpkg-statoverride --list "${QEMU_CONF}" >/dev/null 2>&1; then
-        chown root:root "${QEMU_CONF}"
-        chmod 0600 "${QEMU_CONF}"
+        [ ! -e "${dir}" ] || chown root:root "${QEMU_CONF}"
+        [ ! -e "${dir}" ] || chmod 0600 "${QEMU_CONF}"
     fi
 }
 

-- 
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