Apt错误:由您或脚本创建的系统上的文件

fja*_*fja 3 apt dpkg

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

sudo /usr/bin/apt-get install package-name <<< Y
Run Code Online (Sandbox Code Playgroud)

提示是:

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] ?
Run Code Online (Sandbox Code Playgroud)

这是不起作用时的错误:

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

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

tri*_*eee 8

您应该传入一个dpkg选项,在提示符下指定此方案中的所需行为.然后它不会提示.

sudo apt-get -o DPkg::Options::="--force-confnew" -y install package-name
Run Code Online (Sandbox Code Playgroud)

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

  • 相反,请使用:`--force-confold`。 (4认同)
  • 这很有效,三胞胎-谢谢。我将命令修改为:`sudo apt-get -o DPkg :: Options :: =“-force-confnew” install package-name` (2认同)