#!/bin/sh set -e # summary of how this script can be called: # # * `remove' # * `purge' # * `upgrade' # * `disappear' # * `failed-upgrade' # * `abort-install' # * `abort-install' # * `abort-upgrade' # # for details, see https://www.debian.org/doc/debian-policy/ or # the debian-policy package delete_protective_diversion() { local usrfile="$1" local firstver="$2" if [ "$3" != "--" ]; then echo "delete_protective_diversion called with the wrong number of arguments" >&2 return 1 fi for _ in $(seq 1 3); do shift done # If the diversion doesn't exist there's nothing to clean up if [ -z "$(dpkg-divert --list "$usrfile")" ]; then return 0 fi dpkg-divert \ --no-rename \ --divert "$usrfile.usr-is-merged" \ --remove "$usrfile" } DAEMON_COMMON_UNITS=" libvirt-guests.service virt-guest-shutdown.target " case "$1" in purge) if getent group libvirt >/dev/null; then delgroup libvirt >/dev/null || true fi # Clean up logs rm -rf /var/log/libvirt ;; failed-upgrade|abort-install|abort-upgrade) for unit in $DAEMON_COMMON_UNITS; do delete_protective_diversion \ "/lib/systemd/system/$unit" \ "10.6.0-3~" \ -- \ "$@" done ;; remove|upgrade|disappear) ;; *) echo "postrm called with unknown argument \`$1'" >&2 exit 1 ;; esac # Automatically added by dh_installinit/13.24.2 if [ "$1" = "remove" ] && [ -x "/etc/init.d/libvirt-guests" ] ; then chmod -x "/etc/init.d/libvirt-guests" >/dev/null || true fi if [ -z "$DPKG_ROOT" ] && [ "$1" = "purge" ] ; then update-rc.d libvirt-guests remove >/dev/null fi # End automatically added section # Automatically added by dh_installsystemd/13.24.2 if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then systemctl --system daemon-reload >/dev/null || true fi # End automatically added section # Automatically added by dh_installsystemd/13.24.2 if [ "$1" = "purge" ]; then if [ -x "/usr/bin/deb-systemd-helper" ]; then deb-systemd-helper purge 'libvirt-guests.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_apparmor/4.1.0-1 if [ "$1" = "purge" ] && ! [ -e "/etc/apparmor.d/usr.lib.libvirt.virt-aa-helper" ] ; then rm -f "/etc/apparmor.d/disable/usr.lib.libvirt.virt-aa-helper" || true rm -f "/etc/apparmor.d/force-complain/usr.lib.libvirt.virt-aa-helper" || true rm -f "/etc/apparmor.d/local/usr.lib.libvirt.virt-aa-helper" || true rm -f /var/cache/apparmor/*/"usr.lib.libvirt.virt-aa-helper" || true rmdir /etc/apparmor.d/disable 2>/dev/null || true rmdir /etc/apparmor.d/local 2>/dev/null || true rmdir /etc/apparmor.d 2>/dev/null || true fi # End automatically added section exit 0