#!/bin/sh set -e # Prepare to remove a no-longer used conffile prep_rm_conffile() { PKGNAME="$1" CONFFILE="$2" if [ -e "$CONFFILE" ]; then md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`" old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`" if [ "$md5sum" != "$old_md5sum" ]; then echo "Obsolete conffile $CONFFILE has been modified by you, renaming to .dpkg-bak" mv -f "$CONFFILE" "$CONFFILE".dpkg-bak else mv -f "$CONFFILE" "$CONFFILE".dpkg-obsolete fi fi } case "$1" in install|upgrade) # if the /etc/dhclient.conf from dhcp-client was modified, # bring it forward to /etc/dhcp3/dhclient.conf, but in a way not # to upset dpkg about a changed conffile if [ ! -e /etc/dhcp3/dhclient.conf ] && [ -e /etc/dhclient.conf ] && \ ! >/dev/null 2>&1 md5sum -c - <<-EOF; then 10830c7543724cfd36f10dd87a5f98eb /etc/dhclient.conf EOF mkdir -p /etc/dhcp3 cp /etc/dhclient.conf /etc/dhcp3/dhclient.conf.oldconfig fi # We renamed debug-enter to debug - handle the transition if [ ! -e /etc/dhcp3/dhclient-enter-hooks.d/debug ] && \ [ -e /etc/dhcp3/dhclient-enter-hooks.d/debug-enter ]; then mv /etc/dhcp3/dhclient-enter-hooks.d/debug-enter \ /etc/dhcp3/dhclient-enter-hooks.d/debug else rm -f /etc/dhcp3/dhclient-enter-hooks.d/debug-enter fi # We renamed debug-exit to debug - handle the transition if [ ! -e /etc/dhcp3/dhclient-exit-hooks.d/debug ] && \ [ -e /etc/dhcp3/dhclient-exit-hooks.d/debug-exit ]; then mv /etc/dhcp3/dhclient-exit-hooks.d/debug-exit \ /etc/dhcp3/dhclient-exit-hooks.d/debug else rm -f /etc/dhcp3/dhclient-exit-hooks.d/debug-exit fi # We moved /etc/dhcp3/dhclient-script to /sbin in 3.0.4-2 if dpkg --compare-versions "$2" lt-nl "3.0.4-2"; then if [ -e /etc/dhcp3/dhclient-script ]; then if >/dev/null 2>&1 md5sum -c - <<-EOF; then 2b18b5c59b26d00aa115716b3da2ed26 /etc/dhcp3/dhclient-script EOF rm -f /etc/dhcp3/dhclient-script fi fi fi if dpkg --compare-versions "$2" lt-nl 3.1.2-1ubuntu7; then prep_rm_conffile dhcp3-client /etc/network/if-pre-up.d/dhclient3-apparmor fi ;; abort-upgrade) ;; *) echo "preinst called with unknown argument \`$1'" >&2 exit 1 ;; esac APP_PROFILE="sbin.dhclient3" APP_CONFFILE="/etc/apparmor.d/$APP_PROFILE" APP_COMPLAIN="/etc/apparmor.d/force-complain/$APP_PROFILE" if [ "$1" = "upgrade" ]; then mkdir -p `dirname $APP_COMPLAIN` 2>/dev/null || true if dpkg --compare-versions $2 lt "3.0.4-12ubuntu4" ; then # force-complain for pre-apparmor upgrades ln -sf $APP_CONFFILE $APP_COMPLAIN fi fi # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. exit 0