Linux – How to include a customized configuration file in a rebuilt RPM

linuxpackagingrhel5rpm

We've rebuilt a bunch of RPMs because we wanted to remove modules and change config options for items specific to our production environment. We're hosting them in a private repo, and have them signed with our own GPG key and have our company name appended to the package name.

TO save ourselves a step after installing the package, I'd like to replace the base config file with config files that are specific to our environment. I'm not very familiar with adding things to spec files. What's the easiest way to do this? Package file?

Best Answer

If the file you're replacing is already named in the specfile (i.e. you're really replacing it) then you need only replace the file during your build (typically done with a patch to the original source, but you could always replace the file in the original source archive, too). If you're adding a file, then you'll want to add the file to the "%files" section of the specfile.

I'd recommend having a look at the Packaging software with RPM series from IBM. It's very good, and will give you a lot of useful background on the subject.