1dpkg-divert(1)                    dpkg suite                    dpkg-divert(1)
2
3
4

NAME

6       dpkg-divert - override a package's version of a file
7

SYNOPSIS

9       dpkg-divert [option...]  command
10

DESCRIPTION

12       dpkg-divert is the utility used to set up and update the list of
13       diversions.
14
15       File diversions are a way of forcing dpkg(1) not to install a file into
16       its location, but to a diverted location. Diversions can be used
17       through the Debian package scripts to move a file away when it causes a
18       conflict. System administrators can also use it to override some
19       package's configuration file, or whenever some files (which aren't
20       marked as “conffiles”) need to be preserved by dpkg, when installing a
21       newer version of a package which contains those files.
22

COMMANDS

24       [--add] file
25           Add a diversion for file.  The file is currently not renamed, see
26           --rename.
27
28       --remove file
29           Remove a diversion for file.  The file is currently not renamed,
30           see --rename.
31
32       --list glob-pattern
33           List diversions matching glob-pattern.
34
35       --listpackage file
36           Print the name of the package that diverts file (since dpkg
37           1.15.0).  Prints LOCAL if file is locally diverted and nothing if
38           file is not diverted.
39
40       --truename file
41           Print the real name for a diverted file.
42

OPTIONS

44       --admindir directory
45           Set the administrative directory to directory.  Defaults to
46           «/var/lib/dpkg».
47
48       --instdir directory
49           Set the installation directory, which refers to the directory where
50           packages get installed (since dpkg 1.19.2). Defaults to «/».
51
52       --root directory
53           Set the root directory to directory, which sets the installation
54           directory to «directory» and the administrative directory to
55           «directory/var/lib/dpkg» (since dpkg 1.19.2).
56
57       --divert divert-to
58           divert-to is the location where the versions of file, as provided
59           by other packages, will be diverted.
60
61       --local
62           Specifies that all packages' versions of this file are diverted.
63           This means, that there are no exceptions, and whatever package is
64           installed, the file is diverted. This can be used by an admin to
65           install a locally modified version.
66
67       --package package
68           package is the name of a package whose copy of file will not be
69           diverted. i.e. file will be diverted for all packages except
70           package.
71
72       --quiet
73           Quiet mode, i.e. no verbose output.
74
75       --rename
76           Actually move the file aside (or back). dpkg-divert will abort
77           operation in case the destination file already exists.  This is the
78           common behavior used for diversions of files from the non-Essential
79           package set (see --no-rename for more details).
80
81       --no-rename
82           Specifies that the file should not be renamed while adding or
83           removing the diversion into the database (since dpkg 1.19.1).  This
84           is intended for diversions of files from the Essential package set,
85           where the temporary disappearance of the original file is not
86           acceptable, as it can render the system non-functional.  This is
87           the default behavior, but that will change in the dpkg 1.20.x
88           cycle.
89
90       --test
91           Test mode, i.e. don't actually perform any changes, just
92           demonstrate.
93
94       -?, --help
95           Show the usage message and exit.
96
97       --version
98           Show the version and exit.
99

EXIT STATUS

101       0   The requested action was successfully performed.
102
103       2   Fatal or unrecoverable error due to invalid command-line usage, or
104           interactions with the system, such as accesses to the database,
105           memory allocations, etc.
106

ENVIRONMENT

108       DPKG_ROOT
109           If set and the --instdir or --root options have not been specified,
110           it will be used as the filesystem root directory (since dpkg
111           1.19.2).
112
113       DPKG_ADMINDIR
114           If set and the --admindir or --root options have not been
115           specified, it will be used as the dpkg data directory.
116
117       DPKG_MAINTSCRIPT_PACKAGE
118           If set and the --local and --package options have not been
119           specified, dpkg-divert will use it as the package name.
120
121       DPKG_COLORS
122           Sets the color mode (since dpkg 1.18.5).  The currently accepted
123           values are: auto (default), always and never.
124

FILES

126       /var/lib/dpkg/diversions
127           File which contains the current list of diversions of the system.
128           It is located in the dpkg administration directory, along with
129           other files important to dpkg, such as status or available.
130
131           Note: dpkg-divert preserves the old copy of this file, with
132           extension -old, before replacing it with the new one.
133

NOTES

135       When adding, default is --local and --divert original.distrib. When
136       removing, --package or --local and --divert must match if specified.
137
138       Directories can't be diverted with dpkg-divert.
139
140       Care should be taken when diverting shared libraries, ldconfig(8)
141       creates a symbolic link based on the DT_SONAME field embedded in the
142       library.  Because ldconfig doesn't honour diverts (only dpkg does), the
143       symlink may end up pointing at the diverted library, if a diverted
144       library has the same SONAME as the undiverted one.
145

EXAMPLES

147       To divert all copies of a /usr/bin/example to /usr/bin/example.foo,
148       i.e. directs all packages providing /usr/bin/example to install it as
149       /usr/bin/example.foo, performing the rename if required:
150
151        dpkg-divert --divert /usr/bin/example.foo --rename /usr/bin/example
152
153       To remove that diversion:
154
155        dpkg-divert --rename --remove /usr/bin/example
156
157       To divert any package trying to install /usr/bin/example to
158       /usr/bin/example.foo, except your own wibble package:
159
160        dpkg-divert --package wibble --divert /usr/bin/example.foo \
161           --rename /usr/bin/example
162
163       To remove that diversion:
164
165        dpkg-divert --package wibble --rename --remove /usr/bin/example
166

SEE ALSO

168       dpkg(1).
169
170
171
1721.20.9                            2021-04-13                    dpkg-divert(1)
Impressum