[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: preserving user changes while managing configuration files



Dennis van Dok <dennisvd@nikhef.nl> writes:

> On 23-11-11 14:34, Arno Töll wrote:
>> please mind the exact wording here. A "configuration file" is not
>> the same as a "conffile" in Debian. Note, you are not allowed to
>> modify a conffile at any time.
> In the context of the maintainer scripts, I take it. ;-)
>
> [...]
>> If you want to modify the configuration of your package at
>> installation time, you can do so by creating a configuration file
>> your program expects _at installation time_ in the maintainer
>> script but it must not be part of the package itself. To preserve
>> user changes or do a graceful updates of your dynamically created
>> configuration files, you may then manage your changes through ucf
>> as Alexander suggested.
>
> OK, thanks. Just to be clear, running dpkg-reconfigure *will* rewrite
> the configuration if the admin never touched the configuration file,
> is that correct?
>
> I'm going to try my hand at using ucf now.

My suggestion was that you don't ship a default config file at all, and
only offer the debconf-based configuration if one does not exist. If one
exists, that means that it's either been generated already (thus,
upgrades won't destroy, or even touch the file), or that the admin wrote
one.

This way you don't have much else to do than to wrap the whole
install-time configuration in an if [ ! -f /etc/package.conf ]; then
...; fi construct.

(And handle purge, but that one's easy.)

-- 
|8]


Reply to: