I posted this question yesterday on -mentors, but since nobody answered,
it seems it isn't as trivial as I had hoped.
I have either some fundamental misunderstanding of how debconf or
maintainer scripts work, or there is an error in the descriptioin of how
debconf-using scripts should handle configuration files. In
debconf-devel(7), the section "Config file handling" under "ADVANCED
PROGRAMING WITH DEBCONF" suggests the following config script:
# Load config file, if it exists.
if [ -e $CONFIGFILE ]; then
. $CONFIGFILE || true
# Store values from config file into
# debconf db.
db_set mypackage/foo FOO
db_set mypackage/bar BAR
# Ask questions.
db_input medium mypackage/foo || true
db_input medium mypackage/bar || true
db_go || true
However, in case apt-utils is installed, this script will be run twice:
Once by dpkg-preconfigure, i.e. in the preinst stage, and once by
confmodule when the postinst script sources confmodule. As far as I can
see, this will have a confusing effect. Assume the configfile currently
and the local admin wants to change this to
using dpkg-reconfigure mypackage. This is what is going to happen:
- The config script is run and sources $CONFIGFILE, FOO is set to true,
mypackage/foo is set to true in the debconf database, too, and the
question is asked. The local admin answers to disable foo, and now
mypackage/foo is set to false in the database.
- The postinst script is run, sources confmodule, which executes config
again. config sources the (yet unchanged) $CONFIGFILE, FOO is set to
true, and again mypackage/foo is set to true in the debconf database.
This time, however, debconf does not ask the question again, so "true"
stays in the database.
- The postinst script is reexecuted by debconf, this time it really
runs, queries the debconf database, gets the answer "true" for
mypackage/foo, and does *not* change $CONFIGFILE.
Pleaase, tell me, where is my mistake?
Inst. f. Biochemie der Univ. Zürich