I need to periodically update multiple CentOS servers with a custom software package using RPM packaging. The software has multiple directories and files, some of which are configuration files which has multiple variables with local server-specific values.
I've been reading the RPM documentation about configuration files which is explaining how to make them properly and so to leave them untouched. But I actually need to update the content of configuration files too preserving only some local variable values. So I see two possible ways:
Mark such files as configuration files and using the %post
directive in rpmuild's spec file to update each such file with the difference after yum update
is executed remote server.
The second way is just the opposite: yum update
replaces everything, but thanks to %post
directive some variables on the respective files on remote servers are updated with the local values.
So my question is which way is better one, which way is recommended by experienced RPM package builders - I am total newbie here, so bear with me please.
The best approach to local configuration with *.rpm packaging is to change the configuration paradigm to include 2 files, one containing generic default configuration from the package, the other having local configuration with (possible) overrides.
RPM does best distributing static content, not mutable configuration files.