postinst is in sysv-rc 2.88dsf-59.3ubuntu2.
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 | #!/bin/sh
set -e
now=`date +%Y%m%dT%H%M`
logdir=/var/lib/insserv
logfile="$logdir/run-$now.log"
# Make sure insserv is in path
PATH=/usr/lib/insserv:/sbin:$PATH
# Based on code from dash postinst
check_divert() {
package=insserv
div=$(dpkg-divert --list $2)
distrib=${4:-$2.distrib}
case "$1" in
false)
if [ -n "$div" ] && [ -z "${div%%*by $package}" ]; then
mv $distrib $2
dpkg-divert --package $package --remove $2
fi
;;
status) # Return true if the divert is in effect
if [ -n "$div" ] && [ -z "${div%%*by $package}" ]; then
:
else
false
fi
esac
}
convert_rc_s_to_k() {
runlevel=$1
for link in $(cd $target/etc/rc$runlevel.d; ls S* || true); do
set `echo $link|sed "s%S\(..\)\(.*\)%\1 \2%"`
seq=$1
service=$2
mv $target/etc/rc$runlevel.d/$link $target/etc/rc$runlevel.d/K$seq$service
done
}
legacy_bootordering() {
for f in /etc/rc0.d/S* ; do
if [ -f $f ] ; then
return 0
fi
done
return 1
}
activate_insserv() {
echo "info: Reordering boot system, log to $logfile" 1>&2
(
echo "info: Converting rc0.d/S* and rc6.d/S* to K*." 1>&2
convert_rc_s_to_k 0
convert_rc_s_to_k 6
echo "info: running insserv" 1>&2
insserv -v
) > $logfile 2>&1 || return 1
return 0
}
case "$1" in
configure)
if check_divert status /usr/sbin/update-rc.d \
/usr/sbin/update-rc.d-insserv ; then
check_divert false /usr/sbin/update-rc.d \
/usr/sbin/update-rc.d-insserv
fi
if dpkg --compare-versions "$2" lt "2.88dsf-41ubuntu13"; then
rm -f /etc/init.d/.legacy-bootordering
fi
if legacy_bootordering ; then
# Still using legacy ordering, try to convert
if activate_insserv ; then
echo "success: Enabled dependency based boot system." 1>&2
else
echo "error: Something failed while migrating." 1>&2
cat 1>&2 <<EOF
error: Unable to migrate to dependency based boot sequencing.
See http://wiki.debian.org/LSBInitScripts/DependencyBasedBoot for
more information about dependency based boot sequencing. To
reattempt the migration process run 'dpkg --configure sysv-rc'.
EOF
exit 1;
fi
fi
;;
*)
;;
esac
|