Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rpm upgrade handling of config files

Tags:

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?

like image 953
user459811 Avatar asked Jan 24 '13 21:01

user459811


1 Answers

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.

like image 155
Corey Henderson Avatar answered Oct 21 '22 01:10

Corey Henderson