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

Re: Problems with using debconf in init script...



Matt Zimmerman <mdz@debian.org> writes:

> On Mon, Jan 29, 2001 at 08:15:37PM -0800, Philippe Troin wrote:
> 
> > What about (4) which I implemented for am-utils:
> > 
> >   4) The debconf config script writes the values it needs as a shell
> >      script to /etc/default/<package>. Once the file is written, its
> >      md5sum is stored inside debconf.
> > 
> >      When the debconf config script (re-)runs and finds the
> >      /etc/default/<package> file, it md5sums it, and compares the sum
> >      with the stored one.
> 
> There is some question as to whether it's a good idea for the config
> script to be dependent on access to the filesystem.

Which should there be a problem here ? We're just _writing_ a file in
/etc/default ?

> > Now, this could be folded into debconf, since all the above steps
> > can be automated !
> > [...]
> 
> I think this is going a little far, having debconf actually write the config
> file for you.  

It is _not_ a config file. It's a "selective dump" of debconf's database.

> I would rather have a simple, conffile-like mechanism to keep track
> of whether or not the user has edited the config file.  If so, we
> ask them whether or not it's OK to clobber their changes.  If not,
> we write our would-have-been config file to
> config-file.dpkg-something where they can examine it and take what
> they like.

Did you read my proposal ? That's exactly what you propose, except
that if the file has been changed along some rules (namely, only
variable values have been changed, and these new values fit debconf's
allowed values), then nothing is lost and the manually changed values
can be imported into debconf.

> I started implementing something like this, using a set of shared debconf
> templates and some debhelper magic.  It has the following parts:
> 
> - A debconf-templates package, containing the templates to use.
>   These contain substitution variables for the name of the
>   configuration file and the name of the package, and are used for
>   prompting the user and storing the md5sum.
> 
> - A debhelper script (named?) which takes the names of these kinds of config
>   files (they need a name) and generates code for .config and .postinst
> 
> - Some modifications to dh_installdeb to allow substitution into .config
> 
> Only the first of these three is actually done.  I implemented the
> second part for a similar experiment using debconf to prompt the
> user about setuid permissions and adding statoverrides.

It looks like very complex to me (automatic script generation).
My proposal (again :-) only involves adding some extra headers to the
template file.

The debconf changes themselves are quite minimal I would think.
I might even look into it tomorrow :-)

> Once these are in place, making this work is as simple as adding one
> line to the rules file.  The only problem I encountered was that for
> things to work as they should, the debconf-templates package has to
> be installed before dpkg-preconfigure is run.  I know no way to
> guarantee this, apart from having the templates included in debconf.

That might be a problem, but maybe your templates could be included
with debconf...

Once again, Joey, are you with us ? What would you think is the best
way ?

Phil.



Reply to: