我正在从Ubuntu 18.04.1。上的预设文件加载并执行此bash文件。安装工作正常,我的bash文件已下载并执行,但有错误。
错误消息:“激活/询问不存在”。我尝试对此进行故障排除并阅读了debconf dev配置,但无法真正识别出我在做什么错。有任何想法吗?谢谢
编辑:如果我在安装和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
模板已重命名,因此不必担心那里的不匹配。谢谢
答案 0 :(得分:0)
这与脚本的执行方式有关。
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