7

我创建了一个小型 Debian 软件包,它必须从用户那里获取输入并将其打印出来。

为了从 postinst 脚本上的用户“读取”命令中获取输入,我不知道确切的原因是什么,但它在 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

有谁知道我做错了什么?

4

1 回答 1

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
于 2015-04-06T13:44:11.293 回答