CentOS 5.5 - 将符号链接创建到 RPM 规范文件中

发布于 2024-10-14 09:45:51 字数 698 浏览 5 评论 0原文

我需要在我的 RPM 规范文件中创建 RPM 文件中的以下符号链接

/bin/ln -sf libcrypto.so.0.9.8e /lib/libcrypto.so.0.9.8
/bin/ln -sf libssl.so.0.9.8e /lib/libssl.so.0.9.8

%files
%defattr(-,root,root)
/lib/libcrypto.so.0.9.8
/lib/libssl.so.0.9.8
<other files...>

%install
/bin/ln -sf libcrypto.so.0.9.8e /lib/libcrypto.so.0.9.8
/bin/ln -sf libssl.so.0.9.8e /lib/libssl.so.0.9.8

/lib/libcrypto.so.0.9.8e 和 /lib/libssl.so.0.9.8e 存在于我的电脑上,但是当我尝试安装 RPM 时,我收到错误:出

libcrypto.so.0.9.8 is needed by my-test-rpm-1.el5.i686
libssl.so.0.9.8 is needed by my-test-rpm-1.el5.i686

了什么问题?我需要做什么才能创建符号链接作为 RPM 安装的一部分?

谢谢

I need to create the following symbolic links into RPM file

/bin/ln -sf libcrypto.so.0.9.8e /lib/libcrypto.so.0.9.8
/bin/ln -sf libssl.so.0.9.8e /lib/libssl.so.0.9.8

In my RPM spec file:

%files
%defattr(-,root,root)
/lib/libcrypto.so.0.9.8
/lib/libssl.so.0.9.8
<other files...>

%install
/bin/ln -sf libcrypto.so.0.9.8e /lib/libcrypto.so.0.9.8
/bin/ln -sf libssl.so.0.9.8e /lib/libssl.so.0.9.8

The /lib/libcrypto.so.0.9.8e and /lib/libssl.so.0.9.8e are exists on my PC, but when I'm trying to install my RPM, I got an error:

libcrypto.so.0.9.8 is needed by my-test-rpm-1.el5.i686
libssl.so.0.9.8 is needed by my-test-rpm-1.el5.i686

What wrong? What I need to do in order to create symbolic links as part of the RPM installation?

Thanks

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

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

发布评论

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

评论(4

塔塔猫 2024-10-21 09:45:51

作为解决方法,我通过添加以下内容来禁用自动依赖项处理:

AutoReqProv: no

到我的规范文件中。
我仍在寻找真正的解决方案。

As workaround I disabled automatic dependency processing by adding:

AutoReqProv: no

to my spec file.
I'm still looking for the real solution.

单调的奢华 2024-10-21 09:45:51

您需要在规范文件的 %post 部分运行 ldconfig:

%post
umask 007
/sbin/ldconfig > /dev/null 2>&1


%postun
umask 007
/sbin/ldconfig > /dev/null 2>&1

应该这样做。

You need to run ldconfig in the %post part of the spec file:

%post
umask 007
/sbin/ldconfig > /dev/null 2>&1


%postun
umask 007
/sbin/ldconfig > /dev/null 2>&1

should do it.

攒眉千度 2024-10-21 09:45:51

1)仅对于符号链接,您不需要在后期阶段调用 ldconfig。

2) 正如 ldav1s 已经提到的:确保您的文件列在 %files 部分中。

3) 再次强调:确保您的文件已列出 - 特别是如果您使用类似

%define _unpackaged_files_terminate_build 0

RHEL rpmbuild 的工具,如果在 buildroot 中找到未在 %files 部分列出的文件,则 rpmbuild 将终止并出现错误。通过这个定义,您可以关闭行为/错误,但您应该确切地知道您实际上在做什么。如果您使用此行,则应将其从规范文件中删除。

4) 不要以root用户构建rpm包。如果您忘记使用 rpm_build_root 您不会破坏您的实时系统。您的示例看起来像是取自 1997 年 Red Hat 4.2 的规范文件。自 1997 年的 Red Hat 5(不是 RHEL 5!)起,rpm/rpmbuild 命令就知道 RPM_BUILD_ROOT 定义。我猜想这是你的问题:你不使用buildroot,而是直接安装到根FS并以用户root身份运行rpmbuild。

鉴于您的示例,应将其更改为:

%install
/bin/ln -sf libcrypto.so.0.9.8e $RPM_BUILD_ROOT/lib/libcrypto.so.0.9.8
/bin/ln -sf libssl.so.0.9.8e $RPM_BUILD_ROOT/lib/libssl.so.0.9.8

RPM docs< 中描述了使用 buildroot /a>.

1) Just for symlinks you don't need to call ldconfig at post stage.

2) As already mentioned by ldav1s: Be sure that your files are listed in %files section.

3) Once again: Be sure that your files are listed - especially if you use something like

%define _unpackaged_files_terminate_build 0

RHEL rpmbuild terminates with an error if files are found in buildroot which are not listed in %files section. With this define you can switch the behaviour/error off but you should exactly know what you are actually doing. If you use this line you should remove it from your spec file.

4) Don't build the rpm package as user root. If you forget to use rpm_build_root you won't destroy your live system. Your example looks like it was taken from a spec file of Red Hat 4.2 of 1997. Since Red Hat 5 (not RHEL 5!) in 1997 the rpm/rpmbuild command knows the RPM_BUILD_ROOT definition. I guess that this is your problem: You don't use the buildroot but install directly into the root FS and run rpmbuild as user root.

Given your example it should be changed to:

%install
/bin/ln -sf libcrypto.so.0.9.8e $RPM_BUILD_ROOT/lib/libcrypto.so.0.9.8
/bin/ln -sf libssl.so.0.9.8e $RPM_BUILD_ROOT/lib/libssl.so.0.9.8

Using buildroot is described in RPM docs.

独孤求败 2024-10-21 09:45:51

做到这一点的最佳方法是防止您创建的符号链接被自动依赖和自动扫描。需要生成器:

%filter_provides_in libcrypto.so.0.9.8e
%filter_provides_in libssl.so.0.9.8e
%filter_requires_in libcrypto.so.0.9.8e
%filter_requires_in libssl.so.0.9.8e
%filter_setup

有关依赖/需要过滤的更多信息此处

The best way to do this is by preventing the symlinks you created from being scanned by the automatic depends & requires generators:

%filter_provides_in libcrypto.so.0.9.8e
%filter_provides_in libssl.so.0.9.8e
%filter_requires_in libcrypto.so.0.9.8e
%filter_requires_in libssl.so.0.9.8e
%filter_setup

More information on depends/requires filtering here.

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