Debian Admin - Your way to Debian World

December 14, 2006

Replace binaries and Files with dpkg-divert

by @ 9:00 am. Filed under Package Mgmt

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

File `diversions’ are a way of forcing dpkg not to install a file into its location, but to a `diverted’ location. Diversions can be used through the Debian package scripts to move a file away when it causes a conflict. System administrators can also use it to override some package’s configuration file, or whenever some files (which aren’t marked as ‘conffiles’) need to be preserved by dpkg, when installing a newer version of a package which contains those files.

dpkg-divert is the utility used to set up and update the list of diversions. It functions in three basic modes - adding, removing, and listing diversions. The options are –add, –remove, and –list, respectively. Additionally, it can print out the real name for a diverted file. Other options (listed below) may also be specified.

The dpkg-divert command allows you to replace a binary installed upon the system, and have this replacement persist even if you upgrade packages.This is very useful if you want to use an updated version of some application instead of old version existing on your machine.

dpkg-divert Syntax

dpkg-divert [options] [--add] <file>

dpkg-divert [options] --remove <file>

dpkg-divert [options] --list <glob-pattern> dpkg-divert [options] --truename <file>

dpkg-divert Examples

To divert all copies of a /usr/bin/example to /usr/bin/example.foo, i.e. directs all packages providing /usr/bin/example to install it as /usr/bin/example.foo, performing the rename if required

dpkg-divert --divert /usr/bin/example.foo --rename /usr/bin/example

To remove that diversion

dpkg-divert --rename --remove /usr/bin/example

To divert any package trying to install /usr/bin/example to /usr/bin/example.foo, except your own wibble package

dpkg-divert --package wibble --divert /usr/bin/example.foo --rename /usr/bin/example

To remove that diversion

dpkg-divert --package wibble --rename --remove /usr/bin/example

If you want to know more available options for dpkg-divert check man page

Tags: , , , , , ,

You may also be interested in...

Leave a Reply

Subscribe RSS Feed

subscribe to the Debian Admin RSS feed

Internal links:

Sponsors:



Categories:

Support Debian Admin

Amount $:
Website(Optional):

Sponsors:

Archives:

Related Links:


Favourite Sites:

Wordpress Collection
Windows Reference
Ubuntu Geek
DebianHelp
All About Debian Tutorials
Power Electrical
Check Your IP Here
Debian,Ubuntu News
DebCentral
Tuxmachines
Capnkirby
Libervis
Nuxifield
Linux Horizon
Linux Appfinder
Debuntu
GNU/Linux For Everyone
Free Penguin
DebianAdmin is not related to the Debian Project.
This site is copyright © 2006,2007 Debian Admin
All Trademarks are the property of their respective owners.
The contents of this website may not be mirrored or archived without the express written permission of DebianAdmin Site Owner.

DISCLAIMER: All the information, troubleshooting methods, utilities offered in this website is provided AS-IS, without any warranties. Though I strive for perfection, and always test the validity and effectiveness of the troubleshooting content in various systems, I assume no responsibility for your use of these Fixes, Utilities and other troubleshooting advice. The author will not be liable for any special, incidental, consequential or indirect damages due to loss of data or any other reason. All use is completely at your own risk. Changes to the existing content and new additions are made to this website periodically, without notification.
Rodney's Kontera DynamiContext Plugin plugged in.