Re: conditional installation of files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Dec 16, 2012 at 11:54 AM, Stefan Koebeli <stefan@xxxxxxxxxx> wrote:

Hi everybody,

Hi have a question to rpm packaging and installation. I just found no help on the internet for these question, wy i try it here.

I have a big challenge to do more or less the same as with Solaris's PKG mechanisms. Exactly what i should do is, installing files based on the environment the machine is. Let's say we have 3 stages as environments, TEST, UAT and PROD. Now, with Solaris pkg I'm able to check these env. with a checkinstall script, and then the pkg, created with the Prototype, and the files are marked with these stages in CLASSES column, the files are installed based on these env variables.

Means, installing all stages with one package.

Does anybody has an idea how i can realize this with RPM? I spent a lot of time with Google, but found not really answers where helps.

Is it possible to do something with macros?

So in general there is no 'direct' way to accomplish what you are asking for.  There are 2 paths you can take though.

1: Have your rpmbuild generate 3 subpackages (test, uat, prod) containing the differences, while the main package contains the rest of the files.  The nice thing about this concept is the main package is the same between the environments, and the rpm installed can readily tell you which environment is configured.  Unfortunately, it means you have to install the rpm for the environment by name.  But if you use a configuration management system that is easy to hide with a variable.

2: Have the rpm lay down all of the files, but not in the final path.  So something like putting them all in %{_datadir}/$environment/, and then in the post script symlink the files to their appropiate path depending on the envirnoment you want configured.  You'll want to own the symlinks too, so you can use the %ghost directive.  The bad part about this method is that you are creating files in the scriplets, which is considered a bad practice.

http://www.rpm.org/max-rpm-snapshot/s1-rpm-inside-files-list-directives.html#S3-RPM-INSIDE-FLIST-GHOST-DIRECTIVE

Personally, I think the first path is better.
_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxxxxx
http://lists.rpm.org/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux