gpt4 book ai didi

ubuntu - .deb 安装期间的 Debconf 对话框

转载 作者:太空宇宙 更新时间:2023-11-03 16:49:47 24 4
gpt4 key购买 nike

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

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

最佳答案

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

模板文件:

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

关于ubuntu - .deb 安装期间的 Debconf 对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32018433/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com