| Current Path : /var/lib/dpkg/info/ |
| Current File : /var/lib/dpkg/info/initscripts.preinst |
#! /bin/sh
#
# initscripts preinst
#
set -e
# Remove a no-longer used conffile
#
# $1: conffile
#
# If the argument was not listed as a conffile, silently do nothing.
# Adapted from code obtained from http://wiki.debian.org/DpkgConffileHandling
eliminate_conffile() {
PKGNAME="initscripts"
CONFFILE="$1"
if [ -e "$CONFFILE" ]; then
CURRENT_MD5SUM="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
FACTORY_MD5SUM="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
if [ "$CURRENT_MD5SUM" != "$FACTORY_MD5SUM" ]; then
echo "Obsolete conffile $CONFFILE has been modified by you."
echo "Saving as $CONFFILE.dpkg-old ..."
mv -f "$CONFFILE" "$CONFFILE".dpkg-old
else
echo "Removing unmodified and obsolete conffile $CONFFILE ..."
rm -f "$CONFFILE"
fi
fi
}
case "$1" in
install|upgrade)
#
# /etc/init.d/stop-bootlogd used to be a symlink to bootlogd;
# now it is a separate script. We need to remove the symlink here,
# before dpkg installs the /etc/init.d/stop-bootlogd file.
#
[ -L /etc/init.d/stop-bootlogd ] && rm -f /etc/init.d/stop-bootlogd
#
# Remove obsolete conffiles
#
if [ "$2" ] && dpkg --compare-versions "$2" lt "2.86.ds1-10" ; then
eliminate_conffile "/etc/init.d/bootclean.sh"
fi
#
# The /etc/init.d/bootclean script fragment was moved to
# /lib/init/ in version 2.86.ds1-39
#
if [ "$2" ] && dpkg --compare-versions "$2" lt "2.86.ds1-54" ; then
eliminate_conffile "/etc/init.d/bootclean"
fi
#
# Move conflicting log _file_ if present
#
[ -f /var/log/fsck ] && mv -f /var/log/fsck /var/log/fsck.dpkg-old
;;
abort-upgrade)
exit 0
;;
esac
: