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
No related branches found
No related tags found
No related merge requests found
......@@ -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)
;;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment