OpenPKG Advent Calendar 2006

...every day a little pondering, backstage information, jokes, tips and tricks.
20
Wednesday 2006-12-20: Backstage
How OpenPKG RPM Handles Configuration Files

A good magician never reveals his secret.
The unbelievable trick becomes simple and
obvious once it is explained.

Every OpenPKG package containing configuration files has those files explicitly tagged as %config in the package specification to allow them to be edited by the administrator and specially handled during a package update to as best as possible keep the edited file in place or at least preserve its content. The approach used by OpenPKG RPM is a rather clever one if one looks at it in detail. In short, OpenPKG RPM's configuration file update strategy can be summarized with the following table:

    old in   old on     new in   new on 
    package  filesystem package  filesystem approach
    ======== ========== ======== ========== ===========================================
    X        X          X        X          keep old config
    X        X'         X'       X'         keep old config
    X        X'         X        X'         keep old config
    X        X          Y        Y          install new config
    X        X'         Y        Y          install new config, preserve X' as .rpmsave
    -        X          Y        Y          install new config, preserve X  as .rpmorig

Here is what this means in detail:

As you can see, OpenPKG RPM in four of six cases reasonably and fully automatically resolves the problem. And even in the remaining two complex cases, it ensures that the administrators file content is not lost.

Notice that "openpkg rc" denies to start or stop packages which have *.rpm* files in their prefix/etc/package/ directory in order to force the administrator to take action and to avoid security issues (which could happen by starting a program with a default configuration).