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

Re: use and abuse of debconf



   Now an example of a package that does it right. Its config script:

   #!/bin/sh -e
   . /usr/share/debconf/confmodule
   if [ -e /etc/foo ]; then
	   . /etc/foo || true
	   if [ "$QUESTION" ]; then
		   db_set foo/question $QUESTION
	   fi
   fi
   db_input medium foo/question || true
   db_go || true

Actually, this isn't quite right.  Consider what happens if you manage
to set up debconf so it always reasks questions then upgrade the
package with preconfiguration enabled:

* config script reads /etc file
* config script  asks question
* admin changes value
* config script updates debconf database
* unpacking happens
* config script gets called by postinst
* config script  reads  /etc file and overwrites admin choices

To solve this in my krb5 packages, I introduced a config template that
the user never sees which basically says whether the package has
written out the last set of debconf edits.  It's ugly, I don't like
it, but it works better than anything I've thought of.



Reply to: