0

I am trying to build a package using dpkg-deb --build command.

When I try to use db_input, it fails :

dpkg-deb --build audionet-0.0.8b/
dpkg-deb: building package `audionet' in `audionet-0.0.8b.deb'.

lintian audionet-0.0.8b.deb 
W: audionet: binary-without-manpage usr/bin/audionet

sudo dpkg -i audionet-0.0.8b.deb 
(Reading database ... 294473 files and directories currently installed.)
Preparing to unpack audionet-0.0.8b.deb ...
you start preinst file
dpkg: error processing archive audionet-0.0.8b.deb (--install):
 subprocess new pre-installation script returned error exit status 128
you are in postrm file
you start postinst file
you leave postinst file
Errors were encountered while processing:
 audionet-0.0.8b.deb

My preinst file is :

#!/bin/sh

# Exit on error
set -e

# echo something
echo "you start preinst file"

# Source debconf library.
. /usr/share/debconf/confmodule

# Ask questions
db_input medium audionet/question1 || true
#~ db_input medium audionet/question2 || true

# Show interface
db_go || true

echo "you leave preinst file"

templates file :

Template: audionet/question1
Type: select
Choices: YES, no, dont know
Description: presence proxy :
 Do you use a proxy.

Template: audionet/question2
Type: string
Description: proxy def :
 Proxy serverport.

I also noticed that the installation doesn't goes to config file as echo is not displayed :

#!/bin/sh

# Exit on error
set -e

# echo something
echo "you are in config file"

# Source debconf library.
. /usr/share/debconf/confmodule

#~ # Ask questions
#~ db_input medium audionet/question1 || true
#~ db_input medium audionet/question2 || true

# Show interface
db_go || true

I can't find out what's the problem.

Thanks.

doom
  • 3,276
  • 4
  • 30
  • 41

1 Answers1

1

I think there are potentially two problems here. First, you cannout output to standard output in a script that runs debconf. Once you run /usr/share/debconf/confmodule in the preinst, the preinst script is restarted from the beginning, and the echo statement runs again. To work around this run echo 2>&1 in preinst . In the current script, the echo line will disrupt the communication channel with debconf.

It's also potentially possible that there is some problem gaining access to the templates. It looks like debconf's frontend (see /usr/share/debconf/frontend works fairly hard to gain access to the templates in a preinst script, but it's possible there is some issue with that. Once you fix the preinst script not to send output to stdout, which will definitely break things and may be the entire problem, export DEBCONF_DEBUG=developer and rerun the script. This will trace all debconf operations.

Sam Hartman
  • 6,210
  • 3
  • 23
  • 40