解压 RPM 文件并重新打包

发布于 2024-11-15 09:38:44 字数 53 浏览 2 评论 0原文

我有一个 RPM 文件。我必须对该 RPM 进行一些更改,重新打包并测试。有人可以帮助我吗?

I have a RPM file. I have to make some changes to that RPM , repack it and Test. Can anyone help me?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

贪了杯 2024-11-22 09:38:44

修改没有源代码的 RPM 的最佳方法是按照以下步骤操作:

  1. 使用 rpm2cpio 命令将 rpm 解压到一个目录中
  2. 在该子目录中进行必要的更改
  3. 制作一个“虚拟”规范文件并构建它。

该虚拟规格文件可能如下所示:

Name: blah
Version: 1.0
Release: 1
Summary: blah
License: blah
Distribution: blah
Group: blah
Packager: me
BuildRoot: /path/to/dir/with/mods

%description
blah

%files
/path/to/dir/with/mods/*

将此处的每个“blah”替换为实际值(使用 rpm -qpi rpm file 获取值)。将 BuildRoot 替换为已解开修改后的 rpm 的目录。然后运行 ​​rpmbuild -bb dummy.spec 。

由于没有定义准备/设置/构建/安装步骤,因此它只会采用 buildroot 中的内容并制作 RPM。

如果 rpm 包有脚本文件,您还必须将它们放入这个虚拟规范文件中。要查看软件包是否包含任何脚本,请运行:rpm -qp --scripts rpm file。依赖项、先决条件等也是如此。

我可能缺少其他细节,但这应该足以让您开始。

更新:对于它的价值,还有http://rpmrebuild.sourceforge.net/< /a>

The best way to modify an RPM you do not have the source for is to follow these steps:

  1. Unpack the rpm into a directory with the rpm2cpio command
  2. Make the necessary changes inside that subdirectory
  3. Make a "dummy" spec file and build it.

That dummy spec file might look like this:

Name: blah
Version: 1.0
Release: 1
Summary: blah
License: blah
Distribution: blah
Group: blah
Packager: me
BuildRoot: /path/to/dir/with/mods

%description
blah

%files
/path/to/dir/with/mods/*

Replace every "blah" in here with the real value (use rpm -qpi rpm file to get the values). Replace the BuildRoot to the directory you have the modified rpm unwrapped. Then run rpmbuild -bb dummy.spec.

Since there are no prep/setup/build/install steps defined, it'll just take what's in the buildroot and make an RPM.

If the rpm package has script files, you'll also have to put them in this dummy spec file. To see if the package has any scripts, run: rpm -qp --scripts rpm file. Same thing goes for dependencies, prereqs, etc.

There may be other details I'm missing, but this should be enough to get you started.

UPDATE: For what it's worth, there is also http://rpmrebuild.sourceforge.net/

寒冷纷飞旳雪 2024-11-22 09:38:44

我认为这是一个叫做补丁的概念。我开始使用这个 链接 修补第一个 srpm。但基本思想是,获取 srpm、安装 srpm、在构建区域目录中创建补丁并在规范文件中指定补丁文件 %patch0 -p1。然后进行 rpm 构建。快乐修补!

I think that is a concept called patch. I started patching the first srpm using this link. But the basic idea is that, get the srpm, install the srpm, create your patch inside that build area directory and specify the patch file %patch0 -p1 in the spec file. Then do rpm build. Happy patching!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文