]> git.donarmstrong.com Git - debian/debian-policy.git/blob - debian/prerm.in
Remove old metadata and file headers
[debian/debian-policy.git] / debian / prerm.in
1 #!/bin/sh
2
3 # Abort if any command returns an error value
4 set -e
5
6 # This is filled in by debian/rules
7 package_name=#PACKAGE#
8
9 # This script is called as the first step in removing the package from
10 # the system.  This includes cases where the user explicitly asked for
11 # the package to be removed, upgrade, automatic removal due to conflicts,
12 # and deconfiguration due to temporary removal of a depended-on package.
13
14 case "$1" in
15   remove)
16     # This package about to be removed.
17     :
18     if [ -L /usr/doc/$package_name ]; then
19         rm -f /usr/doc/$package_name
20     fi
21
22     # There are two sub-cases:
23     if test "${2+set}" = set; then
24       if test "$2" != in-favour; then
25         echo "$0: undocumented call to \`prerm $*'" 1>&2
26         exit 0
27       fi
28       # We are being removed because of a conflict with package $3
29       # (version $4), which is now being installed.
30       :
31
32     else
33       # The package is being removed in its own right.
34       :
35
36     fi ;;
37   deconfigure)
38     if test "$2" != in-favour || test "$5" != removing; then
39       echo "$0: undocumented call to \`prerm $*'" 1>&2
40       exit 0
41     fi
42     # Package $6 (version $7) which we depend on is being removed due
43     # to a conflict with package $3 (version $4), and this package is
44     # being deconfigured until $6 can be reinstalled.
45     :
46
47     ;;
48   upgrade)
49     # Prepare to upgrade FROM THIS VERSION of this package to version $2.
50     :
51     if [ -L /usr/doc/$package_name ]; then
52         rm -f /usr/doc/$package_name
53     fi
54
55     ;;
56   failed-upgrade)
57     # Prepare to upgrade from version $2 of this package TO THIS VERSION.
58     # This is only used if the old version's prerm couldn't handle it,
59     # and returned non-zero.  (Fix old prerm bugs here.)
60     :
61
62     ;;
63   *) echo "$0: didn't understand being called with \`$1'" 1>&2
64      exit 0;;
65 esac
66
67
68
69 if [ -x /usr/sbin/install-docs ]; then
70     /usr/sbin/install-docs -r debian-policy
71     /usr/sbin/install-docs -r debian-menu-policy
72     /usr/sbin/install-docs -r debian-mime-policy
73     /usr/sbin/install-docs -r debian-perl-policy
74     /usr/sbin/install-docs -r debian-policy-process
75     /usr/sbin/install-docs -r debconf-spec
76     /usr/sbin/install-docs -r fhs
77 fi
78
79 exit 0