postinst is in kexec-tools 1:2.0.10-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 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | #! /bin/sh
# postinst script for kexec-tools
#
# see: dh_installdeb(1)
set -e
update_param() {
eval old=\"'$'$1\"
eval new=\"'$'new_$1\"
if test "$old" = "$new"; then
return
fi
if test -z "$old"; then
grep -Eq "^ *$1=" "$INITCONFFILE" || echo "$1=" \
>> "$INITCONFFILE"
fi
sed -e "s/^ *$1=.*/$1=$new/" < $INITCONFFILE > $INITCONFFILE.$$
mv -f $INITCONFFILE.$$ $INITCONFFILE
}
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
case "$1" in
configure)
if [ -L /etc/rc6.d/K39kexec-load ]; then
# remove this old entry, we'll add correct one below
update-rc.d -f kexec-load remove > /dev/null || exit 0
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
exit 0
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# Handle debconf
. /usr/share/debconf/confmodule
INITCONFFILE=/etc/default/kexec
# We generate several files during the postinst, and we don't want
# them to be readable only by root.
umask 022
# Generate configuration file if it does not exist, using default values.
[ -r "${INITCONFFILE}" ] || {
echo Generating ${INITCONFFILE}... >&2
cat >${INITCONFFILE} <<'EOFMAGICNUMBER1234'
# Defaults for kexec initscript
# sourced by /etc/init.d/kexec and /etc/init.d/kexec-load
# Load a kexec kernel (true/false)
LOAD_KEXEC=false
# Kernel and initrd image
KERNEL_IMAGE="/vmlinuz"
INITRD="/initrd.img"
# If empty, use current /proc/cmdline
APPEND=""
# Load the default kernel from grub config (true/false)
USE_GRUB_CONFIG=false
EOFMAGICNUMBER1234
}
# Add USE_GRUB_CONFIG parameter to config file if it does not exist
. ${INITCONFFILE}
if test -z "$USE_GRUB_CONFIG" ; then
echo "" >> ${INITCONFFILE}
echo "# Load the default kernel from grub config (true/false)" >> ${INITCONFFILE}
echo "USE_GRUB_CONFIG=" >> ${INITCONFFILE}
fi
# Detect if system is configured to place kernel link under /boot instead of /
# If yes, update kernel and initrd image locations in config file
if [ -f /etc/kernel-img.conf ]; then
LINK_IN_BOOT=`grep link_in_boot /etc/kernel-img.conf | cut -f2 -d= | tr -d '[:blank:]'`
if [ "$LINK_IN_BOOT" = "yes" ]; then
sed -e "s/KERNEL_IMAGE=\"\/vmlinuz\"/KERNEL_IMAGE=\"\/boot\/vmlinuz\"/" < ${INITCONFFILE} > ${INITCONFFILE}.$$
mv -f ${INITCONFFILE}.$$ $INITCONFFILE
sed -e "s/INITRD=\"\/initrd.img\"/INITRD=\"\/boot\/initrd.img\"/" < ${INITCONFFILE} > ${INITCONFFILE}.$$
mv -f ${INITCONFFILE}.$$ $INITCONFFILE
else
sed -e "s/KERNEL_IMAGE=\"\/boot\/vmlinuz\"/KERNEL_IMAGE=\"\/vmlinuz\"/" < ${INITCONFFILE} > ${INITCONFFILE}.$$
mv -f ${INITCONFFILE}.$$ $INITCONFFILE
sed -e "s/INITRD=\"\/boot\/initrd.img\"/INITRD=\"\/initrd.img\"/" < ${INITCONFFILE} > ${INITCONFFILE}.$$
mv -f ${INITCONFFILE}.$$ $INITCONFFILE
fi
fi
# Determine if vmlinux is actually used and adjust INITCONFFILE
if [ -f /boot/vmlinux -o -f /vmlinux ]; then
sed -e "s/vmlinuz/vmlinux/" -i ${INITCONFFILE}
fi
# ------------------------- Debconf questions start ---------------------
db_get kexec-tools/load_kexec || RET=false
new_LOAD_KEXEC="${RET}"
update_param LOAD_KEXEC
if [ -d /boot/grub ]
then
db_get kexec-tools/use_grub_config || RET=true
new_USE_GRUB_CONFIG="${RET}"
else
new_USE_GRUB_CONFIG="false"
db_set kexec-tools/use_grub_config "false"
fi
update_param USE_GRUB_CONFIG
# ------------------------- Debconf questions end ---------------------
# no triggers in grub2,
# see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=481542
if [ -x /usr/sbin/update-grub ] && [ -e /boot/grub/grub.cfg ]; then
update-grub
fi
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
if [ -x "/etc/init.d/kexec" ]; then
update-rc.d kexec defaults >/dev/null
fi
if [ -x "/etc/init.d/kexec" ] || [ -e "/etc/init/kexec.conf" ]; then
invoke-rc.d kexec start || exit $?
fi
fi
# End automatically added section
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
if [ -x "/etc/init.d/kexec-load" ]; then
update-rc.d kexec-load defaults >/dev/null
fi
if [ -x "/etc/init.d/kexec-load" ] || [ -e "/etc/init/kexec-load.conf" ]; then
invoke-rc.d kexec-load start || exit $?
fi
fi
# End automatically added section
exit 0
|