.deb 安装期间的 Debconf 对话框

Debconf dialog during .deb installation

我已成功为 Ubuntu 创建 .deb 安装文件,但我需要用户输入才能完成 post 安装脚本的配置。这些问题是动态的,并且基于用户在其计算机上的界面。

在 Ubuntu Software Center 使用 debconf 的安装过程中,有没有办法向用户提示具有动态答案的问题(即他们计算机上的接口列表)?

知道了。在模板文件中,您创建一个替换变量并将其填充到配置文件中。

模板文件:

Template: pkg/interfaces
Type: select
Choices: ${choices}
Description: .....

配置文件:

declare -a options;
count=0;

## Get interfaces from the operating system
for interface in $(ip link show | awk '/^[0-9]/ {print ;} ' | sed 's/:$//');
do
    if [ $interface != "lo" ] && [ $interface != "" ] ;
    then
        options[$count]=$interface;
        count=$((count+1));
    fi
done

# Set the choices the user has
db_subst pkg/outface choices $options