]> git.donarmstrong.com Git - debian/debian-policy.git/blob - debian/postinst.in
Remove old metadata and file headers
[debian/debian-policy.git] / debian / postinst.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=#PACKAGE#
8
9 # This script is called as the last step of the installation of the
10 # package.  All the package's files are in place, dpkg has already done
11 # its automatic conffile handling, and all the packages we depend of
12 # are already fully installed and configured.
13
14 package_name=#PACKAGE#
15
16 if [ -z "package_name" ]; then
17     print >&2 "Internal Error. Please report a bug."
18     exit 1;
19 fi
20
21 #perl -e 'print readlink("/usr/doc/'$package_name'"), "\n"; '
22 case "$1" in
23   configure)
24     # Configure this package.  If the package must prompt the user for
25     # information, do it here.
26
27     if [ -x /usr/sbin/install-docs ]; then
28         /usr/sbin/install-docs -i /usr/share/doc-base/debian-policy
29         /usr/sbin/install-docs -i /usr/share/doc-base/debian-menu-policy
30         /usr/sbin/install-docs -i /usr/share/doc-base/debian-mime-policy
31         /usr/sbin/install-docs -i /usr/share/doc-base/debian-perl-policy
32         /usr/sbin/install-docs -i /usr/share/doc-base/debian-policy-process
33         /usr/sbin/install-docs -i /usr/share/doc-base/debconf-spec
34         /usr/sbin/install-docs -i /usr/share/doc-base/fhs
35     fi
36
37     # There are three sub-cases:
38     if test "${2+set}" != set; then
39       # We're being installed by an ancient dpkg which doesn't remember
40       # which version was most recently configured, or even whether
41       # there is a most recently configured version.
42       :
43
44     elif test -z "$2" || test "$2" = "<unknown>"; then
45       # The package has not ever been configured on this system, or was
46       # purged since it was last configured.
47       :
48
49     else
50       # Version $2 is the most recently configured version of this
51       # package.
52       :
53
54     fi
55
56     
57     ;;
58   abort-upgrade)
59     # Back out of an attempt to upgrade this package FROM THIS VERSION
60     # to version $2.  Undo the effects of "prerm upgrade $2".
61     :
62
63     ;;
64   abort-remove)
65     if test "$2" != in-favour; then
66       echo "$0: undocumented call to \`postinst $*'" 1>&2
67       exit 0
68     fi
69     # Back out of an attempt to remove this package, which was due to
70     # a conflict with package $3 (version $4).  Undo the effects of
71     # "prerm remove in-favour $3 $4".
72     :
73
74     ;;
75   abort-deconfigure)
76     if test "$2" != in-favour || test "$5" != removing; then
77       echo "$0: undocumented call to \`postinst $*'" 1>&2
78       exit 0
79     fi
80     # Back out of an attempt to deconfigure this package, which was
81     # due to package $6 (version $7) which we depend on being removed
82     # to make way for package $3 (version $4).  Undo the effects of
83     # "prerm deconfigure in-favour $3 $4 removing $6 $7".
84     :
85
86     ;;
87   *) echo "$0: didn't understand being called with \`$1'" 1>&2
88      exit 0;;
89 esac
90
91 exit 0