从 Linux 上已安装的 RPM 重新创建 RPM

发布于 2024-08-16 13:10:26 字数 1549 浏览 5 评论 0原文

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

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

发布评论

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

评论(4

一念一轮回 2024-08-23 13:10:26

您使用什么版本的 RPM?如果您使用的是较新的产品,我有一个可能对您有用的技巧。

较新版本的 RPM 有一个事务安全回滚选项;只需使用 --repackage 命令,它就会生成一个包,其中包含原始安装的所有特殊垃圾。请注意,您实际上必须做一些事情(例如 rpm -e --repackage rpm_goes_here 这将删除原始文件,同时制作一个您应该能够恢复的软件包(在您制作了副本之后),但是如果您期望它能完美地工作,我有一个你可能想买的桥),所以如果你没有完整的备份,这有点信仰的飞跃。

涉及一些配置,您需要先进行测试测试,然后再对关键的内容进行尝试,但这可能会起作用。

What version of RPM are you using? If you're using a newer one, I have a trick that might work for you.

Newer versions of RPM have a transaction safe rollback option; simply use the --repackage command, and it'll generate a package that includes all the idiosyncratic crap of the original install. Mind you, you'll have to actually DO something (e.g rpm -e --repackage rpm_goes_here which will ERASE the original, while making a package which you SHOULD be able to restore (after you've made a copy), but if you expect this to work perfectly, I have a BRIDGE you might want to buy), so it's a bit of a leap of faith if you don't have a full backup.

There is some configuration involved, and you need to test test test before you try this on something critical, but this may work.

不语却知心 2024-08-23 13:10:26

基本上,您必须执行以下操作:

1] 创建一个包含所有标头的 .spec 文件 [ http://www.rpm.org/max-rpm/s1-rpm-build-creating-spec-file.html ]

您必须使用 rpm -q --queryformat "" 从已安装的 rpm 中获取标头。
例如。 rpm -q --queryformat "Release: %{RELEASE}\n"installed_rpm

要获取文件填充 %files 部分,请使用 rpm -ql < /代码> 命令。

2]运行rpmbuild -bb specfile生成rpm文件。

Basically you will have to do the following:

1] Create a .spec file with all the headers [ http://www.rpm.org/max-rpm/s1-rpm-build-creating-spec-file.html ]

You will have to use the rpm -q --queryformat "" to get the header from the already installed rpm.
Eg. rpm -q --queryformat "Release: %{RELEASE}\n" installed_rpm

For getting the files to fill the %files Section use the rpm -ql command.

2] run rpmbuild -bb specfile to generate the rpm file.

梦在夏天 2024-08-23 13:10:26

重新创建 RPM 的最佳方法是从源 RPM 中进行。很棒的教程这里

Best way to recreate an RPM, is to do it from the source RPM. Great tutorial here.

—━☆沉默づ 2024-08-23 13:10:26

deltarpm 包可以做到这一点:

deltarpm 包含新旧版本之间的差异
rpm,这使得可以从
deltarpm 和旧的。您不必拥有旧版本的副本
rpm、deltarpm 也可以与已安装的 rpm 一起使用。

The deltarpm package can do that:

A deltarpm contains the difference between an old and a new version of
a rpm, which makes it possible to recreate the new rpm from the
deltarpm and the old one. You don't have to have a copy of the old
rpm, deltarpms can also work with installed rpms.

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