125
Appendix G
Diversions overriding a package's
version of a file (from old Packaging
Manual)
It is possible to have
dpkg
not overwrite a file when it reinstalls the package it belongs to, and
to have it put the file from the package somewhere else instead.
This can be used locally to override a package's version of a file, or by one package to override
another's version (or provide a wrapper for it).
Before deciding to use a diversion, read `Alternative versions of an interface
update alternatives
(from old Packaging Manual)' on page
123
to see if you really want
a diversion rather than several alternative versions of a program.
There is a diversion list, which is read by
dpkg
, and updated by a special program
dpkg divert
. Please see
dpkg divert(8)
for full details of its operation.
When a package wishes to divert a file from another, it should call
dpkg divert
in its
preinst to add the diversion and rename the existing file. For example, supposing that a
smailwrapper
package wishes to install a wrapper around
/usr/sbin/smail
:
if [ install = "$1"
]; then
dpkg divert package smailwrapper add rename \
divert /usr/sbin/smail.real /usr/sbin/smail
fi
Testing
$1
is necessary so that the script doesn't try to add the diversion again
when
smailwrapper
is upgraded.
The
package smailwrapper
ensures that
smailwrapper
's copy of
/usr/sbin/smail
can bypass the diversion and get installed as
the true version.
The postrm has to do the reverse:
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved