Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
becki:linux:diffupgrade [2010-02-05 19:13] becki |
becki:linux:diffupgrade [2011-06-08 16:26] (aktuell) becki |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ====== Upgrading Configuration Files with the Diffutils == | + | ====== Upgrading Configuration Files with a three-way File Merge == |
- | ===== Probelm == | + | ===== 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. | + | When upgrading software (e.g. with [[slack_upgrade|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 == | ===== Solution == | ||
Zeile 12: | Zeile 12: | ||
* ''conf.new'' is the brandnew pristine version coming from the upgrade. | * ''conf.new'' is the brandnew pristine version coming from the upgrade. | ||
- | The following command merges both the differences between ''conf.org'' and ''conf'' and the differences between ''conf.org'' and ''conf.new'' back into ''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'': |
- | patch conf conf.org conf.new | + | merge 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 | + | |
After merging it is advisable to rename conf.new to be prepared for a future update: | After merging it is advisable to rename conf.new to be prepared for a future update: | ||
Zeile 25: | Zeile 20: | ||
mv conf.new conf.org | mv conf.new conf.org | ||
- | Anoter note: 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''. | + | <note tip>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''.</note> |
===== Example where the tools fail == | ===== Example where the tools fail == | ||
Zeile 49: | Zeile 44: | ||
Helga=9 Helga=9 Helga=9 | Helga=9 Helga=9 Helga=9 | ||
</code> | </code> | ||
+ | |||
+ | ===== Alternatives == | ||
+ | |||
+ | * An alternative to the ''merge'' command is ''diff3'', it should produce the same result:<code bash> | ||
+ | diff3 -m conf conf.org conf.new > conf.out | ||
+ | mv conf.out conf | ||
+ | </code> | ||
+ | * A 2nd alternative to merge are the diff/patch tools. See [[diff patch tips]] | ||