Search code examples
rpmrpm-spec

How to access --prefix value in spec file?


I have a query regarding rpms.

I am installing an rpm using "rpm --prefix=/home/cloud-user -ivh xyz.rpm" command.

I want to access this prefix(/home/cloud-user) inside the spec file.

which variable will have this value? how does the spec file access it from the command?

Note: I am working on relocatable directory and the rpm i am using, does not support relocatable directory. I am not specifying "Prefix: /home/cloud-user" in the spec file. I am just trying to access it from the command that i am using for installation.

To summarize, whatever path I specify in --prefix in my command while installing the rpm, I should be able to access it in the spec file of that particular rpm.

Thanks :)


Solution

  • FYI, relocatable RPMs are pretty broken and honestly not well supported.

    That being said, I believe the answer is "$RPM_INSTALL_PREFIX".