如何在“yum update”后交互式地合并配置文件

如何在“yum update”后交互式地合并配置文件

使用“yum update”更新系统包后,无法覆盖的配置文件不会被替换,但我们可以在附近找到*.rpmnew文件。根据设计,系统管理员必须合并配置文件。

在 Gentoo Linux 中有一个等更新工具,它允许以交互方式合并配置文件更改,如下所示:

Beginning of differences between /etc/pear.conf and /etc/._cfg0000_pear.conf
[...]
End of differences between /etc/pear.conf and /etc/._cfg0000_pear.conf
1) Replace original with update
2) Delete update, keeping original as is
3) Interactively merge original with update
4) Show differences again

我想知道是否有一种方法可以在 RHEL/Fedora/CentOS 中交互式地合并配置?

答案1

我发现的最接近 Gentoo 的东西etc-updaterpm配置文件:

# yum install -y rpmconf    
# rpmconf -a
Configuration file `/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.25-5.b18.fc21.x86_64/jre/lib/security/US_export_policy.jar'
-rw-r--r--. 1 root root 620 Oct  2 16:38 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.25-5.b18.fc21.x86_64/jre/lib/security/US_export_policy.jar
-rw-r--r--. 1 root root 620 Dec 15 12:11 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.25-5.b18.fc21.x86_64/jre/lib/security/US_export_policy.jar.rpmnew
 ==> 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
      M     : merge configuration files
      Z     : background this process to examine the situation
      S     : skip this file
 The default action is to keep your current version.
*** aliases (Y/I/N/O/D/Z/S) [default=N] ? 
Your choice: Y

答案2

这个 yum 插件添加了“--merge-conf”命令行选项。使用此选项,Yum 会询问您如何处理更新软件包时已更改的配置文件。

https://apps.fedoraproject.org/packages/yum-plugin-merge-conf

答案3

到目前为止我发现的唯一方法是 vimdiff:

vmdiff 窗口,突出显示不同行

相关内容