preinst is in module-init-tools 3.16-1ubuntu2.
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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | #!/bin/sh -e
# This script can be called in the following ways:
#
# Before the package is installed:
# <new-preinst> install
#
# Before removed package is upgraded:
# <new-preinst> install <old-version>
#
# Before the package is upgraded:
# <new-preinst> upgrade <old-version>
#
#
# If postrm fails during upgrade or fails on failed upgrade:
# <old-preinst> abort-upgrade <new-version>
# Prepare to remove a no-longer used conffile
prep_rm_conffile()
{
CONFFILE="$1"
if [ -e "$CONFFILE" ]; then
md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE '{s/ obsolete$//;s/.* //;p}}\" /var/lib/dpkg/status`"
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
}
# Prepare to move a conffile without triggering a dpkg question
prep_mv_conffile() {
CONFFILE="$1"
if [ -e "$CONFFILE" ]; then
md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE '{s/ obsolete$//;s/.* //;p}}\" /var/lib/dpkg/status`"
if [ "$md5sum" = "$old_md5sum" ]; then
mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
else
mv -f "$CONFFILE" "$CONFFILE".dpkg-moving
fi
fi
}
# Prepare to migrate config to 3.7-style
prep_migrate_config_37()
{
prep_rm_conffile /etc/modprobe.d/aliases
prep_rm_conffile /etc/modprobe.d/isapnp
prep_rm_conffile /etc/modprobe.d/options
prep_rm_conffile /etc/modprobe.d/arch/alpha
prep_rm_conffile /etc/modprobe.d/arch/i386
prep_rm_conffile /etc/modprobe.d/arch/ia64
prep_rm_conffile /etc/modprobe.d/arch/m68k.amiga
prep_rm_conffile /etc/modprobe.d/arch/m68k.atari
prep_rm_conffile /etc/modprobe.d/arch/m68k.generic
prep_rm_conffile /etc/modprobe.d/arch/mips
prep_rm_conffile /etc/modprobe.d/arch/parisc
prep_rm_conffile /etc/modprobe.d/arch/powerpc.apus
prep_rm_conffile /etc/modprobe.d/arch/powerpc.generic
prep_rm_conffile /etc/modprobe.d/arch/powerpc.pmac
prep_rm_conffile /etc/modprobe.d/arch/s390
prep_rm_conffile /etc/modprobe.d/arch/sparc
prep_rm_conffile /etc/modprobe.d/arch/x86_64
if [ -L /etc/modprobe.d/arch-aliases ]; then
rm -f /etc/modprobe.d/arch-aliases
fi
prep_rm_conffile /etc/modprobe.d/blacklist-amd76-edac
prep_mv_conffile /etc/modprobe.d/blacklist \
/etc/modprobe.d/blacklist.conf
prep_mv_conffile /etc/modprobe.d/blacklist-firewire \
/etc/modprobe.d/blacklist-firewire.conf
prep_mv_conffile /etc/modprobe.d/blacklist-framebuffer \
/etc/modprobe.d/blacklist-framebuffer.conf
prep_mv_conffile /etc/modprobe.d/blacklist-watchdog \
/etc/modprobe.d/blacklist-watchdog.conf
prep_mv_conffile /etc/modprobe.d/intel-5300-iwlagn-disable11n \
/etc/modprobe.d/intel-5300-iwlagn-disable11n.conf
}
case "$1" in
install|upgrade)
# Upgrade from intrepid
if dpkg --compare-versions "$2" lt "3.7~pre7-1"; then
prep_migrate_config_37
fi
# Unequivocally drop this conf file. Its got a bogus module parameter.
if dpkg --compare-versions "$2" le-nl "3.12-1ubuntu6"; then
rm -f /etc/modprobe.d/intel-3945-iwlagn-disable11n.conf
fi
;;
abort-upgrade)
;;
*)
echo "$0 called with unknown argument \`$1'" 1>&2
exit 1
;;
esac
# iwlwifi split into 2 drivers as of 2.6.38; iwl3945 and iwlagn
dpkg-maintscript-helper rm_conffile /etc/modprobe.d/intel-5300-iwlagn-disable11n.conf 3.12-1ubuntu4 -- "$@"
# Automatically added by dh_installinit
if [ "$1" = install ] || [ "$1" = upgrade ]; then
if [ -e "/etc/init.d/module-init-tools" ] && [ ! -L "/etc/init.d/module-init-tools" ]; then
if [ "`md5sum \"/etc/init.d/module-init-tools\" | sed -e \"s/ .*//\"`" != \
"`dpkg-query -W -f='${Conffiles}' module-init-tools | sed -n -e \"\\\\' /etc/init.d/module-init-tools '{s/ obsolete$//;s/.* //p}\"`" ]
then
echo "Obsolete conffile /etc/init.d/module-init-tools has been modified by you, renaming to .dpkg-bak"
mv -f "/etc/init.d/module-init-tools" "/etc/init.d/module-init-tools.dpkg-bak"
else
rm -f "/etc/init.d/module-init-tools"
fi
fi
fi
# End automatically added section
exit 0
|