|
|
@@ -1,4 +1,4 @@
|
|
|
-<!doctype linuxdoc system>
|
|
|
+<!doctype linuxdoc system "./linuxdoc.dtd" >
|
|
|
|
|
|
<!--
|
|
|
Debian Linux dpkg package installation tool.
|
|
|
@@ -24,18 +24,20 @@ from the system administrator's perspective.
|
|
|
<toc>
|
|
|
|
|
|
<!-- Describes the technical interface between a package and dpkg.
|
|
|
-Control file fields and their syntax and semantics. How to use
|
|
|
+How to use
|
|
|
update-rc.d, diversions, update-alternatives, install-info in a
|
|
|
package. How to safely put shared libraries in a package. Details of
|
|
|
-dpkg's handling of individual files. Semantics of virtual packages.
|
|
|
+dpkg's handling of individual files.
|
|
|
Sections on when to use which feature (eg Replaces
|
|
|
vs. Replaces/Conflicts vs. update-alternatives vs. diversions)
|
|
|
Cross-references to the policy document (see below) where appropriate.
|
|
|
Description of the interface between dselect and its access methods.
|
|
|
Hints on where to start with a new package (ie, the hello package).
|
|
|
+What to do about file aliasing.
|
|
|
-->
|
|
|
|
|
|
<sect>Scope of this manual
|
|
|
+<p>
|
|
|
|
|
|
This manual describes the technical aspects of creating Debian binary
|
|
|
packages (<tt/.deb/ files.). It documents the behaviour of the
|
|
|
@@ -72,6 +74,7 @@ example for people wishing to create Debian packages.
|
|
|
<em>Note that this document is not yet complete !</em>
|
|
|
|
|
|
<sect>Binary package format
|
|
|
+<p>
|
|
|
|
|
|
<tt/dpkg/ is a suite of programs for creating binary package files and
|
|
|
installing and removing them on Unix systems.<footnote><tt/dpkg/ is
|
|
|
@@ -101,6 +104,7 @@ as checksums and digital signatures.
|
|
|
|
|
|
|
|
|
<sect1>Creating package files -- <tt/dpkg-deb/
|
|
|
+<p>
|
|
|
|
|
|
All manipulation of binary package files is done by <tt/dpkg-deb/;
|
|
|
it's the only program that has knowledge of the format.
|
|
|
@@ -136,9 +140,9 @@ is installed.
|
|
|
<p>
|
|
|
|
|
|
When you've prepared the package, you should invoke:<!--var-->
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
dpkg --build <it/directory/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
<p>
|
|
|
|
|
|
This will build the package in <var/directory/<tt/.deb/.
|
|
|
@@ -149,12 +153,13 @@ invokes <tt/dpkg-deb/ with the same arguments to build the package.)
|
|
|
See the manpage for <tt/dpkg-deb/ for details of how to examine the
|
|
|
contents of this newly-created file. You may find the output of
|
|
|
following commands enlightening:
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
dpkg-deb --info <var/filename/<tt/.deb/
|
|
|
dpkg-deb --contents <var/filename/<tt/.deb/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
|
|
|
<sect1>Package control information files<label id="controlarea">
|
|
|
+<p>
|
|
|
|
|
|
The control information portion of a binary package is a collection of
|
|
|
files with names known to <tt/dpkg/. It will treat the contents of
|
|
|
@@ -198,6 +203,7 @@ that not necessarily every configuration file should be listed here.
|
|
|
</descrip>
|
|
|
|
|
|
<sect1>The main control information file: <tt/control/<label id="controlfile">
|
|
|
+<p>
|
|
|
|
|
|
The most important control information file used by <tt/dpkg/ when it
|
|
|
installs a package is <tt/control/. It contains all the package's
|
|
|
@@ -269,13 +275,13 @@ indicates that the package is architecture-independent.
|
|
|
<p>
|
|
|
|
|
|
The value for this field can be obtained using
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
dpkg --print-architecture
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
This actually invokes
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
gcc --print-libgcc-file-name
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
and parses and decomposes the output and looks the CPU type from the
|
|
|
GCC configuration in a table in <tt/dpkg/. This is so that it will
|
|
|
work if you're cross-compiling.
|
|
|
@@ -375,11 +381,13 @@ resort.
|
|
|
</descrip>
|
|
|
|
|
|
<sect2>List of other control fields
|
|
|
+<p>
|
|
|
|
|
|
There are several other fields which are used elsewhere by parts of
|
|
|
the system. These should not appear in package control files.
|
|
|
|
|
|
<sect3>Status fields
|
|
|
+<p>
|
|
|
|
|
|
These fields appear in <tt/dpkg/'s internal status file; they are also
|
|
|
printed by <tt/dpkg --status/ and can be seen in <tt/dselect/ by
|
|
|
@@ -411,6 +419,7 @@ emphasise that this field should <em/not/ appear in a package !
|
|
|
</descrip>
|
|
|
|
|
|
<sect4><tt/Packages/ file (available package) fields
|
|
|
+<p>
|
|
|
|
|
|
These fields are found in <tt/Packages/ files (lists of packages
|
|
|
available for installation, which are generated by the distribution
|
|
|
@@ -441,11 +450,12 @@ spaces.
|
|
|
</descrip>
|
|
|
|
|
|
<sect4>Obsolete fields
|
|
|
+<p>
|
|
|
|
|
|
These are still recognised by <tt/dpkg/ but should not appear anywhere
|
|
|
any more.
|
|
|
|
|
|
-<p><descrip>
|
|
|
+<descrip>
|
|
|
|
|
|
<tag><tt/Revision/, <tt/Package-Revision/, <tt/Package_Revision/</tag>
|
|
|
|
|
|
@@ -459,6 +469,7 @@ separate control file field. This field went through several names.
|
|
|
</descrip>
|
|
|
|
|
|
<sect1>Version numbering<label id="versions">
|
|
|
+<p>
|
|
|
|
|
|
Every package has a version number, in its <tt/Version/ control file
|
|
|
field.
|
|
|
@@ -577,6 +588,7 @@ If an upstream package has problematic version numbers they should be
|
|
|
converted to a sane form for use in the <tt/Version/ field.
|
|
|
|
|
|
<sect1>Package maintainer scripts run by <tt/dpkg/<label id="maintainerscripts">
|
|
|
+<p>
|
|
|
|
|
|
It is possible supply scripts as part of a package which <tt/dpkg/
|
|
|
will run for you when your package is installed, upgraded or removed.
|
|
|
@@ -624,18 +636,21 @@ See <ref id="maintscripts-instact"> for details of exactly when and
|
|
|
how these scripts are called and with what arguments.
|
|
|
|
|
|
<sect>Declaring relationships between packages<label id="depconoverwr">
|
|
|
+<p>
|
|
|
|
|
|
Packages can declare in their control file that they have certain
|
|
|
relationships to other packages - for example, that they may not be
|
|
|
installed at the same time as certain other packages, and/or that they
|
|
|
-depend on the presence of others.
|
|
|
+depend on the presence of others, or that they should overwrite files
|
|
|
+in certain other packages if present.
|
|
|
<p>
|
|
|
|
|
|
This is done using the <tt/Depends/, <tt/Recommends/, <tt/Suggests/,
|
|
|
<tt/Conflicts/, <tt/Provides/ and <tt/Replaces/ control file fields.
|
|
|
<p>
|
|
|
|
|
|
-<sect>Syntax of relationship fields
|
|
|
+<sect1>Syntax of relationship fields
|
|
|
+<p>
|
|
|
|
|
|
These fields all have a uniform syntax. They are a list of package
|
|
|
names separated by commas.
|
|
|
@@ -664,8 +679,8 @@ The relations allowed are
|
|
|
for strictly earlier, earlier or equal, exactly equal, later or equal
|
|
|
and strictly later, respectively. The forms <tt/</ and <tt/>/
|
|
|
were used to mean earlier/later or equal, rather than strictly
|
|
|
-earlier/later, and so (while <tt/dpkg/ still supports them) they
|
|
|
-should not appear in new packages.
|
|
|
+earlier/later, so they should not appear in new packages (though
|
|
|
+<tt/dpkg/ still supports them).
|
|
|
<p>
|
|
|
|
|
|
Whitespace may appear at any point in the version specification, and
|
|
|
@@ -677,8 +692,9 @@ put a single space after each comma, on either side of each vertical
|
|
|
bar, and before each open parenthesis.
|
|
|
|
|
|
<sect1>Dependencies - <tt/Depends/, <tt/Recommends/, <tt/Suggests/, <tt/Pre-Depends/
|
|
|
+<p>
|
|
|
|
|
|
-These three fields are used to declare a dependency by one package on
|
|
|
+These four fields are used to declare a dependency by one package on
|
|
|
another. They appear in the depending package's control file.
|
|
|
<p>
|
|
|
|
|
|
@@ -697,6 +713,10 @@ For this reason packages in an installation run are usually all
|
|
|
unpacked first and all configured later; this gives later versions of
|
|
|
packages with dependencies on later versions of other packages the
|
|
|
opportunity to have their dependencies satisfied.
|
|
|
+<p>
|
|
|
+
|
|
|
+Thus <tt/Depends/ allows package maintainers to impose an order in
|
|
|
+which packages should be configured.
|
|
|
|
|
|
<descrip>
|
|
|
<tag/<tt/Depends//
|
|
|
@@ -736,29 +756,267 @@ fields unsatisfied, but they are able to do so by being persistent.
|
|
|
|
|
|
**** WHEN TO USE -- POLICY STATEMENT HERE ?
|
|
|
|
|
|
+<tag/<tt/Suggests//
|
|
|
|
|
|
+This is used to declare that one package may be more useful with one
|
|
|
+or more others.
|
|
|
+<p>
|
|
|
|
|
|
+<tt/dselect/ will offer suggsted packages to the system administrator
|
|
|
+when they select the suggesting package, but the default is not to
|
|
|
+install the suggested package.
|
|
|
|
|
|
-<tt/<tt/Suggests//
|
|
|
-This declares a
|
|
|
+**** WHEN TO USE -- POLICY STATEMENT HERE ?
|
|
|
|
|
|
-**** WRITE THIS
|
|
|
+<tag/<tt/Pre-Depends//
|
|
|
+
|
|
|
+This field is like <tt/Depends/, except that it also forces <tt/dpkg/
|
|
|
+to complete installation of the packages named before even starting
|
|
|
+the installation of the package which declares the predependency.
|
|
|
+<p>
|
|
|
+
|
|
|
+<tt/dselect/ checks for predependencies when it is doing an
|
|
|
+installation run, and will attempt to find the packages which are
|
|
|
+required to be installed first and do so in the right order.
|
|
|
+<p>
|
|
|
+
|
|
|
+However, this process is slow (because it requires repeated
|
|
|
+invocations of <tt/dpkg/) and troublesome (because it requires
|
|
|
+guessing where to find the appropriate files).
|
|
|
+<p>
|
|
|
+
|
|
|
+For these reasons, and because this field imposes restrictions on the
|
|
|
+order in which packages may be unpacked (which can be difficult for
|
|
|
+installations from multipart media, for example), <tt/Pre-Depends/
|
|
|
+should be used sparingly, preferably only by packages whose premature
|
|
|
+upgrade or installation would hamper the ability of the system to
|
|
|
+continue with any upgrade that might be in progress.
|
|
|
+<p>
|
|
|
+
|
|
|
+When the package declaring it is being configured, a
|
|
|
+<tt/Pre-Dependency/ will be considered satisfied only if the depending
|
|
|
+package has been correctly configured, just as if an ordinary
|
|
|
+<tt/Depends/ had been used.
|
|
|
+<p>
|
|
|
+
|
|
|
+However, when a package declaring a predependency is being unpacked
|
|
|
+the predependency can be satisfied even if the depended-on package(s)
|
|
|
+are only unpacked or half-configured, provided that they have been
|
|
|
+configured correctly at some point in the past (and not removed or
|
|
|
+partially removed since). In this case both the previously-configured
|
|
|
+and currently unpacked or half-configured versions must satisfy any
|
|
|
+version clause in the <tt/Pre-Depends/ field.
|
|
|
|
|
|
</descrip>
|
|
|
|
|
|
-<sect1>Alternative packages - <tt/Conflicts/
|
|
|
+<sect2>Deconfiguration due to removal during bulk installations
|
|
|
+<p>
|
|
|
+
|
|
|
+If <tt/dpkg/ would like to remove a package due to a conflict, as
|
|
|
+described above, but this would violate a dependency of some other
|
|
|
+package on the system, <tt/dpkg/ will usually not remove the
|
|
|
+conflicting package and halt with an error.
|
|
|
+<p>
|
|
|
+
|
|
|
+However, if the <tt/--auto-deconfigure/ (<tt/-B/) option is used
|
|
|
+<tt/dpkg/ will automatically `deconfigure' the package with the
|
|
|
+problematic dependency, so that the conflicting package can be removed
|
|
|
+and the package we're trying to install can be installed. If
|
|
|
+<tt/dpkg/ is being asked to install packages (rather than just
|
|
|
+unpacking them) it will try to reconfigure the package when it has
|
|
|
+unpacked all its arguments, in the hope that one of the other packages
|
|
|
+it is installing will satisfy the problematic dependency.
|
|
|
+<p>
|
|
|
+
|
|
|
+<tt/dselect/ supplies this argument to <tt/dpkg/ when it invokes it,
|
|
|
+so that bulk installations proceed smoothly.
|
|
|
+
|
|
|
+<sect1>Alternative packages - <tt/Conflicts/ and <tt/Replaces/<label id="conflicts">
|
|
|
+<p>
|
|
|
+
|
|
|
+When one package declares a conflict with another <tt/dpkg/ will
|
|
|
+refuse to allow them to be installed on the system at the same time.
|
|
|
+<p>
|
|
|
+
|
|
|
+If one package is to be installed, the other must be removed first -
|
|
|
+if the package being installed is marked as replacing (<ref
|
|
|
+id="replaces">) the one on the system, or the one on the system is
|
|
|
+marked as deselected, or both packages are marked <tt/Essential/, then
|
|
|
+<tt/dpkg/ will automatically remove the package which is causing the
|
|
|
+conflict, otherwise it will halt the installation of the new package
|
|
|
+with an error.
|
|
|
+<p>
|
|
|
+
|
|
|
+<tt/dselect/ makes it hard to select conflicting packages, though the
|
|
|
+user can override this if they wish. If they do not override it then
|
|
|
+<tt/dselect/ will select one of the packages for removal, and the user
|
|
|
+must make sure it is the right one. In the future <tt/dselect/ will
|
|
|
+look for the presence of a <tt/Replaces/ field to help decide which
|
|
|
+package should be installed and which removed.
|
|
|
+<p>
|
|
|
+
|
|
|
+A package will not cause a conflict merely because its configuration
|
|
|
+files are still installed; it must be at least half-installed.
|
|
|
+<p>
|
|
|
+
|
|
|
+A special exception is made for packages which declare a conflict with
|
|
|
+their own package name, or with a virtual package which they provide
|
|
|
+(see below): this does not prevent their installation, and allows a
|
|
|
+package to conflict with others providing a replacement for it.
|
|
|
+<p>
|
|
|
+
|
|
|
+A <tt/Conflicts/ entry should almost never have an `earlier than'
|
|
|
+version clause. This would prevent <tt/dpkg/ from upgrading or
|
|
|
+installing the package which declared such a conflict until the
|
|
|
+upgrade or removal of the conflicted-with package had been completed.
|
|
|
+This aspect of installation ordering is not handled by <tt/dselect/,
|
|
|
+so that the use <tt/Conflicts/ in this way is likely to cause problems
|
|
|
+for `bulk run' upgrades and installations.
|
|
|
+<p>
|
|
|
+
|
|
|
|
|
|
-**** WRITE THIS
|
|
|
|
|
|
-<sect1>Virtual packages - <tt/Provides/
|
|
|
+<sect1>Virtual packages - <tt/Provides/<label id="virtual">
|
|
|
+<p>
|
|
|
|
|
|
-**** WRITE THIS
|
|
|
+As well as the names of actual (`concrete') packages, the package
|
|
|
+relationship fields <tt/Depends/, <tt/Recommends/, <tt/Suggests/ and
|
|
|
+<tt/Conflicts/ may mention virtual packages.
|
|
|
+<p>
|
|
|
|
|
|
-<sect1>Overwriting files - <tt/Replaces/<label id="replaces">
|
|
|
+A virtual package is one which appears in the <tt/Provides/ control
|
|
|
+file field of another package. The effect is as if the package(s)
|
|
|
+which provide a particular virtual package name had been listed by
|
|
|
+name everywhere were the virtual package name appears.
|
|
|
+<p>
|
|
|
|
|
|
-**** WRITE THIS
|
|
|
+If there are both a real and a virtual package of the same name then
|
|
|
+the dependency may be satisfied (or the conflict caused) by either the
|
|
|
+real package or any of the virtual packages which provide it. This is
|
|
|
+so that, for example, supposing we have
|
|
|
+<p>
|
|
|
+
|
|
|
+If a dependency or a conflict has a version number attached then only
|
|
|
+real packages will be considered to see whether the relationship is
|
|
|
+satisfied (or prohibited, for a conflict) - it is assumed that a real
|
|
|
+package which provides virtual package is not of the `right' version.
|
|
|
+So, a <tt/Provides/ field may not contain version numbers, and the
|
|
|
+version number of the concrete package which provides a particular
|
|
|
+virtual package will not be looked at when considering a dependency on
|
|
|
+or conflict with the virtual package name.
|
|
|
+<p>
|
|
|
+
|
|
|
+If you want to specify which of a set of real packages should be the
|
|
|
+default to satisfy a particular dependency on a virtual package, you
|
|
|
+should list the real package as alternative before the virtual.
|
|
|
+<p>
|
|
|
+
|
|
|
+<sect1>Defaults for satisfying dependencies - ordering
|
|
|
+<p>
|
|
|
+
|
|
|
+Ordering is significant in dependency fields.
|
|
|
+<p>
|
|
|
+
|
|
|
+Usually dselect will suggest to the user that they select the package
|
|
|
+with the most `fundamental' class (eg, it will prefer Base packages to
|
|
|
+Optional ones), or the one that they `most wanted' to select in some
|
|
|
+sense.
|
|
|
+<p>
|
|
|
+
|
|
|
+However, in the absence of other information <tt/dselect/ will offer a
|
|
|
+default selection of the first named package in a list of
|
|
|
+alternatives.
|
|
|
+<p>
|
|
|
+
|
|
|
+However, there is no way to specify the `order' of several packages
|
|
|
+which all provide the same thing, when that thing is listed as a
|
|
|
+dependency.
|
|
|
+<p>
|
|
|
+
|
|
|
+Therefore a dependency on a virtual package should contain a concrete
|
|
|
+package name as the first alternative, so that this is the default.
|
|
|
+<p>
|
|
|
+
|
|
|
+For example, consider the set of packages:
|
|
|
+
|
|
|
+<example>
|
|
|
+Package: glibcdoc
|
|
|
+Recommends: info-browser
|
|
|
+
|
|
|
+Package: info
|
|
|
+Provides: info-browser
|
|
|
+
|
|
|
+Package: emacs
|
|
|
+Provides: info-browser
|
|
|
+</example>
|
|
|
+
|
|
|
+If <tt/emacs/ and <tt/info/ both have the same priority then
|
|
|
+<tt/dselect/'s choice is essentially random. Better would be
|
|
|
+<example>
|
|
|
+Package: glibcdoc
|
|
|
+Recommends: info | info-browser
|
|
|
+</example>
|
|
|
+so that <tt/dselect/ defaults to selecting the lightweight standalone
|
|
|
+info browser.
|
|
|
+
|
|
|
+<sect1><tt/Replaces/ - overwriting files and replacing packages<label id="replaces">
|
|
|
+<p>
|
|
|
+
|
|
|
+The <tt/Replaces/ control file field has two purposes, which come into
|
|
|
+play in different situations.
|
|
|
+<p>
|
|
|
+
|
|
|
+Virtual packages (<ref id="virtual">) are not considered when looking
|
|
|
+at a <tt/Replaces/ field - the packages declared as being replaced
|
|
|
+must be mentioned by their real names.
|
|
|
+
|
|
|
+<sect2>Overwriting files in other packages
|
|
|
+<p>
|
|
|
+
|
|
|
+Firstly, as mentioned before, it is usually an error for a package to
|
|
|
+contains files which are on the system in another package, though
|
|
|
+currently the <tt/--force-overwrite/ flag is enabled by default,
|
|
|
+downgrading the error to a warning,
|
|
|
+<p>
|
|
|
+
|
|
|
+If the overwriting package declares that it replaces the one
|
|
|
+containing the file being overwritten then <tt/dpkg/ will proceed, and
|
|
|
+replace the file from the old package with that from the new. The
|
|
|
+file will no longer be listed as `owned' by the old package.
|
|
|
+<p>
|
|
|
+
|
|
|
+If a package is completely replaced in this way, so that <tt/dpkg/
|
|
|
+does not know of any files it still contains, it is considered to have
|
|
|
+disappeared. It will be marked as not wanted on the system (selected
|
|
|
+for removal) and not installed. Any conffiles details noted in the
|
|
|
+package will be ignored, as they will have been taken over by the
|
|
|
+replacing package(s). The package's <tt/postrm/ script will be run to
|
|
|
+allow the package to do any final cleanup required.
|
|
|
+See <ref id="maintscripts-instact">.
|
|
|
+<p>
|
|
|
+
|
|
|
+In the future <tt/dpkg/ will discard files which overwrite those from
|
|
|
+another package which declares that it replaces the one being
|
|
|
+installed (so that you can install an older version of a package
|
|
|
+without problems).
|
|
|
+<p>
|
|
|
+
|
|
|
+This usage of <tt/Replaces/ only takes effect when both packages are
|
|
|
+at least partially on the system at once, so that it can only happen
|
|
|
+if they do not conflict or if the conflict has been overridden.
|
|
|
+
|
|
|
+<sect2>Replacing whole packages, forcing their removal
|
|
|
+<p>
|
|
|
+
|
|
|
+Secondly, <tt/Replaces/ allows <tt/dpkg/ and <tt/dselect/ to resolve
|
|
|
+which package should be removed when a conflict - see
|
|
|
+<ref id="conflicts">. This usage only takes effect when the two
|
|
|
+packages <em/do/ conflict, so that the two effects do not interfere
|
|
|
+with each other.
|
|
|
+<p>
|
|
|
|
|
|
<sect>Order of processing steps and maintainer script arguments<label id="maintscripts-instact">
|
|
|
+<p>
|
|
|
|
|
|
<sect1>Summary of ways maintainer scripts are called
|
|
|
<p>
|
|
|
@@ -819,20 +1077,20 @@ the `error unwind' calls listed below.
|
|
|
<item>
|
|
|
If a version the package is already
|
|
|
installed, call
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/old-prerm/ <tt/upgrade/ <var/new-version/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
|
|
|
<item>
|
|
|
If this gives an error (ie, a non-zero exit status), dpkg will
|
|
|
attempt instead:
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/new-prerm/ <tt/failed-upgrade/ <var/old-version/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
Error unwind, for both the above cases:
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/old-postinst/ <tt/abort-upgrade/ <var/new-version/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
|
|
|
</enum>
|
|
|
|
|
|
@@ -843,32 +1101,32 @@ If a `conflicting' package is being removed at the same time:
|
|
|
<item>
|
|
|
If any packages depended on that conflicting package and
|
|
|
<tt/--auto-deconfigure/ is specified, call, for each such package:
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/deconfigured's-prerm/ <tt/deconfigure/
|
|
|
<tt/in-favour/ <var/package-being-installed/ <var/version/
|
|
|
<tt/removing/ <var/conflicting-package/ <var/version/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
Error unwind:
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/deconfigured's-postinst/ <tt/abort-deconfigure/
|
|
|
<tt/in-favour/ <var/package-being-installed-but-failed/ <var/version/
|
|
|
<tt/removing/ <var/conflicting-package/ <var/version/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
The deconfigured packages are marked as requiring configuration, so
|
|
|
that if <tt/--install/ is used they will be configured again if
|
|
|
possible.
|
|
|
|
|
|
<item>
|
|
|
To prepare for removal of the conflicting package, call:
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/conflictor's-prerm/ <tt/remove/
|
|
|
<tt/in-favour/ <var/package/ <var/new-version/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
Error unwind:
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/conflictor's-postinst/ <tt/abort-remove/
|
|
|
<tt/in-favour/ <var/package/ <var/new-version/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
|
|
|
</enum>
|
|
|
|
|
|
@@ -876,28 +1134,28 @@ Error unwind:
|
|
|
<enum>
|
|
|
<item>
|
|
|
If the package is being upgraded, call:
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/new-preinst/ <tt/upgrade/ <var/old-version/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
|
|
|
<item>
|
|
|
Otherwise, if the package had some configuration files from a previous
|
|
|
version installed (ie, it is in the `configuration files only' state):
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/new-preinst/ <tt/install/ <var/old-version/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
|
|
|
<item>
|
|
|
Otherwise (ie, the package was completely purged):
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/new-preinst/ <tt/install/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
Error unwind versions, respectively:
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/new-postrm/ <tt/abort-upgrade/ <var/old-version/
|
|
|
<var/new-postrm/ <tt/abort-install/ <var/old-version/
|
|
|
<var/new-postrm/ <tt/abort-install/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
|
|
|
</enum>
|
|
|
|
|
|
@@ -927,19 +1185,19 @@ and then it is removed again).
|
|
|
<enum>
|
|
|
<item>
|
|
|
If the package is being upgraded, call
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/old-postrm/ <tt/upgrade/ <var/new-version/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
|
|
|
<item>
|
|
|
If this fails, <tt/dpkg/ will attempt:
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/new-postrm/ <tt/failed-upgrade/ <var/old-version/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
Error unwind, for both cases:
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/old-preinst/ <tt/abort-upgrade/ <var/new-version/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
|
|
|
</enum>
|
|
|
|
|
|
@@ -967,18 +1225,19 @@ to have been removed. For each such package,
|
|
|
<enum>
|
|
|
<item>
|
|
|
<tt/dpkg/ calls:
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/disappearer's-postrm/ <tt/disappear/ <var/overwriter/ <var/overwriter-version/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
|
|
|
<item>
|
|
|
The package's maintainer scripts are removed.
|
|
|
|
|
|
<item>
|
|
|
It is noted in the status database as being in a sane state, namely
|
|
|
-not installed (any conffiles it may have are ignored). Note that
|
|
|
-disappearing packages do not have their prerm called, because
|
|
|
-<tt/dpkg/ doesn't know in advance that the package is going to vanish.
|
|
|
+not installed (any conffiles it may have are ignored, rather than
|
|
|
+being removed by <tt/dpkg/). Note that disappearing packages do not
|
|
|
+have their prerm called, because <tt/dpkg/ doesn't know in advance
|
|
|
+that the package is going to vanish.
|
|
|
|
|
|
</enum>
|
|
|
|
|
|
@@ -1010,9 +1269,9 @@ and so do not get removed now).
|
|
|
|
|
|
When we configure a package (this happens with <tt/dpkg --install/, or
|
|
|
with <tt/--configure/), we first update the conffiles and then call:
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/postinst/ <tt/configure/ <var/most-recently-configured-version/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
<p>
|
|
|
|
|
|
No attempt is made to unwind after errors during configuration.
|
|
|
@@ -1029,17 +1288,17 @@ circumstances.
|
|
|
|
|
|
<enum>
|
|
|
<item>
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/prerm/ <tt/remove/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
|
|
|
<item>
|
|
|
The package's files are removed (except conffiles).
|
|
|
|
|
|
<item>
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/postrm/ <tt/remove/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
|
|
|
<item>
|
|
|
All the maintainer scripts except the postrm are removed.
|
|
|
@@ -1054,9 +1313,9 @@ The conffiles and any backup files (<tt/~/-files, <tt/#*#/ files,
|
|
|
<tt/%/-files, <tt/.dpkg-{old,new,tmp}/, etc.) are removed.
|
|
|
|
|
|
<item>
|
|
|
-<tscreen><verb>
|
|
|
+<example>
|
|
|
<var/postrm/ <tt/purge/
|
|
|
-</verb></tscreen>
|
|
|
+</example>
|
|
|
|
|
|
<item>
|
|
|
The package's file list is removed.
|
|
|
@@ -1066,14 +1325,117 @@ The package's file list is removed.
|
|
|
No attempt is made to unwind after errors during removal.
|
|
|
|
|
|
|
|
|
+<sect>Configuration file handling<label id="conffiles">
|
|
|
+
|
|
|
+<tt/dpkg/ can do a certain amount of automatic handling of package
|
|
|
+configuration files.
|
|
|
+<p>
|
|
|
+
|
|
|
+Whether this mechanism is appropriate depends on a number of factors,
|
|
|
+but basically there are two approaches to any particular configuration
|
|
|
+file.
|
|
|
+<p>
|
|
|
+
|
|
|
+The easy method is to ship a best-effort configuration in the package,
|
|
|
+and use <tt/dpkg/'s conffile mechanism to handle updates. If the user
|
|
|
+is unlikely to want to edit the file, but you need them to be able to
|
|
|
+without losing their changes, and a new package with a changed version
|
|
|
+of the file is only released infrequently, this is a good approach.
|
|
|
+<p>
|
|
|
+
|
|
|
+The hard method is to build the configuration file from scratch in the
|
|
|
+<tt/postinst/ script, and to take the responsibility for fixing any
|
|
|
+mistakes made in earlier versions of the package automatically. This
|
|
|
+will be appropriate if the file is likely to need to be different on
|
|
|
+each system.
|
|
|
+
|
|
|
+<sect1>Automatic handling of configuration files by <tt/dpkg/
|
|
|
+<p>
|
|
|
+
|
|
|
+A package may contain a control area file called <tt/conffiles/. This
|
|
|
+file should be a list of filenames of configuration files needing
|
|
|
+automatic handling, separated by newlines. The filenames should be
|
|
|
+absolute pathnames, and the files referred to should actually exist in
|
|
|
+the package.
|
|
|
+<p>
|
|
|
+
|
|
|
+When a package is upgraded, during the configuration state shortly
|
|
|
+before <tt/dpkg/ runs the package's <tt/postinst/ script, it will
|
|
|
+process the configuration files.
|
|
|
+<p>
|
|
|
+
|
|
|
+For each file it checks to see whether the version of the file
|
|
|
+included in the package is the same as the one that was included in
|
|
|
+the last version of the package (the one that is being upgraded
|
|
|
+from); it also compares the version currently installed on the system
|
|
|
+with the one shipped with the last version.
|
|
|
+<p>
|
|
|
+
|
|
|
+If neither the user nor the package maintainer has changed the file,
|
|
|
+it is left alone. If one or the other has changed their version, then
|
|
|
+the changed version is preferred - ie, if the user edits their file,
|
|
|
+but the package maintainer doesn't ship a different version, the
|
|
|
+user's changes will stay, silently, but if the maintainer ships a new
|
|
|
+version and the user hasn't edited it the new version will be
|
|
|
+installed (with an informative message). If both have changed their
|
|
|
+version the user is prompted about the problem and must resolve the
|
|
|
+differences themselves.
|
|
|
+<p>
|
|
|
+
|
|
|
+The comparisons are done by calculating the MD5 message digests of the
|
|
|
+files, and storing the MD5 of the file as it was included in the most
|
|
|
+recent version of the package.
|
|
|
+<p>
|
|
|
+
|
|
|
+When a package is installed for the first time <tt/dpkg/ will install
|
|
|
+the file that comes with it, unless that would mean overwriting a file
|
|
|
+already on the filesystem.
|
|
|
+<p>
|
|
|
+
|
|
|
+However, note that <tt/dpkg/ will <em/not/ replace a conffile file
|
|
|
+that was removed by the user (or by a script). This is necessary
|
|
|
+because for some programs' configuration files a missing file produces
|
|
|
+an effect hard or impossible to achieve in another way, so that a
|
|
|
+missing file needs to be kept that way if the user did it.
|
|
|
+<p>
|
|
|
+
|
|
|
+Note that a package should <em/not/ modify a <tt/dpkg/-handled
|
|
|
+conffile in its maintainer scripts. Doing this will lead to <tt/dpkg/
|
|
|
+asking the user confusing and possibly dangerous questions when the
|
|
|
+package is upgraded.
|
|
|
+
|
|
|
+<sect2>Fully-featured maintainer script configuration handling
|
|
|
+<p>
|
|
|
+
|
|
|
+For files which contain site-specific information such as thep
|
|
|
+hostname and networking details and so forth, it is better to create
|
|
|
+the file in the package's <tt/postinst/ script.
|
|
|
+<p>
|
|
|
+
|
|
|
+This will typically involve examining the state of the rest of the
|
|
|
+system to determine values and other information, and may involve
|
|
|
+prompting the user for some information which can't be obtained some
|
|
|
+other way.
|
|
|
+<p>
|
|
|
+
|
|
|
+When using this method there are a number of important issues which
|
|
|
+should be considered:
|
|
|
+<p>
|
|
|
+
|
|
|
+The package's <tt/postinst/ should be written so that
|
|
|
+
|
|
|
+
|
|
|
<sect>Dangling references
|
|
|
+<p>
|
|
|
|
|
|
<sect1>Would dangle to conffiles<label id="conffiles">
|
|
|
+<p>
|
|
|
|
|
|
There would be a dangling xref here. Instead I've just put this dummy
|
|
|
text in.
|
|
|
|
|
|
<sect1>Would dangle to descriptions<label id="descriptions">
|
|
|
+<p>
|
|
|
|
|
|
There would be a dangling xref here. Instead I've just put this dummy
|
|
|
text in.
|