How to read input when installing Debian package on Debian systems

I created a small Debian package that should take data from the user and print it.

To enter user input, the command β€œread” on Postinst scripts will not work on Debian systems, I don’t know what reason, but it worked on Ubuntu systems.

Later I realized that we should use "debconf" for Debian systems using the 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 did wrong?

+7
source share
1 answer

Your postinst script should look like this:

 #!/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 
+1
source

All Articles