1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
#!/bin/sh
set -e
# summary of how this script can be called:
#
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <disappearer's-postrm> `disappear' <overwriter> <overwriter-version>
# * <new-postrm> `failed-upgrade' <old-version> <new-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version> <new-version>
# * <new-postrm> `abort-upgrade' <old-version> <new-version>
#
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
remove)
# Trigger daemon restart after removing a driver
dpkg-trigger libvirt-restart-libvirtd
;;
purge)
if getent passwd libvirt-qemu >/dev/null; then
deluser libvirt-qemu >/dev/null || true
fi
if getent group libvirt-qemu >/dev/null; then
delgroup libvirt-qemu >/dev/null || true
fi
# Clean up cached capabilities
rm -rf /var/cache/libvirt/qemu/capabilities
# Clean up obsolete runtime data
rm -rf /var/lib/libvirt/qemu/channel/target/domain-*
if [ -d /var/lib/libvirt/qemu/channel/target ]; then
rmdir --ignore-fail-on-non-empty /var/lib/libvirt/qemu/channel/target
fi
if [ -d /var/lib/libvirt/qemu/channel ]; then
rmdir --ignore-fail-on-non-empty /var/lib/libvirt/qemu/channel
fi
# Clean up created dirs if existent and empty, 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/nvram \
/var/lib/libvirt/qemu/ram/libvirt/qemu \
/var/lib/libvirt/qemu/ram/libvirt \
/var/lib/libvirt/qemu/ram \
/var/lib/libvirt/qemu \
/var/cache/libvirt/qemu; do
[ ! -d $dir ] || rmdir --ignore-fail-on-non-empty $dir
done
# Obsolete AppArmor stuff included until 9.6.0-1
ABSTRACTIONS_DIR="/etc/apparmor.d/abstractions"
LOCAL_ABSTRACTIONS_DIR="/etc/apparmor.d/local/abstractions"
name="libvirt-qemu"
abstraction="$ABSTRACTIONS_DIR/$name"
local_abstraction="$LOCAL_ABSTRACTIONS_DIR/$name"
if [ ! -e "$abstraction" ]; then
rm -f "$local_abstraction"
if [ -d "$LOCAL_ABSTRACTIONS_DIR" ]; then
rmdir --ignore-fail-on-non-empty "$LOCAL_ABSTRACTIONS_DIR"
fi
fi
;;
upgrade|disappear|failed-upgrade|abort-install|abort-upgrade)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
|