Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 在Debian系统上安装Debian软件包时如何读取输入_Linux_Ubuntu_Package_Debian_Debconf - Fatal编程技术网

Linux 在Debian系统上安装Debian软件包时如何读取输入

Linux 在Debian系统上安装Debian软件包时如何读取输入,linux,ubuntu,package,debian,debconf,Linux,Ubuntu,Package,Debian,Debconf,我已经创建了一个小的Debian包,它必须从用户那里获取输入并打印出来 为了从用户的“读取”命令中获取输入,postinst脚本在Debian系统上不起作用,我不知道确切原因是什么,但它在Ubuntu系统中起作用 后来我发现我们必须通过使用模板文件为Debian系统使用“debconf” 模板文件: Template: test/input Type: text Description: enter some text, which will be displayed postinst脚本:

我已经创建了一个小的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
但是,当我安装测试包时,会出现以下错误:

无法执行“postinst”:在/usr/share/perl/5.10/IPC/Open3.pm第168行没有这样的文件或目录
open2:postinst configure的exec在/usr/share/perl5/Debconf/ConfModule.pm第59行失败

有人知道我做错了什么吗?

您的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

我已经解决了我自己的问题,我错过了配置脚本,并避免在配置脚本中使用echo语句