We're developing a java product that's installed via rpm. We have a set of config files that a user can edit. These config files are java properties files in the form:
com.acme.pkg1.setting=something customized 1 com.acme.pkg2.setting=something original 2
These files are marked in the SPEC file with %config(noreplace), so after an upgrade, we could have an .rpmnew file next to it:
com.acme.pkg1.setting=something original 1 com.acme.pkg2.setting=something original 2 com.acme.pkg3.setting=something original 3
Is there a way to merge these files in such a way that only new keys are added to the original file?
My idea was:
- filter the keys
- sort the keys
- use comm(1), something like: comm -23 file.rpmnew.keys file.keys > new.keys
- extract key=value from file.rpmnew matching new.keys
- append result to original file
How can we achieve all this in from an rpm post-update script?
Preferably using only standard linux utilities (comm, diff, sed, awk, grep, ...)?