[Debconf-devel] Modify default value in template at runtime?

Lukas Haemmerle lukas at haemmerle.net
Thu Jul 27 12:22:09 UTC 2006


Sorry if this is not the right place to ask but I haven't found a better
place to ask.

I would like to know if there is a solution for the following debconf

During configuration of the package, I want to ask the user 2 questions.
E.g. question 1: What is your hostname? The default value of question 2
shall depend on the value entered in question one. E.g. question 2:
Enter the webmaster email address of your host. The default value for
that second question shall be  webmaster@{ValueEnteredInQuestion1}

How can this be done and can it be done at all? I have spent about three
hours trying to figure this out.

The following approach with db_set question2
"webmaster@{ValueEnteredInQuestion1}" works only half.

db_input medium some-package/hostname || true
db_go || true
db_get ssome-package/hostname

db_set some-package/supportContact "webmaster@${hostname}"
db_input medium some-package/supportContact || true
db_go || true

The default value displayed in the default frontend indeed is
"webmaster@${hostname}", however when the user changes that value to
something completely different (e.g. "admin at some.other.host.com") this
entered value is ignored and "webmaster@${hostname}" is stored in
debconf... Numerous atempts with db_unregister and db_fset have failed.

So, is there a way to modify a default value displayed in the front-end
at runtime such that it is stored correctly in debconf even if the user
changes this presented default value to something else?

Best Regards

Lukas Haemmerle
lukas at haemmerle.net

More information about the Debconf-devel mailing list