0

I have created a RPM package and it is uploaded to my local yum repository. When I (or future user) install + edit config files of the package and then remove the package (yum remove <package>) config files are renamed or removed.

package.spec:

%files
%defattr(-, root, root, -)
%dir /etc/something

/etc/something/someA.conf                     # removed
%config /etc/something/someB.conf             # removed
%config(noreplace) /etc/something/someC.conf  # renamed => someC.conf.rpmsave

If user remove or update the package, I want to keep modified config files unchanged. How can I do that? Thnaks.

0

It is not possible.

For more details and all combination of %config* and *{rpmsave,rpmnew} see https://www.cl.cam.ac.uk/~jw35/docs/rpm_config.html

RPM is not a config manager. It recognizes just two states: changed or original file.

It is highly advised to use Ansible for config management. Or you can use rpmconf for handling conf updates on the command line.

BTW: A little nitpick: the %defattr(-, root, root, -) is not needed since ages. You probably got it from some old tutorial. Just delete it. It is no-operation.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.