首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用debconf回答包安装问题

用debconf回答包安装问题
EN

Stack Overflow用户
提问于 2015-07-06 20:50:02
回答 1查看 1K关注 0票数 2

我有一个包,叫它foo,它有一个依赖于后缀的依赖项。我试图通过使用debconf回答问题来自动化foo的安装。foo的要求是它必须能够安装和配置所有东西,并且必须使用

代码语言:javascript
复制
sudo apt-get install foo

所以这样的事情是不能接受的:

代码语言:javascript
复制
DEBIAN_FRONTEND=noninteractive apt-get install -y foo

另外,请注意foo是在Ubuntu的新安装上安装的。

我尝试的第一件事是(在我的前期脚本中):

代码语言:javascript
复制
echo "postfix postfix/mailname string your.hostname.com" | debconf-set-selections
echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections

但那不管用。问题仍然出现在安装过程中。

然后我试了一下:

代码语言:javascript
复制
echo "postfix postfix/mailname string your.hostname.com" | debconf-set-selections
echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
DEBIAN_FRONTEND=noninteractive apt-get install -y postfix

这是:

代码语言:javascript
复制
echo "postfix postfix/mailname string your.hostname.com" | debconf-set-selections
echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
DEBIAN_FRONTEND=noninteractive apt-get install -y postfix << _EOT
y
EOT

然后我想:

如果把借方那不管用。

但是,如果我执行以下操作(通过命令行而不是preinst脚本),那么安装就可以正常工作了:

代码语言:javascript
复制
sudo apt-get install debconf-utils
echo "postfix postfix/mailname string your.hostname.com" | debconf-set-selections
echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
sudo apt-get install foo

但是,对于我所给出的要求,这是不可接受的。

所以现在我被困住了。如果有人能挑出我做错了什么,那将是非常感激的,因为我已经寻找了一段时间的答案。

EN

回答 1

Stack Overflow用户

发布于 2015-07-07 08:52:14

奇怪的是,您不需要安装debconf-utils来为dpkg设置数据。

如果要防止对话框窗口,请尝试使用dpkg选项:

--force-confdef(force to keep default option without prompting)

--force-confold (force to keep old conf files)

最后,情况会是这样的:

echo "postfix postfix/mailname string your.hostname.com" | debconf-set-selections

echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections

sudo apt-get install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" foo

我希望这会有帮助。如果没有,请在此通知我们。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31255349

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档