How do I specify that a deb package should replace one with a different name?
I am creating a Debian package foo
which needs to replace an existing package bar
on systems on which it is installed.
I've read:
https://www.debian.org/doc/debian-policy/ch-relationships.html
And concluded that the correct clauses in the DEBIAN/control
should look like:
Provides: foo
Conflicts: bar
Replaces: bar
However, when I try to install the foo
package on a system that already has bar
installed, the system balks because foo
conflicts with bar
.
If I remove the Conflicts: bar
entry then dpkg
allows both packages to be installed side-by-side, which is a problem since foo
must replace bar
.
What are the proper control
file clauses to achieve this?
I've tried Breaks
instead of Conflicts
:
dpkg: regarding foo_DEV-22._i386.deb containing foo:
foo breaks bar
bar (version 3.2.2.1-x86NX4.4-x86) is present and installed.
bar provides bar and is present and installed.
dpkg: error processing foo_DEV-22._i386.deb (--install):
installing foo would break existing software
Errors were encountered while processing:
foo_DEV-22._i386.deb
Solution 1:
dpkg
is a low level tool. To get the desired effect the package should be put into a repo and added to sources.list(5)
then apt install foo
will do the right thing.
Solution 2:
Why not to rename it the existent package beforehand and later replace it with the one you want?
To this end you have to methods/ways as per Debian official wiki page below:
https://wiki.debian.org/Renaming_a_Package