Thursday, August 19, 2010

RPM Relocatable

Relocatable package is give control to installer for installing in a perferred location. A RPM software package install files in /usr/share by default but user may want to install package in /etc/ location then specifying the relocatable will be useful for the users.
All the RPM are not relocatable and it is just a vendor giving control or option for installing in perferred locations. Most package are not relocatable.
To make it a package as relocatable you should add some scripts in SPEC file.

Below line has to written in Preamble/introduction section of RPM SPEC file.

Prefix: dir

Given file installating in /usr/share and /etc are relocatable.
Prefix: /usr/share
Prefix: /etc

RPM will install as like given in %files section. You can override with "--prefix dir". For example, if your package is going to install in /etc directory, you can install package in /usr/share by "rpm --prefix /usr/share"

For the multiple relocation, use --relocate argument as rpm.

rpm . --relocate /etc/=/usr/share --relocate /var=/usr

No comments: