6

The following config script inside control.tar.gz

#!/bin/sh -e

. /usr/share/debconf/confmodule

db_fset mailadmin/database_host seen false
db_clear
db_purge

db_input medium mailadmin/database_host || true
db_go

db_get mailadmin/database_host
echo "$RET" > /tmp/from_config_script.txt

exit 0

with the template

Template: mailadmin/database_host
Type: string
Description: The database server's host name or IP address.

(file templates) does not show an input dialog when I install the package using dpkg -i, and when I run it from the command line as well.

Instead it writes "localhost" to /tmp/from_config_script.txt, even though this default value is not part of the template file any more. I never ever saw the input popup. The input popup is what I am trying to achieve.

I removed the package with apt-get purge mailadmin, but even purge did not clear this default value. What can I do?

user22611
  • 405
  • 5
  • 17

2 Answers2

5

Simple solution:

db_input high ...

This is not mentioned in the tutorial at http://www.fifi.org ( http://www.fifi.org/doc/debconf-doc/tutorial.html ), only in an indirect manner.

A priority of medium is too low for showing the dialog. The threshold priority must be set somewhere on the computer. Unfortunately I still do not know where. But at least I know how to make the dialogs work.

user22611
  • 405
  • 5
  • 17
1

After following the suggestion listed in the earlier answer, my config script would still not run no dialogs prompts etc. I finally stumbled across this comment in the following manpage article (see section The PostInst Script)

https://manpages.debian.org/testing/debconf-doc/debconf-devel.7.en.html

Always source /usr/share/debconf/confmodule at the top of your postinst, even if you won't be running any db_* commands in it. This is required to make sure the config script gets a chance to run (see HACKS for details).

Once I sourced the confmodule in postinst (even though I am not calling db_* commands here) my config script began to work as expected

sbeskur
  • 111
  • 3