【问题标题】:Why is my debian/config script not called during installation?为什么我的 debian/config 脚本在安装过程中没有被调用?
【发布时间】:2019-09-13 23:16:36
【问题描述】:

我想在我的 debian 包中使用 debconf 来获取一些用户输入。我有一个 debian/config 文件:

#!/bin/sh
set -e
. /usr/share/debconf/confmodule
db_fset dn-native-drivers/choose_port seen false
db_clear
db_purge
db_input critical dn-native-drivers/choose_port || true
db_go

还有一个 debian/templates 文件:

Template: dn-native-drivers/choose_port
Type: string
Default: 50
Description: Which vcom-port should be used?
 The port can be changed later in /etc/dn with the property
 vcom.nativePort

当我自己调用配置脚本时,它只是在做我想做的事情(显示debconf 问题)但是当我使用dpkg-buildpackage -us -uc 构建包然后使用dpkg -i packagename 安装它时,问题没有被显示。我检查了配置和模板文件是否在 control.tar.gz 中并且它们在那里。如果这很重要,我会使用 raspbian。为什么我的控制脚本在安装过程中没有被调用?

【问题讨论】:

    标签: debian package debconf


    【解决方案1】:

    好的,我注意到调用了配置脚本(使用对 stderr 的 echo 语句) 使用调试模式:

    DEBCONF_DEBUG=developer
    export DEBCONF_DEBUG
    

    我可以指出问题在于找不到模板。问题出在以下几行:

    db_clear
    db_purge
    

    我的意图是确保 debconf 没有保存 已经是配置值,但此语句已删除 前者定义的模板定义。删除它们后,安装过程中会打开对话框。

    【讨论】:

      【解决方案2】:

      如果您想在安装过程中被问到这个问题,db_fset dn-native-drivers/choose_port seen false 行似乎至关重要。

      否则我遇到的问题是它只在dpkg-reconfigure 期间提出问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-03-21
        • 1970-01-01
        • 2018-07-11
        相关资源
        最近更新 更多