sysconftool
A new version of an application often introduces new configuration settings. Sometimes obsolete configuration settings are removed. Existing configuration settings may also now have additional options, or certain options are no longer valid any more. Because of this, an application upgrade usually installs a fresh set of configuration files, containing a default configuration that's known to work. Keeping the existing files carries the risk of the application failing to function properly due to a configuration that is no longer valid.
A typical application installation script copies over configuration files with default settings. Existing configuration files are backed up or overwritten. With sysconftool, an application will install a configuration file names filename.dist, instead of filename. Then, the application's installation script runs sysconftool. sysconftool copies filename.dist to filename, but also checks if filename from an older version of the application already exist. If filename an older sysconftool-installed configuration file, it's configuration settings replace the defaults in filename.dist, which is then subsequently installed as filename. sysconftool is smart enough to:
sysconftool produces a short report when it runs. The report lists every configuration setting in $filename.dist, and its disposition. The possible dispositions are:
new
unchanged
UPDATED
All this logic is based on some additional metadata that must be included in each configuration file, that sysconftool reads. For this to work, both the old and the new version of the application must be sysconftool-ized. sysconftool operates in a fail-safe mode. If the old version did not use sysconftool, $filename is backed up to $filename.bak, and $filename is copied to $filename. This is what would essentially happen anyway without sysconftool. The local configuration needs to be reentered into $filename, so nothing is lost. However, the next upgrade will see sysconftool do its job.
sysconftool requires the application to use autoconf and automake. The first step is to run the sysconftoolize script from the application's source directory. sysconftoolize creates a symbolic link to the sysconftool script from the current directory, and appends a default install-configure rule to Makefile.am. sysconftoolize with the --copy option copies the script, instead of creating a symbolic link.
After running sysconftoolize the macro AC_PROG_SYSCONFTOOL must be manually added to configure.in, and Makefile.am must be modified as follows.
Makefile.am must be modified to install configuration files as filename.dist instead of filename. The default install-configure rule assumes that sysconf_DATA lists all configuration files in sysconfdir, and runs sysconftool on them. This will usually have to be modified, according to the application's individual needs. Finally, Makefile.am must be modified to distribute the sysconftool script in the application's source distribution. Adding sysconftool to EXTRA_DIST is what's needed in most cases.
Finally, certain sysconftool magic incantations must be added to the application's configuration files, see m[blue]sysconftool(7)m[][1] for more information. The last step involves updating the application's INSTALL instructions, so that the application can be properly installed. The following instructions must be added to INSTALL:
m[blue]sysconftoolcheck(1)m[][2], m[blue]sysconftool(7)m[][1].