Issue
I want to create an RPM that contains a file for the user to customize, with an initial default template configuration.
I don't want to clobber that file if the user has edited it. I don't even want to move the user file to a backup - I just want to leave it alone.
Is that possible, without writing some kind of postinstall logic to test whether to copy the template to the target path? Can I declare a file as "editable" so it won't be overwritten if it has changed?
Solution
I think you would like to use
%files
%config(noreplace) /path/to/config/file
In this case:
- if the user edited the file; it will always remain like that, even after an update
- if an update contains a new template; the new template will be saved under
/path/to/config/file.rpmnew
- if an update contains a new template; and the user never edited the old template; the new template will simply be available under
/path/to/config/file
An excellent read on %config
and which file is kept in what usecase: http://people.ds.cam.ac.uk/jw35/docs/rpm_config.html
Answered By - Chris Maes Answer Checked By - Marie Seifert (WPSolving Admin)