How to create RPM subpackages using the same paths for different envs?

I would like to use rpm to create subpackages for different environments (in real time, for testing, for developers), but for the same files, therefore with a package called name-config-live, one of which is called name-config-testing, and one is name-config-developer and they have the same paths, but each with configurations that correspond to the environment they name. as an example

let's say that in all environments I have a file called /etc/name.conf, and when testing I want it to contain "1", in development "2" and in real time "3". Is it possible to do this in the same specification, since the generation of subpackages only happens in the wrong order in which I enter it. (and hopefully not with% post -n)

I tried using BuildRoot, but it seems like a global attribute

+4
source share
1 answer

I do not think that there is a native path; I would do %post as you noticed.

However, I would do this (similar to what I am doing with the internal package that I am developing to work):

  • Three separate files /etc/name.conf-developer , /etc/name.conf-live , etc.
  • All three packages have a virtual package, for example. name-config
  • name-config core package required
    • This will result in rpm , yum or whatever is required for at least one transaction.
  • All three packages conflict with each other.
  • Each configuration package %post (and possibly %verify ) /etc/name.conf symbolic link to the correct configuration
    • It also helps show the user what is happening.

Minuses:

  • It's a little hacky
  • rpm --whatprovides /etc/name.conf will say that it does not belong to any package
+3
source

Source: https://habr.com/ru/post/1437447/


All Articles