Fedora

“yum update”後如何互動合併配置文件

  • January 26, 2018

使用“yum update”更新系統包後,無法覆蓋的配置文件不會被替換,但我們可以在附近找到*.rpmnew文件。按照設計,系統管理員必須合併配置文件。

在 Gentoo Linux 中有一個etc-update 工具,它允許互動式地合併配置文件更改,如下所示:

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 中以互動方式合併配置?

這個 yum 外掛添加了“–merge-conf”命令行選項。使用此選項,Yum 將詢問您如何處理在更新軟體包時更改的配置文件。

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

我發現最接近 Gentoo 的etc-updaterpmconf

# 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

引用自:https://unix.stackexchange.com/questions/157060