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?
I think you would like to use
%files
%config(noreplace) /path/to/config/file
In this case:
/path/to/config/file.rpmnew
/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