2

What's the right way to create an RPM that modifies the %config(noreplace) files installed by another RPM?

Specific instance of the general question: We want to modify the repository definitions installed by almalinux-repos so that the definitions have a baseurl pointing to our internal mirror. Because the repository definitions are %config(noreplace) in almalinux-repos, we could modify them any number of ways. However, we'd like to have our modifications packaged as well.

One idea is to create a new package that Obsoletes: almalinux-repos. This would suggest using almalinux-repos as a BuildRequires and then including its files in the buildroot. It's so easy for Obsoletes to go bad that we are averse to this approach.

Another idea is to create a new package that Requires: almalinux-repos and then uses %patch to modify its files.

Secondary question: Assuming we use the %patch mechanism, should we add Supplements: almalinux-repos to our new package so that it is automatically included in package resolution?

David M
  • 123
  • 4

1 Answers1

0

Your secondary approach has the issue that you can't have modified the files from the almalinux-repos package before installing your local package. If there are modifications, there is a likelihood of the %patch failing to apply properly.

My approach would be to not use an RPM file, but to use Ansible to ensure the correct settings are in the configuration files of interest. There are a lot of other possibilities out there - this approach is far more of an opinionated solution than a One True Solution.

John
  • 16,759
  • 1
  • 34
  • 43