Inhaltsverzeichnis

Upgrading Configuration Files with a three-way File Merge

Problem

When upgrading software (e.g. with slackpkg) you usually have customized the config files to your personal need. Now the config files of the new software version also differ from the original version. What you want is an easy way to get your own modifications into the new config files.

Solution

The solution is exemplified with just 1 configuration file called conf:

The following command merges both the differences between conf.org and conf and the differences between conf.org and conf.new back into conf:

merge conf conf.org conf.new

After merging it is advisable to rename conf.new to be prepared for a future update:

mv conf.new conf.org
All *.org files can serve as a reminder for you to trace back all the modifications you did to the system. But sometimes you have to create a config file which did not exist before (e.g. myConfigFile). In order not to forget such files during update, it is advisable to create an empty counterpart file myConfFile.org.

Example where the tools fail

A manual check after the patch is applied is advisable, for there are situations imaginable where the tools do not produce the expected results:

conf.org:      conf:       conf.new:     desired:    result:

[mitwitz]      [mitwitz]   [coburg]      [coburg]    [coburg]
Otto=5         Otto=5      Otto=5        Otto=5      Otto=5
Guenter=6      Guenter=6   Guenter=6     Guenter=6   Guenter=6
Harry=7        Harry=7     Harry=7       Harry=7     Harry=7
Franz=8        Franz=-999  Franz=8       Franz=8     Franz=-999
Helga=9        Helga=9     Helga=9       Helga=9     Helga=9
Egon=10        Egon=10     Egon=10       Egon=10     Egon=10
Anton=11       Anton=11    Anton=11      Anton=11    Anton=11
                           [mitwitz]     [mitwitz]   [mitwitz]
                           Otto=5        Otto=5      Otto=5
                           Guenter=6     Guenter=6   Guenter=6
                           Harry=7       Harry=7     Harry=7
                           Franz=8       Franz=-999  Franz=8
                           Helga=9       Helga=9     Helga=9

Alternatives