1dpkg-divert(1) dpkg suite dpkg-divert(1)
2
3
4
6 dpkg-divert - override a package's version of a file
7
9 dpkg-divert [option...] command
10
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
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 all diversions, or ones 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
44 --admindir directory
45 Set the administrative directory to directory. Defaults to
46 «/var/lib/dpkg» if DPKG_ADMINDIR has not been set.
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 «/» if
51 DPKG_ROOT has not been set.
52
53 --root directory
54 Set the root directory to directory, which sets the installation
55 directory to «directory» and the administrative directory to
56 «directory/var/lib/dpkg» (since dpkg 1.19.2) if DPKG_ROOT has not
57 been set.
58
59 --divert divert-to
60 divert-to is the location where the versions of file, as provided
61 by other packages, will be diverted.
62
63 --local
64 Specifies that all packages' versions of this file are diverted.
65 This means, that there are no exceptions, and whatever package is
66 installed, the file is diverted. This can be used by an admin to
67 install a locally modified version.
68
69 --package package
70 package is the name of a package whose copy of file will not be
71 diverted. i.e. file will be diverted for all packages except
72 package.
73
74 --quiet
75 Quiet mode, i.e. no verbose output.
76
77 --rename
78 Actually move the file aside (or back). dpkg-divert will abort
79 operation in case the destination file already exists. This is the
80 common behavior used for diversions of files from the non-Essential
81 package set (see --no-rename for more details).
82
83 --no-rename
84 Specifies that the file should not be renamed while adding or
85 removing the diversion into the database (since dpkg 1.19.1). This
86 is intended for diversions of files from the Essential package set,
87 where the temporary disappearance of the original file is not
88 acceptable, as it can render the system non-functional. This is
89 the default behavior, but that will change in the dpkg 1.20.x
90 cycle.
91
92 --test
93 Test mode, i.e. don't actually perform any changes, just
94 demonstrate.
95
96 -?, --help
97 Show the usage message and exit.
98
99 --version
100 Show the version and exit.
101
103 0 The requested action was successfully performed.
104
105 2 Fatal or unrecoverable error due to invalid command-line usage, or
106 interactions with the system, such as accesses to the database,
107 memory allocations, etc.
108
110 DPKG_ROOT
111 If set and the --instdir or --root options have not been specified,
112 it will be used as the filesystem root directory (since dpkg
113 1.19.2).
114
115 DPKG_ADMINDIR
116 If set and the --admindir or --root options have not been
117 specified, it will be used as the dpkg data directory.
118
119 DPKG_MAINTSCRIPT_PACKAGE
120 If set and the --local and --package options have not been
121 specified, dpkg-divert will use it as the package name.
122
123 DPKG_DEBUG
124 Sets the debug mask (since dpkg 1.21.10) from an octal value. The
125 currently accepted flags are described in the dpkg --debug option,
126 but not all these flags might have an effect on this program.
127
128 DPKG_COLORS
129 Sets the color mode (since dpkg 1.18.5). The currently accepted
130 values are: auto (default), always and never.
131
133 /var/lib/dpkg/diversions
134 File which contains the current list of diversions of the system.
135 It is located in the dpkg administration directory, along with
136 other files important to dpkg, such as status or available.
137
138 Note: dpkg-divert preserves the old copy of this file, with
139 extension -old, before replacing it with the new one.
140
142 When adding, default is --local and --divert original.distrib. When
143 removing, --package or --local and --divert must match if specified.
144
145 Directories can't be diverted with dpkg-divert.
146
147 Care should be taken when diverting shared libraries, ldconfig(8)
148 creates a symbolic link based on the DT_SONAME field embedded in the
149 library. Because ldconfig does not honor diverts (only dpkg does), the
150 symlink may end up pointing at the diverted library, if a diverted
151 library has the same SONAME as the undiverted one.
152
154 To divert all copies of a /usr/bin/example to /usr/bin/example.foo,
155 i.e. directs all packages providing /usr/bin/example to install it as
156 /usr/bin/example.foo, performing the rename if required:
157
158 dpkg-divert --divert /usr/bin/example.foo --rename /usr/bin/example
159
160 To remove that diversion:
161
162 dpkg-divert --rename --remove /usr/bin/example
163
164 To divert any package trying to install /usr/bin/example to
165 /usr/bin/example.foo, except your own wibble package:
166
167 dpkg-divert --package wibble --divert /usr/bin/example.foo \
168 --rename /usr/bin/example
169
170 To remove that diversion:
171
172 dpkg-divert --package wibble --rename --remove /usr/bin/example
173
175 dpkg(1).
176
177
178
1791.21.21 2023-02-25 dpkg-divert(1)