2012-06-04 101 views
7

我已经创建了一个小型Debian软件包,它必须从用户那里接受输入并将其打印出来。如何在Debian系统上安装Debian软件包时读取输入信息

为了从postinst脚本的用户“读”命令输入脚本不能在Debian系统上工作我不知道确切的原因是什么,但它在Ubuntu系统中工作。

后来我发现我们必须通过使用模板文件来为Debian系统使用“debconf”。

模板文件:

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

的postinst脚本:

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

但是,当我安装我的测试包我得到这个错误:

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

有谁知道我做了什么错误?

+0

我已经解决我自己的问题,我错过了配置脚本,避免配置脚本echo语句 –

回答

1

的postinst脚本应该如下所示:

#!/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 
相关问题