Benutzer-Werkzeuge

Webseiten-Werkzeuge


becki:linux:diffupgrade

Dies ist eine alte Version des Dokuments!


Upgrading Configuration Files with the Diffutils

Probelm

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:

  • conf.org is the original config file of old version of the software. Eighter you have created that file by copying before you made any modifications to conf or you can get it again by downloading the old version of the software.
  • conf is your version of conf.org. You have customized to your needs.
  • conf.new is the brandnew pristine version coming from the upgrade.

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

patch conf conf.org conf.new

An alternative to the merge command is diff3, it should produce the same result:

diff3 -m conf conf.org conf.new > conf.out
mv conf.out conf

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
Cookies helfen bei der Bereitstellung von Inhalten. Diese Website verwendet Cookies. Mit der Nutzung der Website erklären Sie sich damit einverstanden, dass Cookies auf Ihrem Computer gespeichert werden. Außerdem bestätigen Sie, dass Sie unsere Datenschutzerklärung gelesen und verstanden haben. Wenn Sie nicht einverstanden sind, verlassen Sie die Website. Weitere Information
becki/linux/diffupgrade.1265395126.txt.gz · Zuletzt geändert: 2010-02-05 18:38 von becki

Impressum - Datenschutzerklärung