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
|
#! /bin/bash
# postrm script for tcsh
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
upgrade)
;;
purge|remove|failed-upgrade|abort-install|abort-upgrade|disappear)
rm -f /usr/share/emacs/site-lisp/csh-mode.elc
if [ -L /bin/tcsh ]; then
rm -f /bin/tcsh
fi
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
esac
# Using code from dash.postrm
#
# This is to allow downgrades to csh version 6.24.07-1 and
# earlier which do not use the update-shells trigger of debianutils to manage
# /etc/shells.
#
# update-shells will be called at the end of the downgrade because a trigger of
# debianutils on the removal of /usr/share/debianutils/shells.d/tcsh will be
# activated when downgrading to a version of tcsh that doesn't ship that file.
# But a non-existing /usr/share/debianutils/shells.d/tcsh tells update-shells
# to remove tcsh from /etc/shells.
#
# To prevent this from happening, remove /usr/share/debianutils/shells.d/tcsh
# which will be removed by the downgrade anyways, then run update-shells which
# will remove tcsh from /etc/shells and then add it again by running add-shell.
# Subsequent calls to update-shells in the debianutils trigger will now not
# remove tcsh from /etc/shells anymore because the update-shells call in this
# script updated /var/lib/shells.state with the information that it doesn't
# manage tcsh via update-shells anymore.
if [ "$1" = upgrade ] \
&& dpkg --compare-versions "$2" le 6.24.10-1 \
&& [ -e /usr/share/debianutils/shells.d/tcsh ] \
&& [ -x "$(command -v update-shells 2>/dev/null)" ] \
&& [ -x "$(command -v add-shell 2>/dev/null)" ]; then
rm /usr/share/debianutils/shells.d/tcsh
update-shells
add-shell /usr/bin/tcsh
fi
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
|