更新时间:2023-02-02 20:39:55
我也遇到了类似的问题。
I had similar problem.
1)如果您看一下 man apt-get
,您会发现一个配置选项 -o
。
它允许为Debian软件包管理器 dpkg
设置选项。
1) If you take a look man apt-get
, you will find a configuration option-o
.
It allows to set options for Debian package manager dpkg
.
2)在手册 man dpkg
,您可以找到选项集-force-confdef
(强制保留默认选项而不提示)和-force-confold
(强制保留旧的conf文件)
2) In the manual man dpkg
you can find set of options --force-confdef
(force to keep default option without prompting) and --force-confold
(force to keep old conf files)
在我发现的某些来源中,人们传递了env变量 DEBIAN_FRONTEND = noninteractive
也是如此,但是我在任何手册中都找不到。
In some sources I found, that people pass env variable DEBIAN_FRONTEND=noninteractive
as well, but I could not find it in any manual.
因此,中的最后一条命令。 sh脚本,我用于运行升级:
So, the final command in .sh script, that I use to run upgrade:
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade