ubuntu-12.04 – 如何在Ubuntu 12中的apt-get升级期间自动更改配置文件

前端之家收集整理的这篇文章主要介绍了ubuntu-12.04 – 如何在Ubuntu 12中的apt-get升级期间自动更改配置文件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我喜欢使用“knife cloudstack server create …”来构建一个新的VM.我的bootstrap模板以“apt-get update”和“apt-get -y upgrade”开始.

升级然后停止:

10.190.113.11 Configuration file `/etc/nscd.conf'
10.190.113.11  ==> Modified (by you or by a script) since installation.
10.190.113.11  ==> Package distributor has shipped an updated version.
10.190.113.11    What would you like to do about it ?  Your options are:
10.190.113.11     Y or I  : install the package maintainer's version
10.190.113.11     N or O  : keep your currently-installed version
10.190.113.11       D     : show the differences between the versions
10.190.113.11       Z     : start a shell to examine the situation
10.190.113.11  The default action is to keep your current version.
10.190.113.11 *** nscd.conf (Y/I/N/O/D/Z) [default=N] ?

所以真的有两个问题:

首先,我可以默认使用apt-get做某事吗?显然没有办法提供答案.

其次,我甚至不知道问题的正确答案应该是什么.它替换的配置文件来自模板.我还没有看到“nscd”甚至是什么. (据推测,“Y”是正确答案,但问题涉及的研究令人生畏.)

@H_403_12@
您可以传递参数以避免获得提示.这对我有用;
apt-get update
apt-get --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
apt-get --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade

–force-confold(我的选择)将使这些“您想对修改配置文件做什么”问题默认为N(保留您当前安装的版本)

--force-confold: do not modify the current configuration file,the new version is installed with a .dpkg-dist suffix. With this option alone,even configuration files that you have not modified are left untouched. You need to combine it with --force-confdef to let dpkg overwrite configuration files that you have not modified.
--force-confnew: always install the new version of the configuration file,the current version is kept in a file with the .dpkg-old suffix.
--force-confdef: ask dpkg to decide alone when it can and prompt otherwise. This is the default behavior of dpkg and this option is mainly useful in combination with --force-confold.
--force-confmiss: ask dpkg to install the configuration file if it’s currently missing (for example because you have removed the file by mistake).

> source

警告 – 如果保留一些修改后的配置文件,可能会破坏您的系统.与更新的软件包版本不兼容.请在部署自动解决方案之前对其进行测试.

猜你在找的Ubuntu相关文章