man-pages/man1/dpkg-divert.1.html
2021-03-31 01:06:50 +01:00

275 lines
8.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of dpkg-divert</TITLE>
</HEAD><BODY>
<H1>dpkg-divert</H1>
Section: dpkg suite (1)<BR>Updated: 2020-03-23<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
dpkg-divert - override a package's version of a file
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>dpkg-divert</B>
[<I>option</I>...]
<I>command</I>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>dpkg-divert</B>
is the utility used to set up and update the list of diversions.
<P>
File <I>diversions</I> are a way of forcing
<B><A HREF="/cgi-bin/man/man2html?1+dpkg">dpkg</A></B>(1)
not to install a file into its
location, but to a <I>diverted</I> location. Diversions can be used through the
Debian package scripts to move a file away when it causes a conflict. System
administrators can also use it to override some package's configuration file,
or whenever some files (which aren't marked as "conffiles") need to be
preserved by <B>dpkg</B>, when installing a newer version of a package which
contains those files.
<P>
<A NAME="lbAE">&nbsp;</A>
<H2>COMMANDS</H2>
<DL COMPACT>
<DT id="1">[<B>--add</B>] <I>file</I>
<DD>
Add a diversion for <I>file</I>.
The file is currently not renamed, see <B>--rename</B>.
<DT id="2"><B>--remove</B><I> file</I>
<DD>
Remove a diversion for <I>file</I>.
The file is currently not renamed, see <B>--rename</B>.
<DT id="3"><B>--list</B><I> glob-pattern</I>
<DD>
List diversions matching <I>glob-pattern</I>.
<DT id="4"><B>--listpackage</B><I> file</I>
<DD>
Print the name of the package that diverts <I>file</I> (since dpkg 1.15.0).
Prints LOCAL if
<I>file</I> is locally diverted and nothing if <I>file</I> is not diverted.
<DT id="5"><B>--truename</B><I> file</I>
<DD>
Print the real name for a diverted file.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="6"><B>--admindir</B><I> directory</I>
<DD>
Set the administrative directory to <I>directory</I>.
Defaults to &laquo;<I>/var/lib/dpkg</I>&raquo;.
<DT id="7"><B>--instdir</B><I> directory</I>
<DD>
Set the installation directory, which refers to the directory where
packages get installed (since dpkg 1.19.2). Defaults to &laquo;<I>/</I>&raquo;.
<DT id="8"><B>--root</B><I> directory</I>
<DD>
Set the root directory to <B>directory</B>, which sets the installation
directory to &laquo;<I>directory</I>&raquo; and the administrative
directory to &laquo;<I>directory</I><B>/var/lib/dpkg</B>&raquo; (since dpkg 1.19.2).
<DT id="9"><B>--divert</B><I> divert-to</I>
<DD>
<I>divert-to</I> is the location where the versions of <I>file</I>, as
provided by other packages, will be diverted.
<DT id="10"><B>--local</B>
<DD>
Specifies that all packages' versions of this file are diverted.
This means, that there are no exceptions, and whatever package is installed,
the file is diverted. This can be used by an admin to install a locally
modified version.
<DT id="11"><B>--package</B><I> package</I>
<DD>
<I>package</I> is the name of a package whose copy of <I>file</I> will not
be diverted. i.e. <I>file</I> will be diverted for all packages except
<I>package</I>.
<DT id="12"><B>--quiet</B>
<DD>
Quiet mode, i.e. no verbose output.
<DT id="13"><B>--rename</B>
<DD>
Actually move the file aside (or back). <B>dpkg-divert</B> will abort operation
in case the destination file already exists.
This is the common behavior used for diversions of files from the
non-<B>Essential</B> package set (see <B>--no-rename</B> for more details).
<DT id="14"><B>--no-rename</B>
<DD>
Specifies that the file should not be renamed while adding or removing the
diversion into the database (since dpkg 1.19.1).
This is intended for diversions of files from the <B>Essential</B> package set,
where the temporary disappearance of the original file is not acceptable, as
it can render the system non-functional.
This is the default behavior, but that will change in the dpkg 1.20.x cycle.
<DT id="15"><B>--test</B>
<DD>
Test mode, i.e. don't actually perform any changes, just demonstrate.
<DT id="16"><B>-?</B>, <B>--help</B>
<DD>
Show the usage message and exit.
<DT id="17"><B>--version</B>
<DD>
Show the version and exit.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>EXIT STATUS</H2>
<DL COMPACT>
<DT id="18"><B>0</B>
<DD>
The requested action was successfully performed.
<DT id="19"><B>2</B>
<DD>
Fatal or unrecoverable error due to invalid command-line usage, or
interactions with the system, such as accesses to the database,
memory allocations, etc.
</DL>
<A NAME="lbAH">&nbsp;</A>
<H2>ENVIRONMENT</H2>
<DL COMPACT>
<DT id="20"><B>DPKG_ROOT</B>
<DD>
If set and the <B>--instdir</B> or <B>--root</B> options have not been
specified, it will be used as the filesystem root directory
(since dpkg 1.19.2).
<DT id="21"><B>DPKG_ADMINDIR</B>
<DD>
If set and the <B>--admindir</B> or <B>--root</B> options have not been
specified, it will be used as the <B>dpkg</B> data directory.
<DT id="22"><B>DPKG_MAINTSCRIPT_PACKAGE</B>
<DD>
If set and the <B>--local</B> and <B>--package</B> options have not been
specified, <B>dpkg-divert</B> will use it as the package name.
<DT id="23"><B>DPKG_COLORS</B>
<DD>
Sets the color mode (since dpkg 1.18.5).
The currently accepted values are: <B>auto</B> (default), <B>always</B> and
<B>never</B>.
</DL>
<A NAME="lbAI">&nbsp;</A>
<H2>FILES</H2>
<DL COMPACT>
<DT id="24"><I>/var/lib/dpkg/diversions</I>
<DD>
File which contains the current list of diversions of the system. It is
located in the <B>dpkg</B> administration directory, along with other files
important to <B>dpkg</B>, such as <I>status</I> or <I>available</I>.
<BR>
Note: <B>dpkg-divert</B> preserves the old copy of this file, with extension
<I>-old</I>, before replacing it with the new one.
</DL>
<A NAME="lbAJ">&nbsp;</A>
<H2>NOTES</H2>
When adding, default is <B>--local</B> and <B>--divert</B>
<I>original</I><B>.distrib</B>. When removing, <B>--package</B> or
<B>--local</B> and <B>--divert</B> must match if specified.
<P>
Directories can't be diverted with <B>dpkg-divert</B>.
<P>
Care should be taken when diverting shared libraries, <B><A HREF="/cgi-bin/man/man2html?8+ldconfig">ldconfig</A></B>(8)
creates a symbolic link based on the DT_SONAME field embedded in the library.
Because <B>ldconfig</B> doesn't honour diverts (only <B>dpkg</B> does),
the symlink may end up pointing at the diverted library, if a diverted
library has the same SONAME as the undiverted one.
<A NAME="lbAK">&nbsp;</A>
<H2>EXAMPLES</H2>
To divert all copies of a <I>/usr/bin/example</I> to <I>/usr/bin/example.foo</I>,
i.e. directs all packages providing <I>/usr/bin/example</I> to install it as
<I>/usr/bin/example.foo</I>, performing the rename if required:
<DL COMPACT>
<DT id="25">
<DD>dpkg-divert --divert /usr/bin/example.foo --rename /usr/bin/example
</DL>
<P>
To remove that diversion:
<DL COMPACT>
<DT id="26">
<DD>dpkg-divert --rename --remove /usr/bin/example
<P>
</DL>
<P>
To divert any package trying to install <I>/usr/bin/example</I> to
<I>/usr/bin/example.foo</I>, except your own <I>wibble</I> package:
<DL COMPACT>
<DT id="27">
<DD>dpkg-divert --package wibble --divert /usr/bin/example.foo --rename /usr/bin/example
</DL>
<P>
To remove that diversion:
<DL COMPACT>
<DT id="28">
<DD>dpkg-divert --package wibble --rename --remove /usr/bin/example
</DL>
<A NAME="lbAL">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+dpkg">dpkg</A></B>(1).
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="29"><A HREF="#lbAB">NAME</A><DD>
<DT id="30"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="31"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="32"><A HREF="#lbAE">COMMANDS</A><DD>
<DT id="33"><A HREF="#lbAF">OPTIONS</A><DD>
<DT id="34"><A HREF="#lbAG">EXIT STATUS</A><DD>
<DT id="35"><A HREF="#lbAH">ENVIRONMENT</A><DD>
<DT id="36"><A HREF="#lbAI">FILES</A><DD>
<DT id="37"><A HREF="#lbAJ">NOTES</A><DD>
<DT id="38"><A HREF="#lbAK">EXAMPLES</A><DD>
<DT id="39"><A HREF="#lbAL">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:11 GMT, March 31, 2021
</BODY>
</HTML>