| 1 |
#!/bin/sh |
| 2 |
# postinst script for procps |
| 3 |
# |
| 4 |
# see: dh_installdeb(1) |
| 5 |
|
| 6 |
set -e |
| 7 |
|
| 8 |
# summary of how this script can be called: |
| 9 |
# * <postinst> `configure' <most-recently-configured-version> |
| 10 |
# * <old-postinst> `abort-upgrade' <new version> |
| 11 |
# * <conflictor's-postinst> `abort-remove' `in-favour' <package> |
| 12 |
# <new-version> |
| 13 |
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' |
| 14 |
# <failed-install-package> <version> `removing' |
| 15 |
# <conflicting-package> <version> |
| 16 |
# for details, see http://www.debian.org/doc/debian-policy/ or |
| 17 |
# the debian-policy package |
| 18 |
# |
| 19 |
# quoting from the policy: |
| 20 |
# Any necessary prompting should almost always be confined to the |
| 21 |
# post-installation script, and should be protected with a conditional |
| 22 |
# so that unnecessary prompting doesn't happen if a package's |
| 23 |
# installation fails and the `postinst' is called with `abort-upgrade', |
| 24 |
# `abort-remove' or `abort-deconfigure'. |
| 25 |
|
| 26 |
# Move a conffile without triggering a dpkg question |
| 27 |
mv_conffile() { |
| 28 |
OLDCONFFILE="$1" |
| 29 |
NEWCONFFILE="$2" |
| 30 |
|
| 31 |
if [ -e "$OLDCONFFILE" ]; then |
| 32 |
echo "Preserving user changes to $NEWCONFFILE ..." |
| 33 |
mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new |
| 34 |
mv -f "$OLDCONFFILE" "$NEWCONFFILE" |
| 35 |
fi |
| 36 |
} |
| 37 |
|
| 38 |
# update alternative, if it exists |
| 39 |
check_alternatives() { |
| 40 |
BINNAME="$1" |
| 41 |
BINPATH="$2" |
| 42 |
MANSEC="$3" |
| 43 |
if [ -e "$BINPATH"/"$BINNAME".procps ] ; then |
| 44 |
update-alternatives --install "$BINPATH"/"$BINNAME" "$BINNAME" \ |
| 45 |
"$BINPATH"/"$BINNAME".procps 50 \ |
| 46 |
--slave /usr/share/man/man"$MANSEC"/"$BINNAME"."$MANSEC".gz "$BINNAME"."$MANSEC".gz \ |
| 47 |
/usr/share/man/man"$MANSEC"/"$BINNAME".procps."$MANSEC".gz |
| 48 |
fi |
| 49 |
} |
| 50 |
case "$1" in |
| 51 |
configure|abort-remove|abort-deconfigure) |
| 52 |
if [ -e /etc/psdevtab ] ; then |
| 53 |
rm -f /etc/psdevtab |
| 54 |
fi |
| 55 |
if [ -e /etc/psdatabase ] |
| 56 |
then |
| 57 |
rm -f /etc/psdatabase |
| 58 |
fi |
| 59 |
# Remove old procps init.d script, if it exists Closes: #55137 |
| 60 |
if [ -L /etc/rcS.d/S30procps.sh ] |
| 61 |
then |
| 62 |
update-rc.d -f procps.sh remove >/dev/null |
| 63 |
fi |
| 64 |
# and if that didn't work Closes: #92184 (#234306 with -L ) |
| 65 |
if [ -L /etc/rcS.d/S30procps.sh ] |
| 66 |
then |
| 67 |
rm -f /etc/rcS.d/S30procps.sh |
| 68 |
fi |
| 69 |
# Remove moved procps.sh file, if it is there |
| 70 |
if dpkg --compare-versions "$2" le "1:3.2.7-3"; then |
| 71 |
mv_conffile "/etc/init.d/procps.sh" "/etc/init.d/procps" |
| 72 |
fi |
| 73 |
|
| 74 |
# Remove the old w alternative as procps is the only one |
| 75 |
if dpkg --compare-versions "$2" le "2:3.3.17-4"; then |
| 76 |
update-alternatives --remove w /usr/bin/w.procps |
| 77 |
fi |
| 78 |
|
| 79 |
|
| 80 |
# Do alternatives for uptime kill vmstat and ps, if required |
| 81 |
check_alternatives "uptime" "/usr/bin" "1" |
| 82 |
check_alternatives "kill" "/usr/bin" "1" |
| 83 |
check_alternatives "vmstat" "/usr/bin" "8" |
| 84 |
check_alternatives "ps" "/bin" "1" |
| 85 |
|
| 86 |
;; |
| 87 |
|
| 88 |
abort-upgrade) |
| 89 |
# Nothing to do |
| 90 |
;; |
| 91 |
|
| 92 |
*) |
| 93 |
echo "postinst called with unknown argument \`$1'" >&2 |
| 94 |
exit 1 |
| 95 |
;; |
| 96 |
esac |
| 97 |
|
| 98 |
# dh_installdeb will replace this with shell code automatically |
| 99 |
# generated by other debhelper scripts. |
| 100 |
|
| 101 |
#DEBHELPER# |
| 102 |
|
| 103 |
exit 0 |
| 104 |
|
| 105 |
|