简体   繁体   中英

How To make relocatable rpm?

I have java application with pom.xml. I am making rpm package with prefixes tags .

When I am querying on prefix tags of rpm :

sudo rpm -qp --queryformat "%{prefixes}\n" java-hbase-processor-1.0-SNAPSHOT20160330060627.noarch.rpm 

I got ==> /var

IF I run following command :

rpm -qi java-hbase-processor | grep Relocations

I got : Relocations : /opt /tmp Relocations : /var /tmp

All above shows that rpm is relocatable . But if run install command

sudo rpm -i --prefix=/home/sohanvir/ java-hbase-processor-1.0-SNAPSHOT20160330060627.noarch.rpm

It will give error with message:

error: package java-hbase-processor is not relocatable

Thanks in advance .

According to RPM.org :

By default, RPM will install a relocatable package in the prefix directory listed in the spec file. You can override this on the RPM install command line with "--prefix <dir> " . For example, if the package in question were going to be installed in "/opt" but you don't have enough disk space there (and it is a relocatable package), you could install it "--prefix /usr/opt" .

If there is more then one Prefix you may relocate each prefix separately by using syntax like:

rpm ... --relocate /opt=/usr/opt --relocate /etc=/usr/etc ...

If any of the Prefixes is not being relocated they can be skipped on the command line

However, it goes on to say that there are a number of things that can go wrong in building a relocatable RPM (even if you see the Prefix tags). If you only want to extract files from the RPM, there are tools for that (such as rpmunpack , rpm2cpio or unrpm ).

Further reading:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM