Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read input while installing Debian package on Debian systems

I have created a small Debian package which has to take the input from the user and print it out.

In order to take input from user "read" command on postinst scripts will not work on Debian systems I don't know what is the exact reason, but it worked in Ubuntu systems.

Later I have figured out that we have to use "debconf" for Debian systems by using a template file.

Template file:

Template: test/input
Type: text
Description: enter some text, which will be displayed

postinst script:

 db_get test/input
    echo "you have entered ::$RET" >&2

But when I install my test package I get this error:

Can't exec "postinst": No such file or directory at /usr/share/perl/5.10/IPC/Open3.pm line 168. <br>open2: exec of postinst configure failed at /usr/share/perl5/Debconf/ConfModule.pm line 59

Does anyone know what I have done wrong?

like image 566
forum.test17 Avatar asked Jun 04 '12 17:06

forum.test17


1 Answers

Your postinst script should look like the following:

#!/bin/bash

set -e

. /usr/share/debconf/confmodule

case "$1" in
  configure)
    db_get test/input
    echo "you have entered ::$RET" >&2
  ;;
esac
db_stop
like image 142
Mih V An Avatar answered Sep 27 '22 19:09

Mih V An