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
23
25 [--add] file
26 Add a diversion for file. The file is currently not renamed,
27 see --rename.
28
29 --remove file
30 Remove a diversion for file. The file is currently not renamed,
31 see --rename.
32
33 --list glob-pattern
34 List diversions matching glob-pattern.
35
36 --listpackage file
37 Print the name of the package that diverts file (since dpkg
38 1.15.0). Prints LOCAL if file is locally diverted and nothing
39 if file is not diverted.
40
41 --truename file
42 Print the real name for a diverted file.
43
45 --admindir directory
46 Set the administrative directory to directory. Defaults to
47 «/var/lib/dpkg».
48
49 --instdir directory
50 Set the installation directory, which refers to the directory
51 where packages get installed (since dpkg 1.19.2). Defaults to
52 «/».
53
54 --root directory
55 Set the root directory to directory, which sets the installation
56 directory to «directory» and the administrative directory to
57 «directory/var/lib/dpkg» (since dpkg 1.19.2).
58
59 --divert divert-to
60 divert-to is the location where the versions of file, as
61 provided 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
66 is installed, the file is diverted. This can be used by an admin
67 to 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
80 the common behavior used for diversions of files from the non-
81 Essential 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).
86 This is intended for diversions of files from the Essential
87 package set, where the temporary disappearance of the original
88 file is not acceptable, as it can render the system non-
89 functional. This is the default behavior, but that will change
90 in the dpkg 1.20.x cycle.
91
92 --test Test mode, i.e. don't actually perform any changes, just
93 demonstrate.
94
95 -?, --help
96 Show the usage message and exit.
97
98 --version
99 Show the version and exit.
100
102 0 The requested action was successfully performed.
103
104 2 Fatal or unrecoverable error due to invalid command-line usage,
105 or interactions with the system, such as accesses to the
106 database, memory allocations, etc.
107
109 DPKG_ROOT
110 If set and the --instdir or --root options have not been
111 specified, it will be used as the filesystem root directory
112 (since dpkg 1.19.2).
113
114 DPKG_ADMINDIR
115 If set and the --admindir or --root options have not been
116 specified, it will be used as the dpkg data directory.
117
118 DPKG_MAINTSCRIPT_PACKAGE
119 If set and the --local and --package options have not been
120 specified, dpkg-divert will use it as the package name.
121
122 DPKG_COLORS
123 Sets the color mode (since dpkg 1.18.5). The currently accepted
124 values are: auto (default), always and never.
125
127 /var/lib/dpkg/diversions
128 File which contains the current list of diversions of the
129 system. It is located in the dpkg administration directory,
130 along with other files important to dpkg, such as status or
131 available.
132 Note: dpkg-divert preserves the old copy of this file, with
133 extension -old, before replacing it with the new one.
134
136 When adding, default is --local and --divert original.distrib. When
137 removing, --package or --local and --divert must match if specified.
138
139 Directories can't be diverted with dpkg-divert.
140
141 Care should be taken when diverting shared libraries, ldconfig(8)
142 creates a symbolic link based on the DT_SONAME field embedded in the
143 library. Because ldconfig doesn't honour diverts (only dpkg does), the
144 symlink may end up pointing at the diverted library, if a diverted
145 library has the same SONAME as the undiverted one.
146
148 To divert all copies of a /usr/bin/example to /usr/bin/example.foo,
149 i.e. directs all packages providing /usr/bin/example to install it as
150 /usr/bin/example.foo, performing the rename if required:
151
152 dpkg-divert --divert /usr/bin/example.foo --rename /usr/bin/example
153
154 To remove that diversion:
155
156 dpkg-divert --rename --remove /usr/bin/example
157
158
159 To divert any package trying to install /usr/bin/example to
160 /usr/bin/example.foo, except your own wibble package:
161
162 dpkg-divert --package wibble --divert /usr/bin/example.foo --rename
163 /usr/bin/example
164
165 To remove that diversion:
166
167 dpkg-divert --package wibble --rename --remove /usr/bin/example
168
170 dpkg(1).
171
172
173
1741.19.7 2019-06-03 dpkg-divert(1)