#!/bin/sh set -e PACKAGE="schroot" # Remove a conffile which has been forgotten by dpkg # If the file does not exist, or is owned by any package, do not remove it. rm_conffile() { local CONFFILE delete CONFFILE="$1" delete="false" if [ -f "$CONFFILE" ]; then local fpkg pkg fpkg="" pkg="" if fpkg=$(dpkg -S "$CONFFILE" 2>/dev/null); then # Don't delete, but check which package it came from. pkg=$(echo "$fpkg" | sed -e 's/\(^[[:print:]][[:print:]]*\): .*$/\1/') if [ "$pkg" = "$PACKAGE" ]; then delete="true" fi else rm -f "$CONFFILE" delete="true" fi else delete="true" fi # Remove dpkg cruft if [ "$delete" = "true" ]; then rm -f "${CONFFILE}.dpkg-old" rm -f "${CONFFILE}.dpkg-new" rm -f "${CONFFILE}.dpkg-dist" fi } case "$1" in upgrade | failed-upgrade | abort-install | abort-upgrade) ;; remove) # These are directories left over from old sessions. We don't # remove recursively to guard against purging any user data which # may inadvertently be remaining mounted under the session # directories, so just try a simple rmdir for safety. for dir in $(find /var/lib/schroot/mount -maxdepth 1 -type d | tac); do rmdir "$dir" || echo "Failed to remove session mount directory $dir: Please check for any stray mounts or data under this directory and remove by hand." >&2 done ;; purge | disappear) ;; *) echo "postrm called with unknown argument \`$1'" >&2 exit 0 ;; esac # Automatically added by dh_installinit/13.11.8 if [ "$1" = "remove" ] && [ -x "/etc/init.d/schroot" ] ; then chmod -x "/etc/init.d/schroot" >/dev/null || true fi if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = "purge" ] ; then update-rc.d schroot remove >/dev/null fi # End automatically added section # Automatically added by dh_installsystemd/13.11.8 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.11.8 if [ "$1" = "purge" ]; then if [ -x "/usr/bin/deb-systemd-helper" ]; then deb-systemd-helper purge 'schroot.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installdebconf/13.11.8 if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then . /usr/share/debconf/confmodule db_purge fi # End automatically added section exit 0