.deb安装过程中的Debconf对话框

5

我成功创建了一个适用于Ubuntu的.deb安装文件,但是我需要用户输入来完成后续的配置过程。这些问题是动态的,并基于用户在他们的计算机上拥有的接口。

在Ubuntu软件中心使用debconf安装过程期间,是否存在一种方法可以提示用户回答动态答案的问题(例如:计算机上的接口列表)?

1个回答

4

我明白了。在模板文件中,您需要创建一个替换变量,并在配置文件中填充它。

模板文件:

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 $2;} ' | 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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接