在ubuntu安装过程中是否可以在preseed中提出任意问题

J.T*_*.T. 5 installation preseed

我已经构建了一个用于从裸机构建节点的自动安装系统,它生成一个非常基本的安装,然后安装 puppet 并联系 puppetmaster 进行其余的配置。我希望能够做的是在预种子中注入一个问题,这样我就可以问“这个服务器的作用是什么?” 这反过来只会将值写入一个临时文件,该因素将解析并包含在 puppet 目录运行中。

所以基本上,在安装过程中提出问题,提供可用答案列表并将响应写入文件。

这能行吗?

小智 3

您可以使用d-i preseed/late_command预置文件的部分来运行脚本,该脚本使用debconf来提出自定义问题。

示例脚本:

#! /bin/sh

# This is a debconf-compatible script
. /usr/share/debconf/confmodule

# Create the template file
cat > /tmp/myquestion.template <<'!EOF!'
Template: my-question/ask
Type: select
Choices: First, Second, Third
Description: Custom question
 Template for querying a basic text.

Template: my-question/title
Type: text
Description: My question text
!EOF!

# Load your template
debconf-loadtemplate my-question /tmp/myquestion.template

# Set title for your custom dialog box
db_settitle my-question/title

# Ask it!
db_input critical my-question/ask
db_go

# Get the answer
db_get my-question/ask

# Save it to a file
echo "$RET" > /tmp/answer.value
Run Code Online (Sandbox Code Playgroud)

脚本运行后,您将在文件中找到答案/tmp/answer.value

更多信息:https ://help.ubuntu.com/community/InstallCDCustomization/AccessDebconfFromYourScript