building RPM package: force to install in path of

2019-03-01 01:52发布

I have 2 dependent packages who should be placed in the same target. Package B is dependent on package A.

Package A can be relocated to any another location. I now want package B forced to be placed in the same target as package A. Or simply, package B should not be able to install without the same --prefix.

Any ideas how to acieve this?

I thought of putting a %pre script to check this. But thats not helpful I think, since I can't read the given "prefix" in this script - or can I?

Thank you for your help!

1条回答
Emotional °昔
2楼-- · 2019-03-01 02:11

Hah. So I did a bit of source diving and discovered that apparently (at least for rpm 4.8.0 I didn't look at other versions) the RPM_INSTALL_PREFIX and RPM_INSTALL_PREFIX# environment variables are set for the %pre (and possibly other scriptlets) to the values of (what appear to be the %{INSTPREFIXES} and/or %{INSTALLPREFIX} macros). [source link]

I would try those in your %pre script. They look like they will give you what you want.

Same code in rpm head.

查看更多
登录 后发表回答