Dima
Dima

Reputation: 1311

CentOS 5.5 - symbolic link creation into RPM spec file

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

Upvotes: 7

Views: 12120

Answers (4)

jayhendren
jayhendren

Reputation: 4511

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.

Upvotes: 0

reichhart
reichhart

Reputation: 879

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.

Upvotes: 1

Dima
Dima

Reputation: 1311

As workaround I disabled automatic dependency processing by adding:

AutoReqProv: no

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

Upvotes: 2

ldav1s
ldav1s

Reputation: 16305

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.

Upvotes: 1

Related Questions