Eskild Hustvedt

A working copy of CCP

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).

Like i said it currently supports key = value files. Any format will do. It can for instance handle any of the following:

$Key = Value;
$Key=Value
$Key='Value'
$Key="Value"
$Key ="Value"
Key = Value
Key=Value
# Comment
: Comment
; Comment
[Section header that gets ignored]

It doesn’t support comments on the same line as a config option, but this can probably be added at some later time. I haven’t written any documentation yet - but here’s the same usage sample I used before (edited to suit the way ccp now works).

/etc/example.conf:

# Example configuration file
SystemVersion = 0.1
Mode = public
Extensions = off

/etc/example.conf.rpmnew:

# Example configuration file
SystemVersion = 0.1
Mode = private
Extensions = on
AllowUsers = yes

/usr/share/example/config.ccptemplate:

# Example configuration file
SystemVersion = {CCP::CONFIG:SystemVersion}
Mode = {CCP::CONFIG::Mode}
Extensions = {CCP::CONFIG::Extensions}
AllowUsers = {CCP::CONFIG::AllowUsers}

Command:

$ ccp --template /usr/share/example/config.ccptemplate --oldfile /etc/example.conf --newfile /etc/example.conf.rpmnew
Merging changes between "/etc/example.conf" and "/etc/example.conf.rpmnew"...done

Resulting /etc/example.conf:

# Example configuration file
SystemVersion = 0.1
Mode = public
Extensions = off
AllowUsers = yes