Skip to content
Snippets Groups Projects
Commit a0832bc1 authored by Guido Günther's avatar Guido Günther
Browse files

Check if the directories exist before removing them

rmdir returns nonzero otherwise and this is more strict than just using
|| true.

Closes: #767672
parent 005dfee9
Branches
Tags
No related merge requests found
...@@ -37,14 +37,15 @@ case "$1" in ...@@ -37,14 +37,15 @@ case "$1" in
rm -rf /var/log/libvirt \ rm -rf /var/log/libvirt \
/var/cache/libvirt/qemu/capabilities /var/cache/libvirt/qemu/capabilities
# Clean up created dirs if emtpy, they contain # Clean up created dirs if existend and emtpy, they contain precious
# precious data otherwise # data otherwise
rmdir --ignore-fail-on-non-empty \ for dir in /var/lib/libvirt/qemu/save \
/var/lib/libvirt/qemu/save \ /var/lib/libvirt/qemu/snapshot \
/var/lib/libvirt/qemu/snapshot \ /var/lib/libvirt/qemu/dump \
/var/lib/libvirt/qemu/dump \ /var/lib/libvirt/qemu \
/var/lib/libvirt/qemu \ /var/cache/libvirt/qemu; do
/var/cache/libvirt/qemu [ ! -d $dir ] || rmdir --ignore-fail-on-non-empty $dir
done
;; ;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;; ;;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment