Why is my debian/config script not called during installation?

915 views Asked by At

I want to use debconf in my debian package to get some user input. I have a debian/config file:

#!/bin/sh
set -e
. /usr/share/debconf/confmodule
db_fset dn-native-drivers/choose_port seen false
db_clear
db_purge
db_input critical dn-native-drivers/choose_port || true
db_go

and a debian/templates file:

Template: dn-native-drivers/choose_port
Type: string
Default: 50
Description: Which vcom-port should be used?
 The port can be changed later in /etc/dn with the property
 vcom.nativePort

when I call the config script by myself its just doing what I want (displaying debconf question) but when I build the package with dpkg-buildpackage -us -uc and then install it with dpkg -i packagename the Question is not being displayed. I checked if the config and templates files been inside the control.tar.gz and they are there. I use raspbian if that matters. Why is my control script not being called during installation?

2

There are 2 answers

0
Eisen On BEST ANSWER

Ok i noticed that the config script is called (using a echo statement to stderr) Using the debugging mode:

DEBCONF_DEBUG=developer
export DEBCONF_DEBUG

I could feature out that the problem was that the templates could not be found. The problem are in the lines:

db_clear
db_purge

My intention on that was to make sure debconf dont have saved already the configuration values, but this statements deleted the former defined template definition. After removing them the dialog opens during installation.

0
MatthiasRoelandts On

The db_fset dn-native-drivers/choose_port seen false line seemed to be crucial if you want to be asked the question during an install.

Otherwise I had the problem that it only asked the question during a dpkg-reconfigure.