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).
| This entry was posted on Thursday, September 29th, 2005 at 19:48 and is filed under CCP, Mandriva. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site. |
Do you know Libconf ?
http://libconf.net/
I think this would be a nice application of the Libconf library which can already parse most common “type”.
Hmm, yeah, libconf could prove useful for this purpose.
[...] CCP (as I wrote about earlier) now has a project on savannah. It now works! It can be downloaded from the CVS repository. However, it doesn’t use libconf yet, and thus only supports key = value files. It also doesn’t know how to create the templates by itself so those have to be written by hand for now (but this should be easy(ish) to implement I think). [...]
[...] CCP can now autogenerate the templates, so it’s pretty much ready for real-life testing. Here’s the same example used in earlier posts. [...]