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

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

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.

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

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.

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.

 - mdz

Reply to: