简体   繁体   English

RPM中已更改文件的列表

[英]List of changed files in RPM

I wonder, if there is a way to do the following: I have rpmA-v1 installed on the system. 我想知道,如果有办法做到以下几点:我在系统上安装了rpmA-v1。 It has a lot of config files which user can edit for their purposes. 它有很多配置文件,用户可以根据其目的进行编辑。 Then, I want to install new version of rpmA, say, rpmA-v2 and before installing it I want to back up those config files, which were edited, not to edit config files one more time. 然后,我想安装rpmA的新版本,比如rpmA-v2,在安装之前我想备份那些已编辑的配置文件,而不是再次编辑配置文件。

Is there any way to know which files were edited in such a situation? 有没有办法知道在这种情况下编辑了哪些文件?

If you are talking about config files related to given package, rpm already has pretty robust mechanism for this known as .rpmnew / .rpmsave . 如果您正在讨论与给定包相关的配置文件,则rpm已经具有相当强大的机制,称为.rpmnew / .rpmsave

If package is being upgraded, at the discretion of package creator/maintainer there are 2 possible actions that may be taken by rpm : 如果正在升级软件包,则由软件包创建者/维护者自行决定, rpm可能采取两种可能的操作:

  1. Old config is preserved intact say at /etc/myprog/config , and new one is installed right next to it as /etc/myprog/config.rpmnew . 旧配置在/etc/myprog/config完整保留,并且新的/etc/myprog/config安装在它旁边,如/etc/myprog/config.rpmnew Presence of *.rpmnew file typically means that old config was NOT edited. *.rpmnew文件的存在通常意味着未编辑旧配置。
  2. Old config is renamed to /etc/myprog/config.rpmsave , and new one is installed as /etc/myprog/config (replacing old one). 旧配置重命名为/etc/myprog/config.rpmsave ,新配置安装为/etc/myprog/config (替换旧/etc/myprog/config )。 New config may be completely fresh (vanilla) or it may incorporate settings inherited from old, .rpmsave 'd version. 新配置可能是完全新鲜的(vanilla),也可能包含从旧的.rpmsave版本继承的设置。 Presence of *.rpmsave files is pretty robust sign that config files were actually edited by rpm . 存在*.rpmsave文件是相当健壮的标志,配置文件实际上是由rpm编辑的。

Typically, after upgrading of one or more packages (or the whole system) it is recommended to search for all .rpmnew / .rpmsave files using command like 通常,在升级一个或多个软件包(或整个系统)之后,建议使用类似命令搜索所有.rpmnew / .rpmsave文件

find /etc -name "*.rpmsave" -or -name "*.rpmnew"

and carefuly inspect all configs against their .rpmnew / .rpmsave versions (if they are around) to make sure that settings are correct. 并仔细检查所有配置的.rpmnew / .rpmsave版本(如果它们在附近)以确保设置正确。 You can use diff -u to see text diffs or meld for graphical diff/merge. 您可以使用diff -u查看文本差异或meld图形差异/合并。

@mvp has provided a good way to determine changed config files - provided they are marked as such. @mvp提供了一种确定更改的配置文件的好方法 - 只要它们被标记为这样。

If they aren't, you can/should verify the installed package with rpm -V packagename in order to display any changed files. 如果不是,您可以/应该使用rpm -V packagename验证已安装的软件包,以便显示任何已更改的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM