preinst is in initscripts 2.88dsf-13.10ubuntu11.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | #! /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
}
# Compares a file to the "factory md5sum", and if it matches, removes it.
# This is useful for when converting from to a conffile *and* changing
# its contents at the same time.
convert_to_conffile() {
CONFFILE="$1"
FACTORY_MD5SUM="$2"
if [ -e "$CONFFILE" ]; then
CURRENT_MD5SUM="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
if [ "$CURRENT_MD5SUM" = "$FACTORY_MD5SUM" ]; then
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
#
# Removed as we switched to Upstart
#
if [ "$2" ] && dpkg --compare-versions "$2" lt "2.87dsf-4ubuntu6"; then
eliminate_conffile "/etc/network/if-up.d/mountnfs"
eliminate_conffile "/etc/init.d/bootlogs"
eliminate_conffile "/etc/init.d/checkfs.sh"
eliminate_conffile "/etc/init.d/checkroot.sh"
eliminate_conffile "/etc/init.d/mountkernfs.sh"
eliminate_conffile "/etc/init.d/hostname.sh"
eliminate_conffile "/etc/init.d/bootmisc.sh"
eliminate_conffile "/etc/init.d/mountall.sh"
eliminate_conffile "/etc/init.d/mountdevsubfs.sh"
eliminate_conffile "/etc/init.d/rmnologin"
eliminate_conffile "/etc/init.d/mtab.sh"
eliminate_conffile "/etc/init.d/mountoverflowtmp"
eliminate_conffile "/etc/init.d/mountnfs.sh"
eliminate_conffile "/etc/init.d/mountnfs-bootclean.sh"
eliminate_conffile "/etc/init.d/mountall-bootclean.sh"
fi
#
# A final straggler from the upstart conversion
#
if [ "$2" ] && dpkg --compare-versions "$2" lt 2.88dsf-13.10ubuntu1
then
eliminate_conffile "/etc/default/tmpfs"
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
:
|