#!/bin/sh set -e log_debug() { echo "Debug: piuparts exception for package $PIUPARTS_OBJECTS" } case ${PIUPARTS_OBJECTS%%=*} in apt-listbugs) # cleanup from post_install_exceptions log_debug rm -f /usr/sbin/apt-listbugs dpkg-divert --remove --rename /usr/sbin/apt-listbugs ;; file-rc) # removal won't work if sysv-rc isn't reinstalled case "$PIUPARTS_DISTRIBUTION" in lenny) log_debug echo 'Yes, do as I say!' | apt-get -y --force-yes install sysv-rc ;; squeeze*) log_debug yes 'Yes, do as I say!' | apt-get -y --force-yes install sysv-rc ;; esac ;; freebsd-buildutils) case "$PIUPARTS_DISTRIBUTION" in lenny|squeeze) # apt considers original-awk as essential log_debug apt-get -y remove freebsd-buildutils echo 'Yes, do as I say!' | apt-get -y --force-yes remove original-awk esac ;; original-awk) case "$PIUPARTS_DISTRIBUTION" in lenny|squeeze) # apt considers original-awk as essential log_debug echo 'Yes, do as I say!' | apt-get -y --force-yes remove original-awk esac ;; esac case "$PIUPARTS_DISTRIBUTION" in jessie*) # prevent failure of 'apt-get --reinstall install systemd-sysv systemd' # due to spurious dependency cycle (#237470) case ${PIUPARTS_OBJECTS%%=*} in file-rc|\ live-config|\ live-config-upstart|\ upstart) log_debug apt-get -y install systemd-sysv ;; esac ;; esac case "$PIUPARTS_DISTRIBUTION" in lenny*|squeeze*|wheezy*|jessie*) # --allow-remove-essential was added in apt 1.1 (stretch) ;; *) case ${PIUPARTS_OBJECTS%%=*} in init|\ education-thin-client|\ grub-efi-amd64-signed|\ grub-efi-ia32-signed|\ ltsp-client|\ ltsp-client-core|\ ltsp-client-core-dbgsym) log_debug # requires removal of essential packages if [ ! -f /etc/apt/apt.conf.d/piuparts-allow-remove-essential ] then echo "Enabling APT::Get::allow-remove-essential" echo 'APT::Get::allow-remove-essential "true";' >> /etc/apt/apt.conf.d/piuparts-allow-remove-essential fi ;; esac ;; esac # Allow removal of the kernel running on the host from the chroot. UNAME_R="$(uname -r)" echo "linux-image-$UNAME_R linux-image-$UNAME_R/prerm/removing-running-kernel-$UNAME_R boolean false" | debconf-set-selections