bash - Ubuntu Preseed 和模板
问题描述
我正在从 Ubuntu 18.04.1 上的预置文件加载和执行这个 bash 文件。安装工作完美,我的 bash 文件已下载并执行,但出现错误。
错误消息:“激活/询问不存在”。我尝试对此进行故障排除并阅读 debconf 开发配置,但无法真正确定我做错了什么。有任何想法吗?谢谢
编辑:如果我在安装和 wget 期间进入 shell,chmod 这个 post.sh 脚本,一切正常。有任何想法吗?
#!/bin/sh
# Library to interact with debconf.
. /usr/share/debconf/confmodule
# Create the template file
cat > /tmp/activate.template <<EOL
Template: activation/title
Type: text
Description: Activate
Template: activation/ask
Type: string
Description: Enter Activation Code
EOL
# Load your template
debconf-loadtemplate activation /tmp/activate.template
# Set title for dialogue box
db_settitle activation/title
# Input activation code
db_input critical activation/ask
db_go
# Fetch input from user
db_get activation/ask
# Save it to a file
echo "$RET" > /root/answer.value
#Error message: activation/ask does not exist
模板已重命名,因此不必担心那里的不匹配。谢谢
解决方案
这与脚本的执行方式有关。
d-i preseed/late_command string \
in-target /usr/bin/wget -O /root/post.sh http://<ip>/preseed/post.sh; \
in-target /bin/chmod +x /root/post.sh; \
in-target /bin/bash /root/post.sh
推荐阅读
- flutter - 如何在 Mobx Flutter 中声明 observable 以在类的字段更改时触发?
- docusignapi - 升级到官方环境,收到如下错误“提供的客户端id没有在DocuSign注册”
- c - 尝试使用 malloc 分配内存时出错(读取冲突),它有时适用于前几个字符串,但最终会爆炸
- asp.net-core - 从 OnInitializedAsync Blazor 调用 javascript 时出现 JavaScript 互操作错误
- python - 哪个游戏引擎用于后台视频
- spring-boot - 由于检测到重复 ID,无法启动路由 [A]:[B]
- linux - 使用 crontab 拒绝权限
- php - 使用未知输入名称更新表
- azure - 在发现和评估期间添加服务器时在 azure migrate 设备中抛出访问被拒绝错误
- php - 如何使用return代替echo来输出html?