#!/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 abort_conffile_transfer() { local conffile="$1" local lastver="$2" local pkgfrom="$3" local pkgto="$4" if [ "$5" != "--" ]; then echo "abort_conffile_transfer called with the wrong number of arguments" >&2 return 1 fi for _ in $(seq 1 5); do shift done # If we were installing from scratch or upgrading from a new enough version # when the error occurred, then no transfer was in progress and we don't # need to rollback any changes if [ -z "$2" ] || dpkg --compare-versions -- "$2" gt "$lastver"; then return 0 fi # If the conffile was being transferred, return it to its original location if [ -e "$conffile.dpkg-transfer" ]; then mv -f "$conffile.dpkg-transfer" "$conffile" fi # Clean up additional state rm -f "$conffile.dpkg-disappear" } case "$1" in abort-install|abort-upgrade) abort_conffile_transfer \ "/etc/libvirt/virt-login-shell.conf" \ "6.9.0-2~" \ "libvirt-clients" \ "libvirt-login-shell" \ -- \ "$@" ;; remove|purge|upgrade|disappear|failed-upgrade) ;; *) echo "postrm called with unknown argument \`$1'" >&2 exit 1 ;; esac exit 0