Search code examples
rpmprefixrpmbuildrpm-spec

How to make use of $RPM_INSTALL_PREFIX in spec file?


We are trying to make a relocatable rpm and wanted to use the prefixs below to relocate the files .

Prefix: %{buildroot}/etc 
Prefix: %{buildroot}/usr/bin 
Prefix: %{buildroot}/usr/sbin 
Prefix: %{buildroot}/usr/share 
Prefix: %{buildroot}/var 

    %install

    mkdir -p $RPM_INSTALL_PREFIX

However we are not able to get the value of $RPM_INSTALL_PREFIX while running the rpm build


Solution

  • RPM_INSTALL_PREFIX is only available at install time (e.g. %pre) for relocatable RPMs (which nearly never work BTW). See http://ftp.rpm.org/max-rpm/s1-rpm-reloc-building-relocatable.html for more info.