I’ve been thinking about ways to upgrade configuration files lately and I’ve come up with the idea for CCP (common configuration parser). The idea is to take one template file, one old configuration file, one definition file and one mode. To give a better example of how this would work: ccp –type basic –mode rpmnew –template /usr/share/example/config.ccptemplate –oldfile /etc/example.conf This here would tell ccp to work with the configuration type “basic”, in the mode rpmnew (upgrade if a rpmnew file is found), use the template file /usr/share/example/config.ccptemplate and upgrade the old configuration file /etc/example.conf. Settings not found in /etc/example.conf would then be taken from /etc/example.conf.rpmnew. For an even better understanding of the idea lets look at it some more. For example before the upgrade /etc/example.conf could look like this:
# Example configuration file
SystemVersion = 0.1
Mode = public
Extensions = off
/etc/example.conf.rpmnew could look like this: # Example configuration file SystemVersion = 0.1 Mode = private Extensions = on AllowUsers = yes
/usr/share/example/config.ccptemplate could look something like this: # Example configuration file SystemVersion = $CCP::CONF:SystemVersion Mode = $CCP::CONF::Mode Extensions = $CCP::CONF::Extensions AllowUsers = $CCP::CONF::AllowUsers
ccp would read these files and write the new /etc/example.conf as: # Example configuration file SystemVersion = 0.1 Mode = public Extensions = off AllowUsers = yes
More advanced files could be supported by different –type’s. This is still mostly an idea that’s growing in my head but this is the basic thought of it. Quite possibly –template wouldn’t be needed and it would autogenerate a template on-the-fly by using the .rpmnew (or whichever file is the new one - ccp is not rpm specific, it is just one of multiple modes it would be able to run in).