1 # dpkg manual page - dpkg-divert(1)
3 # Copyright © 1995 Ian Jackson <ijackson@chiark.greenend.org.uk>
4 # Copyright © 1999 Wichert Akkerman <wakkerma@debian.org>
5 # Copyright © 2004 Scott James Remnant <keybuk@debian.org>
6 # Copyright © 2007-2013, 2015-2018 Guillem Jover <guillem@debian.org>
8 # This is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <https://www.gnu.org/licenses/>.
25 dpkg-divert - override a package's version of a file
36 is the utility used to set up and update the list of diversions.
38 File I<diversions> are a way of forcing
40 not to install a file into its
41 location, but to a I<diverted> location. Diversions can be used through the
42 Debian package scripts to move a file away when it causes a conflict. System
43 administrators can also use it to override some package's configuration file,
44 or whenever some files (which aren't marked as “conffiles”) need to be
45 preserved by B<dpkg>, when installing a newer version of a package which
52 =item [B<--add>] I<file>
54 Add a diversion for I<file>.
55 The file is currently not renamed, see B<--rename>.
57 =item B<--remove> I<file>
59 Remove a diversion for I<file>.
60 The file is currently not renamed, see B<--rename>.
62 =item B<--list> [I<glob-pattern>]
64 List all diversions, or ones matching I<glob-pattern>.
66 =item B<--listpackage> I<file>
68 Print the name of the package that diverts I<file> (since dpkg 1.15.0).
70 I<file> is locally diverted and nothing if I<file> is not diverted.
72 =item B<--truename> I<file>
74 Print the real name for a diverted file.
82 =item B<--admindir> I<directory>
84 Set the administrative directory to I<directory>.
85 Defaults to «I<%ADMINDIR%>» if B<DPKG_ADMINDIR> has not been set.
87 =item B<--instdir> I<directory>
89 Set the installation directory, which refers to the directory where
90 packages get installed (since dpkg 1.19.2).
91 Defaults to «I</>» if B<DPKG_ROOT> has not been set.
93 =item B<--root> I<directory>
95 Set the root directory to B<directory>, which sets the installation
96 directory to «I<directory>» and the administrative
97 directory to «I<directory>B<%ADMINDIR%>» (since dpkg 1.19.2)
98 if B<DPKG_ROOT> has not been set.
100 =item B<--divert> I<divert-to>
102 I<divert-to> is the location where the versions of I<file>, as
103 provided by other packages, will be diverted.
107 Specifies that all packages' versions of this file are diverted.
108 This means, that there are no exceptions, and whatever package is installed,
109 the file is diverted. This can be used by an admin to install a locally
112 =item B<--package> I<package>
114 I<package> is the name of a package whose copy of I<file> will not
115 be diverted. i.e. I<file> will be diverted for all packages except
120 Quiet mode, i.e. no verbose output.
124 Actually move the file aside (or back). B<dpkg-divert> will abort operation
125 in case the destination file already exists.
126 This is the common behavior used for diversions of files from the
127 non-B<Essential> package set (see B<--no-rename> for more details).
131 Specifies that the file should not be renamed while adding or removing the
132 diversion into the database (since dpkg 1.19.1).
133 This is intended for diversions of files from the B<Essential> package set,
134 where the temporary disappearance of the original file is not acceptable, as
135 it can render the system non-functional.
136 This is the default behavior, but that will change in the dpkg 1.20.x cycle.
140 Test mode, i.e. don't actually perform any changes, just demonstrate.
142 =item B<-?>, B<--help>
144 Show the usage message and exit.
148 Show the version and exit.
158 The requested action was successfully performed.
162 Fatal or unrecoverable error due to invalid command-line usage, or
163 interactions with the system, such as accesses to the database,
164 memory allocations, etc.
174 If set and the B<--instdir> or B<--root> options have not been
175 specified, it will be used as the filesystem root directory
178 =item B<DPKG_ADMINDIR>
180 If set and the B<--admindir> or B<--root> options have not been
181 specified, it will be used as the B<dpkg> data directory.
183 =item B<DPKG_MAINTSCRIPT_PACKAGE>
185 If set and the B<--local> and B<--package> options have not been
186 specified, B<dpkg-divert> will use it as the package name.
190 Sets the debug mask (since dpkg 1.21.10) from an octal value.
191 The currently accepted flags are described in the B<dpkg --debug> option,
192 but not all these flags might have an effect on this program.
196 Sets the color mode (since dpkg 1.18.5).
197 The currently accepted values are: B<auto> (default), B<always> and
206 =item I<%ADMINDIR%/diversions>
208 File which contains the current list of diversions of the system. It is
209 located in the B<dpkg> administration directory, along with other files
210 important to B<dpkg>, such as I<status> or I<available>.
212 B<Note>: B<dpkg-divert> preserves the old copy of this file, with extension
213 I<-old>, before replacing it with the new one.
219 When adding, default is B<--local> and B<--divert>
220 I<original>B<.distrib>. When removing, B<--package> or
221 B<--local> and B<--divert> must match if specified.
223 Directories can't be diverted with B<dpkg-divert>.
225 Care should be taken when diverting shared libraries, B<ldconfig>(8)
226 creates a symbolic link based on the DT_SONAME field embedded in the library.
227 Because B<ldconfig> does not honor diverts (only B<dpkg> does),
228 the symlink may end up pointing at the diverted library, if a diverted
229 library has the same SONAME as the undiverted one.
233 To divert all copies of a I</usr/bin/example> to I</usr/bin/example.foo>,
234 i.e. directs all packages providing I</usr/bin/example> to install it as
235 I</usr/bin/example.foo>, performing the rename if required:
237 dpkg-divert --divert /usr/bin/example.foo --rename /usr/bin/example
239 To remove that diversion:
241 dpkg-divert --rename --remove /usr/bin/example
243 To divert any package trying to install I</usr/bin/example> to
244 I</usr/bin/example.foo>, except your own I<wibble> package:
246 dpkg-divert --package wibble --divert /usr/bin/example.foo \
247 --rename /usr/bin/example
249 To remove that diversion:
251 dpkg-divert --package wibble --rename --remove /usr/bin/example