Rpm upgrade handling of config files

user459811 picture user459811 · Jan 24, 2013 · Viewed 14.1k times · Source

I'm playing around with the rpm -upgrade command and noticed rpm has different ways of handling modified configuration files so it doesn't get lost during the upgrade. From what I understand, if a config file was modified and the package is upgraded with rpm -U, rpm will rename the original properties file as {file}.rpmsave and install the new configuration file with the original file name {file}.

However, when I attempt to run rpm -U with the package I've created, what I actually see is the original configuration file gets deleted and the new configuration file gets renamed to {file}.rpmsave. Is this the intended behavior? In my install script I also modify some text in the configuration file with "sed". Could this have interfered with the way rpm handles configuration file during an upgrade?

Answer

Corey Henderson picture Corey Henderson · Jan 25, 2013

This is the intended behaviour. If you want the configuration file to never get overwritten (and moved to .rpmsave), use %config(noreplace) instead of %config in the rpm .spec file, and the file won't be replaced. Instead, the new file from the rpm package will get created as .rpmnew, and the one there is left alone.