Re: use and abuse of debconf
>>>>> "Joey" == Joey Hess <joeyh@debian.org> writes:
Joey> It has recently come to my attention that several developers
Joey> are using debconf as an excuse to write a quick hack rather
Joey> than doing things right. In particular I am talking about
Joey> several packages that use debconf to prompt the user for
Joey> information, then write the information to a file in /etc,
Joey> and when upgraded or reconfigured, clobber any manual
Joey> changes to the file (and no, I'm not just talking about
Joey> lilo).
I think the problem is (judging from my experience) some people
confuse these issues:
1. prompting for information.
2. storing the information with-out destroying existing configuration.
1 is easy, and now even easier with debconf. 2 is not so easy. When I
once asked about this (debian-devel I think), I was told that debconf
can provide a solution for both 1 and 2, however that is not the case.
I think there are a number of difficulties involved in 2, eg different
file formats, etc. Also I often wonder of the possibility of producing
an invalid config file, eg. if the postinst script accidently
adds/modifies a config element so it is incompatible with something
else the user has specified manually.
Joey> There is even a package called libconfhelper-perl that is
Joey> desiged specifically to help you do this (using a slightly
Joey> different method), if you don't mind using perl. Perhaps we
Joey> should write something equivilant for plain shell scripts.
Interesting. I probably should have a look at this some time.
Joey> Anyway, I plead once more -- don't abuse debconf! Use it in
Joey> moderation, think about what you're doing and how the admin
Joey> will deal with it. Do things right.
Also, you might be interested in how I did heimdal-lib.
I have a program, setconfig that automatically adjusts /etc/krb5.conf
as required by debconf. While it might have bugs, I have not got any
bug reports yet <grin>.
However, I think this is the general way we should be headed. That is
we should have helper programs specific to the file format[1] (and I
think you will find that there are only a small number of formats used
by all programs), that can set/retrieve the required settings.
Note:
[1] by file format (is there any better way of describing what I
mean?), I mean something like:
<setting> <value>
<setting> <value>
etc
and not the settings themselves:
ipaddress ?????????
hostname ???????????
so, for example, I would consider XML or SGML a file format, but not
HTML.
--
Brian May <bam@debian.org>
Reply to: