[英]How To make relocatable rpm?
I have java application with pom.xml. 我有带pom.xml的Java应用程序。 I am making rpm package with prefixes tags .
我正在用前缀标签制作rpm包。
When I am querying on prefix tags of rpm : 当我查询rpm的前缀标签时:
sudo rpm -qp --queryformat "%{prefixes}\n" java-hbase-processor-1.0-SNAPSHOT20160330060627.noarch.rpm
I got ==> /var 我有==> / var
IF I run following command : 如果我运行以下命令:
rpm -qi java-hbase-processor | grep Relocations
I got : Relocations : /opt /tmp Relocations : /var /tmp 我得到了:重定位:/ opt / tmp重定位:/ var / tmp
All above shows that rpm is relocatable . 以上说明rpm是可重定位的。 But if run install command
但是如果运行install命令
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 错误:程序包java-hbase-processor无法重定位
Thanks in advance . 提前致谢 。
According to RPM.org : 根据RPM.org :
By default, RPM will install a relocatable package in the prefix directory listed in the spec file.
默认情况下,RPM将在spec文件中列出的前缀目录中安装可重定位的软件包。 You can override this on the RPM install command line with "--prefix
<dir>
" .您可以在RPM安装命令行上使用“ --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" .例如,如果要安装的软件包要安装在“ / opt”目录下,但是您的磁盘空间不足(并且是可重定位的软件包),则可以将其安装在“ --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). 但是,它继续说在构建可重定位的RPM时可能会有很多错误(即使您看到
Prefix
标签也是如此)。 If you only want to extract files from the RPM, there are tools for that (such as rpmunpack
, rpm2cpio
or unrpm
). 如果只想从RPM中提取文件,则可以使用一些工具(例如
rpmunpack
, rpm2cpio
或unrpm
)。
Further reading: 进一步阅读:
Chapter 15. Making a Relocatable Package 第15章制作可移动包装
A relocatable package is a package that is standard in every way, save one.
可重定位软件包是在所有方面都是标准的软件包,请保存其中一个。 The difference lies in the prefix tag.
区别在于前缀标记。 When this tag is added to a spec file, RPM will attempt to build a relocatable package.
当将此标签添加到规格文件时,RPM将尝试构建可重定位的程序包。
Note the word "attempt".
请注意单词“尝试”。 There are a few conditions that must be met before a relocatable package can be built successfully, and this chapter will cover them all.
要成功构建可重定位的软件包,必须满足一些条件,本章将介绍所有这些条件。 But first, let's look at exactly how RPM can relocate a package.
但是首先,让我们看一下RPM如何重新定位软件包。 And the one component at the heart of package relocation is the prefix tag.
软件包重定位的核心要素之一就是前缀标记。
HowTo: Extract an RPM Package Files Without Installing It 如何:提取RPM软件包文件而不安装它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.