Ubuntu – Tool for merging conf files in /etc during upgrade

configurationpackage-management

Gentoo Linux has a set of tools to assist in merging conf file changes when one upgrade a package. For example, the conf-update tool or the dispatch-conf tool.

When I upgrade packages on Ubuntu, however, I only get the option of (1) Use the new conf file, (2) Use the old conf file, (3) Start a shell.

Is there no tool in Ubuntu similar to conf-update or dispatch-conf?

More Explanation:

Let's say that there's a service whose configuration file is /etc/something.conf. Doing installation of the something package will provide a 'default' configuration with all options commented. I then modify the options as required.

Then there's an update, and with the update a new 'default' configuration gets installed. Some options may get deprecated, new options may be added, and description of existing options may be corrected.

Now this 'default' configuration obviously conflicts with the already-edited /etc/something.conf file.

In Gentoo Linux, the new configuration will be saved under a unique name, with a warning printed out that informs me of "a changed/updated configuration file". I then run conf-update which will help me perform two-way merge on the affected configuration file(s). For each change, I have the choices of (1) keep my version, (2) use the package's version, or (3) edit manually. Usually I choose (2) for comment changes, (1) to keep my specific changes, and (3) if I have diverged significantly from the default.

I'd like to have the same control / interaction in Ubuntu, if at all possible.

Best Answer

While upgrading via apt-get, one usually gets a prompt of what to do with the config file (Install new version, Keep the old version, etc).

If we choose to keep the current version, the new config files get stored with an extension (.dpkg-dist).

The following command can be used to list the new files:

find /etc -type f -name "*.dpkg-dist"

And to take action on these config files, we can use the provided ucf tool. Its syntax is:

ucf <new-file> <old-file>

For example,

ucf /etc/sysctl.conf.dpkg-dist /etc/sysctl.conf

See also,

https://raphaelhertzog.com/2010/09/21/debian-conffile-configuration-file-managed-by-dpkg/

Related Question