Debian Codegraph @

debian/postinst

raw symbols SCIP
1 #! /bin/sh
2 # -*- Mode: Sh -*-
3 # postinst ---
4 # Author : Manoj Srivastava ( [email protected] )
5 # Created On : Fri Nov 14 11:25:07 2003
6 # Created On Node : glaurung.green-gryphon.com
7 # Last Modified By : Neil Roeth ([email protected])
8 # Last Modified On : Saturday, May 23, 2009
9 # Status : Unknown, Use with caution!
10 # HISTORY :
11 # Description :
12 #
13 # This program is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of the License, or
16 # (at your option) any later version.
17 #
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #
27 #
28
29 # Abort if any command returns an error value
30 set -e
31
32 package_name=psgml
33
34 if [ -z "$package_name" ]; then
35 print >&2 "Internal Error. Please report a bug."
36 exit 1;
37 fi
38
39 # This script is called as the last step of the installation of the
40 # package. All the package's files are in place, dpkg has already done
41 # its automatic conffile handling, and all the packages we depend of
42 # are already fully installed and configured.
43 # summary of how this script can be called:
44 # * <postinst> `configure' <most-recently-configured-version>
45 # * <old-postinst> `abort-upgrade' <new version>
46 # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
47 # <new-version>
48 # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
49 # <failed-install-package> <version> `removing'
50 # <conflicting-package> <version>
51 # for details, see http://www.debian.org/doc/debian-policy/ or
52 # the debian-policy package
53 #
54 # quoting from the policy:
55 # Any necessary prompting should almost always be confined to the
56 # post-installation script, and should be protected with a conditional
57 # so that unnecessary prompting doesn't happen if a package's
58 # installation fails and the `postinst' is called with `abort-upgrade',
59 # `abort-remove' or `abort-deconfigure'.
60
61 case "$1" in
62 configure)
63 # Configure this package. If the package must prompt the user for
64 # information, do it here.
65
66
67 # Tell ucf that the file in /usr/share/foo is the latest
68 # maintainer version, and let it handle how to manage the real
69 # confuguration file in /etc. This is how a static configuration
70 # file can be handled:
71 ##:if which ucf >/dev/null 2>&1; then
72 ##: ucf /usr/share/${package_name}/configuration /etc/${package_name}.conf
73 ##:fi
74
75 ### We could also do this on the fly. The following is from Tore
76 ### Anderson:
77
78 #. /usr/share/debconf/confmodule
79
80 ### find out what the user answered.
81 # db_get foo/run_on_boot
82 # run_on_boot=$RET
83 # db_stop
84
85 ### safely create a temporary file to generate our suggested
86 ### configuration file.
87 # tempfile=`tempfile`
88 # cat << _eof > $tempfile
89 ### Configuration file for Foo.
90
91 ### this was answered by you, the user in a debconf dialogue
92 # RUNONBOOT=$run_on_boot
93
94 ### this was not, as it has a sane default value.
95 # COLOUROFSKY=blue
96
97 #_eof
98
99 ### Note that some versions of debconf do not release stdin, so
100 ### the following invocation of ucf may not work, since the stdin
101 ### is never coneected to ucfr.
102
103 ### now, invoke ucf, which will take care of the rest, and ask
104 ### the user if he wants to update his file, if it is modified.
105 #ucf $tempfile /etc/foo.conf
106
107 ### done! now we'll just clear up our cruft.
108 #rm -f $tempfile
109
110
111
112 # There are three sub-cases:
113 if test "${2+set}" != set; then
114 # We're being installed by an ancient dpkg which doesn't remember
115 # which version was most recently configured, or even whether
116 # there is a most recently configured version.
117 :
118
119 elif test -z "$2" || test "$2" = "<unknown>"; then
120 # The package has not ever been configured on this system, or was
121 # purged since it was last configured.
122 :
123
124 else
125 # Version $2 is the most recently configured version of this
126 # package.
127 :
128
129 fi
130
131 # Install emacs lisp files
132 if [ -x /usr/lib/emacsen-common/emacs-package-install ]; then
133 /usr/lib/emacsen-common/emacs-package-install --postinst $package_name
134 fi
135
136 ;;
137 abort-upgrade)
138 # Back out of an attempt to upgrade this package FROM THIS VERSION
139 # to version $2. Undo the effects of "prerm upgrade $2".
140 :
141
142 ;;
143 abort-remove)
144 if test "$2" != in-favour; then
145 echo "$0: undocumented call to \`postinst $*'" 1>&2
146 exit 0
147 fi
148 # Back out of an attempt to remove this package, which was due to
149 # a conflict with package $3 (version $4). Undo the effects of
150 # "prerm remove in-favour $3 $4".
151 :
152
153 ;;
154 abort-deconfigure)
155 if test "$2" != in-favour || test "$5" != removing; then
156 echo "$0: undocumented call to \`postinst $*'" 1>&2
157 exit 0
158 fi
159 # Back out of an attempt to deconfigure this package, which was
160 # due to package $6 (version $7) which we depend on being removed
161 # to make way for package $3 (version $4). Undo the effects of
162 # "prerm deconfigure in-favour $3 $4 removing $6 $7".
163 :
164
165 ;;
166 *) echo "$0: didn't understand being called with \`$1'" 1>&2
167 exit 0;;
168 esac
169
170 exit 0