From 758c40f78b96df36cd8d98bdbece16b305808003 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 21 Nov 2014 15:18:26 +0100 Subject: [PATCH] Use alternatives for libwbclient. --- samba.spec | 61 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/samba.spec b/samba.spec index d1e2316..7eac04d 100644 --- a/samba.spec +++ b/samba.spec @@ -6,7 +6,7 @@ # ctdb is enabled by default, you can disable it with: --without clustering %bcond_without clustering -%define main_release 1 +%define main_release 2 %define samba_version 4.2.0 %define talloc_version 2.1.1 @@ -43,6 +43,11 @@ %endif %endif +%global libwbc_alternatives_suffix %nil +%if %{__isa_bits} == 64 +%global libwbc_alternatives_suffix -64 +%endif + %global with_mitkrb5 1 %global with_dc 0 @@ -103,9 +108,6 @@ Requires(postun): systemd Requires(pre): %{name}-common = %{samba_depver} Requires: %{name}-libs = %{samba_depver} -%if %with_libwbclient -Requires: libwbclient = %{samba_depver} -%endif Provides: samba4 = %{samba_depver} Obsoletes: samba4 < %{samba_depver} @@ -219,9 +221,6 @@ of SMB/CIFS shares and printing to SMB/CIFS printers. Summary: Files used by both Samba servers and clients Group: Applications/System Requires: %{name}-libs = %{samba_depver} -%if %with_libwbclient -Requires: libwbclient = %{samba_depver} -%endif Requires(post): systemd Provides: samba4-common = %{samba_depver} @@ -300,9 +299,6 @@ Samba VFS module for GlusterFS integration. Summary: Samba libraries Group: Applications/System Requires: krb5-libs >= 1.10 -%if %with_libwbclient -Requires: libwbclient = %{samba_depver} -%endif Provides: samba4-libs = %{samba_depver} Obsoletes: samba4-libs < %{samba_depver} @@ -403,9 +399,6 @@ Requires: %{name}-libs = %{samba_depver} %if %with_libsmbclient Requires: libsmbclient = %{samba_depver} %endif -%if %with_libwbclient -Requires: libwbclient = %{samba_depver} -%endif Provides: samba4-test = %{samba_depver} Obsoletes: samba4-test < %{samba_depver} @@ -457,9 +450,6 @@ Group: Applications/System Requires: %{name}-common = %{samba_depver} Requires: %{name}-libs = %{samba_depver} Requires: %{name}-winbind = %{samba_depver} -%if %with_libwbclient -Requires: libwbclient = %{samba_depver} -%endif Provides: samba4-winbind-clients = %{samba_depver} Obsoletes: samba4-winbind-clients < %{samba_depver} @@ -472,10 +462,7 @@ tool. %package winbind-krb5-locator Summary: Samba winbind krb5 locator Group: Applications/System -%if %with_libwbclient -Requires: libwbclient = %{samba_depver} -Requires: %{name}-winbind = %{samba_depver} -%else +%if ! %with_libwbclient Requires: %{name}-libs = %{samba_depver} %endif @@ -500,9 +487,6 @@ the local kerberos library to use the same KDC as samba and winbind use Summary: Samba winbind modules Group: Applications/System Requires: %{name}-libs = %{samba_depver} -%if %with_libwbclient -Requires: libwbclient = %{samba_depver} -%endif Requires: pam %description winbind-modules @@ -617,6 +601,11 @@ install -d -m 0755 %{buildroot}/var/run/winbindd install -d -m 0755 %{buildroot}/%{_libdir}/samba install -d -m 0755 %{buildroot}/%{_libdir}/pkgconfig +# Move libwbclient.so* into private directory, it cannot be just libdir/samba +# because samba uses rpath with this directory. +install -d -m 0755 %{buildroot}/%{_libdir}/samba/wbclient +mv %{buildroot}/%{_libdir}/libwbclient.so* %{buildroot}/%{_libdir}/samba/wbclient + # Install other stuff install -d -m 0755 %{buildroot}%{_sysconfdir}/logrotate.d install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/samba @@ -714,9 +703,24 @@ fi %endif # with_libsmbclient %if %with_libwbclient -%post -n libwbclient -p /sbin/ldconfig +%posttrans -n libwbclient +# It has to be posttrans here to make sure all files of a previous version +# without alternatives support are removed +%{_sbindir}/update-alternatives --install %{_libdir}/libwbclient.so.0.11 \ + libwbclient.so.0.11%{libwbc_alternatives_suffix} %{_libdir}/samba/wbclient/libwbclient.so.0.11 10 +/sbin/ldconfig + +%preun -n libwbclient +%{_sbindir}/update-alternatives --remove libwbclient.so.0.11%{libwbc_alternatives_suffix} %{_libdir}/samba/wbclient/libwbclient.so.0.11 +/sbin/ldconfig + +%posttrans -n libwbclient-devel +%{_sbindir}/update-alternatives --install %{_libdir}/libwbclient.so \ + libwbclient.so%{libwbc_alternatives_suffix} %{_libdir}/samba/wbclient/libwbclient.so 10 + +%preun -n libwbclient-devel +%{_sbindir}/update-alternatives --remove libwbclient.so%{libwbc_alternatives_suffix} %{_libdir}/samba/wbclient/libwbclient.so -%postun -n libwbclient -p /sbin/ldconfig %endif # with_libwbclient %post test -p /sbin/ldconfig @@ -1468,14 +1472,14 @@ rm -rf %{buildroot} %if %with_libwbclient %files -n libwbclient %defattr(-,root,root) -%{_libdir}/libwbclient.so.* +%{_libdir}/samba/wbclient/libwbclient.so.* %{_libdir}/samba/libwinbind-client.so ### LIBWBCLIENT-DEVEL %files -n libwbclient-devel %defattr(-,root,root) %{_includedir}/samba-4.0/wbclient.h -%{_libdir}/libwbclient.so +%{_libdir}/samba/wbclient/libwbclient.so %{_libdir}/pkgconfig/wbclient.pc %endif # with_libwbclient @@ -1604,6 +1608,9 @@ rm -rf %{buildroot} %{_mandir}/man8/pam_winbind.8* %changelog +* Fri Nov 21 2014 - Andreas Schneider - 4.2.0-0.2.rc2 +- Use alternatives for libwbclient. + * Wed Nov 12 2014 - Andreas Schneider - 4.2.0-0.1.rc2 - Update to Samba 4.2.0rc2.