File: postrm

package info (click to toggle)
tcsh 6.24.13-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,928 kB
  • sloc: ansic: 52,661; sh: 4,107; csh: 1,129; lisp: 669; makefile: 460; perl: 56; python: 23
file content (74 lines) | stat: -rw-r--r-- 2,389 bytes parent folder | download | duplicates (2)
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