Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 596
Dima Avatar asked Jan 28 '11 01:01

Dima


3 Answers

As workaround I disabled automatic dependency processing by adding:

AutoReqProv: no

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

like image 198
Dima Avatar answered Nov 03 '22 19:11

Dima


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.

like image 42
ldav1s Avatar answered Nov 03 '22 18:11

ldav1s


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.

like image 33
reichhart Avatar answered Nov 03 '22 19:11

reichhart