mr.nothing
mr.nothing

Reputation: 5399

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. 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.

Is there any way to know which files were edited in such a situation?

Upvotes: 3

Views: 4439

Answers (2)

glglgl
glglgl

Reputation: 91149

@mvp has provided a good way to determine changed config files - provided they are marked as such.

If they aren't, you can/should verify the installed package with rpm -V packagename in order to display any changed files.

Upvotes: 7

mvp
mvp

Reputation: 116437

If you are talking about config files related to given package, rpm already has pretty robust mechanism for this known as .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:

  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. Presence of *.rpmnew file typically means that old config was NOT edited.
  2. Old config is renamed to /etc/myprog/config.rpmsave, and new one is installed as/etc/myprog/config (replacing old one). New config may be completely fresh (vanilla) or it may incorporate settings inherited from old, .rpmsave'd version. Presence of *.rpmsave files is pretty robust sign that config files were actually edited by 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

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. You can use diff -u to see text diffs or meld for graphical diff/merge.

Upvotes: 5

Related Questions