ubuntu 使用 `dpkg -i` 进行“force-yes”

ubuntu 使用 `dpkg -i` 进行“force-yes”

我有一个用于从 deb 文件更新的系统更新脚本:

find /packages/apt/ -type f -name "*.deb" -exec dpkg --force-depends -i {} \+

问题是 nginx 的配置文件被更改了——因此提示:

Configuration file '/etc/logrotate.d/nginx'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   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     : start a shell to examine the situation
 The default action is to keep your current version.
*** nginx (Y/I/N/O/D/Z) [default=N]

并且(我认为,没有明确证明)它最终会超时并失败

我在标准输出中看到:

Setting up nginx (1.10.2-1~trusty) ...

Configuration file '/etc/logrotate.d/nginx'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   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     : start a shell to examine the situation
 The default action is to keep your current version.
*** nginx (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing package nginx (--install):
 EOF on stdin at conffile prompt

我怎样才能做一些与之比较的事情: apt-get install -y --force-yes?(在文档中没有找到任何内容)

答案1

好吧 - 最后很简单 - 只需在前面打一个“是”即可:

yes | find /packages/apt/ -type f -name "*.deb" -exec dpkg --force-depends -i {} \+

相关内容