Handling of Config Files

To update a gentoo system the command emerge does the job. But it does not update the config files automatically to not destroy the customized settings. If it is the first time that a config file is put on the system an entry is added to /var/lib/portage/config that contains a checksum of the config file. Next time if a config file has to be put on the system and it does have an other checksum the characters ._cgg0000_ are put in front of the new config file and emerge tells you that updates are necessary or available. To see whats there on your system type find /etc -name ._cfg*.

Run cat /var/lib/portage/config | grep /etc/conf.d/modules to see the registered checksum and run md5sum /etc/conf.d/modules if you have modified it, it has an other checksum.

Inside the cascading profiles (see /usr/portage/profiles/base/make.defaults holds the two variables CONFIG_PROTECT that says that in /etc files shall not be overwritten except the ones defined by the variable CONFIG_PROTECT_MASK.

To resolve different versions of those config files some programs are available:

etc-update

etc-update can be used to do the update. A general rule is, whatever you never touched can be updated, what you have updated should be saved before the update or merged with the update. etc-update has also the possibility to review the differences and merge it. Type in the number of the file to be updated, then you see the difference. When done, press Q and you will be asked for further actions as ignore the update for this file.

Alternatively the files can be merged manually using a regular editor and tools as diff.

dispatch-conf

dispatch-conf is an improved alternative to etc-update that saves old versions of the configuration files

It has a configuration file /etc/dispatch-conf.conf where the directory to archive replaced config files can be specified

archive-dir=/etc/config-archive

Other behavior can be configured as auto merge files that differ just with comments and white space

replace-wscomments=yes

Or auto merge files that the user never has modified

replace-unmodified=yes

to get colored output

emerge colordiff

To put all your changes under a revision control system to not loose the contents of your older config files (maybe the config files that worked) the use-rcs variable has to be set in /etc/dispatch-conf.conf

# Use rcs for storing files in the archive directory?
# (yes or no)
use-rcs=yes

and emerge rcs the Revision Control System that is a standalone package. The directory /etc/config-archive is where the stuff goes.

cfg-update

cfg-update is a GUI alternative to etc-update or/and dispatch-config.


Linurs startpage