cfghelper.py is a Python script to help manage config files for Gentoo Linux. cfghelper.py is based on a script I wrote called "confighelper.py". When installing a new package using portage, config files are automatically replaced. Instead the new config file, which I refer to as a cfg file will be created. It is the user's responsibility to take care of replacing the existing file with the new one, merging the two, or deleting the new one.
This process can be a bit of a nuisance especially for some packages list postfix, which has a whole pile, most of which I am happy to have automatically replaced. This script will search for config files with cfg files and iterate through them allowing you to view difference between the two, replace the current with the new one, or remove the new one.
cfghelper.py does the following:
Searches for cfg files in directories listed in SEARCH_PATH. The following pattern is used to find cfg files:
\._cfg(\d+)_(.+)
Automatically replace any existing config files with the most recent cfg file if the config file matches any pattern in AUTO_REPLACE_PATTERNS.
Allow the user to specify what to do with each of the remaining cfg files. See Commands for a description of what commands are available for each cfg file.
NOTE: You must run cfghelper.py as root, otherwise you won't have permission to write system configuration files.
Currently the only way to modify cfghelper.py's configuration is to edit the script. I'd like to change this in the future, so configuration is read from a file, but that hasn't happened yet. Below are the main variables you might want to modify:
A list of directories cfghelper.py should search for cfg files in. By default, the following directories are searched:
- /etc
- /var/qmail/control
- /usr/share/config
- /usr/kde/2/share/config
- /usr/kde/3/share/config
- /opt/jakarta/tomcat/conf
Note
Before any config file is replaced with a cfg file it is backed up to $HOME/.cfghelper/backups/ using a scheme similar to the naming scheme for cfg files. Backups are sequentially number and have the same path to the original file, but under the backup directory. For example, the first time:
/etc/conf.d/net
was replaced, it would first be backed up to:
$HOME/.cfghelper/backups/etc/conf.d/net-0001