【问题标题】:dpkg-deb --build : debconf fails when I use db_inputdpkg-deb --build :当我使用 db_input 时,debconf 失败
【发布时间】:2018-03-26 11:03:57
【问题描述】:

我正在尝试使用dpkg-deb --build 命令构建一个包。

当我尝试使用 db_input 时,它失败了:

dpkg-deb --build audionet-0.0.8b/
dpkg-deb: building package `audionet' in `audionet-0.0.8b.deb'.

lintian audionet-0.0.8b.deb 
W: audionet: binary-without-manpage usr/bin/audionet

sudo dpkg -i audionet-0.0.8b.deb 
(Reading database ... 294473 files and directories currently installed.)
Preparing to unpack audionet-0.0.8b.deb ...
you start preinst file
dpkg: error processing archive audionet-0.0.8b.deb (--install):
 subprocess new pre-installation script returned error exit status 128
you are in postrm file
you start postinst file
you leave postinst file
Errors were encountered while processing:
 audionet-0.0.8b.deb

我的预安装文件是:

#!/bin/sh

# Exit on error
set -e

# echo something
echo "you start preinst file"

# Source debconf library.
. /usr/share/debconf/confmodule

# Ask questions
db_input medium audionet/question1 || true
#~ db_input medium audionet/question2 || true

# Show interface
db_go || true

echo "you leave preinst file"

模板文件:

Template: audionet/question1
Type: select
Choices: YES, no, dont know
Description: presence proxy :
 Do you use a proxy.

Template: audionet/question2
Type: string
Description: proxy def :
 Proxy serverport.

我还注意到安装没有进入配置文件,因为没有显示回显:

#!/bin/sh

# Exit on error
set -e

# echo something
echo "you are in config file"

# Source debconf library.
. /usr/share/debconf/confmodule

#~ # Ask questions
#~ db_input medium audionet/question1 || true
#~ db_input medium audionet/question2 || true

# Show interface
db_go || true

我找不到问题所在。

谢谢。

【问题讨论】:

  • 在尝试对错误进行分类时,将LANG=C 附加到命令中,以便显示“标准”错误消息(我们可以搜索来源)。
  • 追加LANG=C 到哪个命令?已经尝试了这三个,除了添加错误之外似乎没有任何改变。
  • 例如LANG=C dpkg-deb ...,所以你会得到代码中的错误。
  • “前置”,抱歉
  • 似乎仅此而已:LANG=C dpkg-deb --build audionet-0.0.8b/ dpkg-deb: building package `audionet' in `audionet-0.0.8b.deb'.

标签: debian dpkg debconf


【解决方案1】:

我认为这里可能存在两个问题。首先,您不能在运行 debconf 的脚本中将输出输出到标准输出。在preinst 中运行/usr/share/debconf/confmodule 后,preinst 脚本将从头重新启动,并且 echo 语句再次运行。要解决此问题,请运行 echo 2>&1 in preinst 。在当前脚本中,回显行会中断与 debconf 的通信通道。

获取模板的访问权限也可能存在问题。它看起来像 debconf 的前端(请参阅/usr/share/debconf/frontend 相当努力地获得对 preinst 脚本中模板的访问权限,但它可能存在一些问题。一旦你修复 preinst 脚本不将输出发送到标准输出,这肯定会破坏一切,可能是整个问题,导出 DEBCONF_DEBUG=developer 并重新运行脚本。这将跟踪所有 debconf 操作。

【讨论】:

    猜你喜欢
    • 2021-10-14
    • 2020-03-26
    • 2016-06-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-27
    相关资源
    最近更新 更多