2

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?

Karl Katzke
  • 2,596
  • 1
  • 22
  • 24

1 Answers1

3

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.

Evan Anderson
  • 141,881
  • 20
  • 196
  • 331
  • I replaced the file in the original archive, but I think there's something somewhere in the make process that overwrites it or edits it. The original file is named .conf.in -- if I replace that file, tar everything back up, and place that in the SOURCES dir, then it still doesn't make it into the final build. There is one line -- %{__install} -Dp -m0644 src/collectd.conf %{buildroot}%{_sysconfdir}/collectd.conf -- could I replace that with a different source and have it come out included? – Karl Katzke Oct 21 '10 at 17:58
  • 1
    @Karl Katzke: The build process creates the src/collectd.conf from src/collect.conf.in. You could include your tweaked-up configuration file in the package and modify the line referenced above, or create a package that contains only your configuration file and install it after the fact. Having to roll out a new package for the entire program because you altered your configuration would stop me from including the configuration file in the package. I'd create a package with just the configuration file in it, personally. – Evan Anderson Oct 21 '10 at 18:37