6

我有一个简单的 bash 脚本,它连接到一系列服务器并更新特定的包,使用 here-string 来回答提示:

sudo /usr/bin/apt-get install package-name <<< Y

提示是:

Configuration file /etc/package-name/package-name.conf
==> File on system created by you or by a script.
==> File also in package provided by package maintainer.
  What would you like to do about it? Your options are:
  Y or I : install the package maintainer's version
  N or O : keep your currently-installed version
    D    : show the differences between the versions
    Z    : background this process to examine the situation
 The default action is to keep your current version.
*** package-name.conf (Y/I/N/O/D/Z [default=N] ?

这是它不起作用时的错误:

dpkg: error processing package-name (--configure):
EOF on stdin a conffile prompt
Errors were encountered while processing:
package-name

我无法在服务器上安装期望或任何其他程序。任何帮助,将不胜感激。

4

2 回答 2

14

您应该传入一个dpkg选项以在提示符处指定此场景中所需的行为。然后就不提示了。

sudo apt-get -o DPkg::Options::="--force-confnew" -y install package-name

(未经测试;通过谷歌搜索获得。)

于 2011-08-23T06:43:07.943 回答
3

如果您查看 apt-get 手册页,您可以找到一个选项 (-y) 为您回答“是”。为什么不试试呢。

于 2011-08-23T04:39:58.283 回答