rpmbuild 文件的简单副本 [英] rpmbuild simple copy of files

查看:52
本文介绍了rpmbuild 文件的简单副本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当涉及到放置文件时,正在寻找某人来澄清 %install 宏.我创建了一个没有错误的 RPM,它应该只是从 buildroot 中获取文件并将它们 cp 到/usr/lib.我在 %install 的 SPEC 文件中的内容如下,并且基于 这篇文章.我认为这足以让 rpm 将文件从 buildroot 复制到/usr/lib 位置.

Looking for someone to just clarify the %install macro when it comes to just placing files. I created a RPM without errors that is supposed to just take files from the buildroot and cp them to /usr/lib. What I have in the SPEC file for the %install is the following, and based on this post. I though that would be enough for the rpm to copy the files from the buildroot to the /usr/lib location.

这是我尝试过的,它构建了:

This is what I tried and it builds:

%install
mkdir -p %{buildroot}/usr/lib
install -d %{buildroot}/usr/lib/

重新思考,我想,让我们告诉 rpm 我想将文件复制到哪里.所以我试过这个:

Rethinking, I figure, well lets tell the rpm where I want to copy the files. SO I tried this:

%install
mkdir -p %{buildroot}/usr/lib
cp %{buildroot}/usr/lib/ /usr/lib/

嗯,抱怨/usr/lib/位置不能被用户写入我正在像在构建机器上一样创建 rpm.我的印象是规范文件的 %install 部分应该是关于在目标服务器上安装 rpm 时文件应该复制到哪里的说明.我不希望它查看 rpm 构建服务器的本地文件系统.我的背后是,RPM 应该构建,但如果我尝试以非特权用户身份安装 rpm,它应该不会失败,直到 rpm 安装.它不应该在构建期间关心.我只是想将一些 lib 文件 cp/extract 到我安装 rpm 的服务器上的/usr/lib .

well that complains about the /usr/lib/ location not being writable by the user I am creating the rpm as on the build machine. Which my impression is that %install section of the spec file should be instructions on where the files should be copied to when the rpm is installed on the destination server. I don't want it looking at the local files system for the rpm build server. My though behind this is, the RPM should build, but it shouldn't fail until the rpm install if I try to install the rpm as a non-privileged user. It shouldn't care during the build. I'm merely trying to cp/extract some lib files to the /usr/lib on the server I install the rpm on.

我的假设是,rpm 会在我安装 rpm 的服务器上创建 BUILDROOT 位置,然后将内容从 buildroot 位置cp到提到的目标位置.

My assumption is, the rpm would create the BUILDROOT location on the server I'm installing the rpm on, then cp the contents from the buildroot location to the mentioned destination location.

推荐答案

%install 部分在包的构建期间在您的机器上执行.在本节中,您应该在 %{buildroot} 中创建文件结构.不是您的任务是将其复制到客户端计算机上的最终目的地.

%install section is executed on your machine during buildtime of your package. In this section you should create the file structure in %{buildroot}. It is not your task to copy it final destination on client machine.

所以你应该这样做:

%install
mkdir -p %{buildroot}/usr/lib
cp -a some-your-file-from-extracted-targz %{buildroot}/usr/lib/

然后在 %files 部分:

and then in %files section:

%files
/usr/lib/foobar.bin
/usr/lib/somedir/

然后 Rpm 将从 %buildroot 的 %files 部分中获取所有列出的文件,并将其放入包中.

Rpm will then takes all listed files in %files section from %buildroot and will put it in package.

这篇关于rpmbuild 文件的简单副本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆