Accepting request 877747 from home:aaptel:cifs-utils-alternatives

OBS-URL: https://build.opensuse.org/request/show/877747
OBS-URL: https://build.opensuse.org/package/show/network:samba:STABLE/cifs-utils?expand=0&rev=190
This commit is contained in:
Samuel Cabrero 2021-03-19 14:41:34 +00:00 committed by Git OBS Bridge
parent 3d7048d5da
commit 368ca6cd41
2 changed files with 42 additions and 6 deletions

View File

@ -53,6 +53,13 @@ Tue Nov 17 13:42:23 UTC 2020 - Ludwig Nussel <lnussel@suse.de>
- prepare usrmerge (boo#1029961)
-------------------------------------------------------------------
Tue Aug 11 12:45:15 UTC 2020 - Aurelien Aptel <aaptel@suse.com>
- Make cifs-idmap plugin (idmapwb.so) use update-alternatives
mechanism to be able to switch between cifs-utils and sssd;
(bsc#1182682).
-------------------------------------------------------------------
Mon Aug 10 06:56:11 UTC 2020 - Aurelien Aptel <aaptel@suse.com>

View File

@ -38,6 +38,18 @@ Source1: cifs.init
Patch1: fix-sbin-install-error.patch
# Both SSSD and cifs-utils provide an idmap plugin for cifs.ko
# /etc/cifs-utils/idmap-plugin should be a symlink to one of the 2 idmap plugins
# * cifs-utils one is the default (priority 20)
# * installing SSSD should NOT switch to SSSD plugin (priority 10)
%define cifs_idmap_plugin %{_sysconfdir}/cifs-utils/idmap-plugin
%define cifs_idmap_lib %{_libdir}/cifs-utils/idmapwb.so
%define cifs_idmap_name cifs-idmap-plugin
%define cifs_idmap_priority 20
BuildRequires: update-alternatives
Requires(post): update-alternatives
Requires(preun): update-alternatives
# cifs-utils 6.8 switched to python for man page generation
# we need to require either py2 or py3 package
# some products do not have a py2/py3 versions
@ -139,8 +151,6 @@ mkdir -p %{buildroot}/%{_sysconfdir}/init.d
%endif
%make_install
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
ln -s %{_libdir}/%{name}/idmapwb.so %{buildroot}%{_sysconfdir}/%{name}/idmap-plugin
mkdir -p %{buildroot}%{_sysconfdir}/request-key.d
install -m 644 -p contrib/request-key.d/cifs.idmap.conf %{buildroot}%{_sysconfdir}/request-key.d
install -m 644 -p contrib/request-key.d/cifs.spnego.conf %{buildroot}%{_sysconfdir}/request-key.d
@ -156,6 +166,10 @@ install -m 0755 -p ${RPM_SOURCE_DIR}/cifs.init %{buildroot}/%{_sysconfdir}/init.
ln -s service %{buildroot}/%{_sbindir}/rccifs
%endif
# dummy target for cifs-idmap-plugin
mkdir -p %{buildroot}%{_sysconfdir}/alternatives %{buildroot}%{_sysconfdir}/cifs-utils
ln -s -f %{_sysconfdir}/alternatives/%{cifs_idmap_name} %{buildroot}%{cifs_idmap_plugin}
touch %{buildroot}/%{_sysconfdir}/sysconfig/network/if-{down,up}.d/${script} \
%{buildroot}%{_rundir}/cifs
%endif
@ -164,6 +178,15 @@ touch %{buildroot}/%{_sysconfdir}/sysconfig/network/if-{down,up}.d/${script} \
%fdupes %{buildroot}
%endif
%post
# install cifs-utils cifs-idmap plugin using alternatives system
update-alternatives --install %{cifs_idmap_plugin} %{cifs_idmap_name} %{cifs_idmap_lib} %{cifs_idmap_priority}
%postun
if [ ! -f %{cifs_idmap_lib} ] ; then
update-alternatives --remove %{cifs_idmap_name} %{cifs_idmap_lib}
fi
%files
%if 0%{?usrmerged}
%{_sbindir}/mount.cifs
@ -188,14 +211,20 @@ touch %{buildroot}/%{_sysconfdir}/sysconfig/network/if-{down,up}.d/${script} \
%{_mandir}/man8/cifs.upcall.8%{ext_man}
%{_mandir}/man8/mount.cifs.8%{ext_man}
%{_mandir}/man8/mount.smb3.8%{ext_man}
# request keys
%dir %{_sysconfdir}/request-key.d
%config(noreplace) %{_sysconfdir}/request-key.d/cifs.idmap.conf
%config(noreplace) %{_sysconfdir}/request-key.d/cifs.spnego.conf
%dir %{_libdir}/cifs-utils
%dir %{_sysconfdir}/cifs-utils
%config(noreplace) %{_sysconfdir}/cifs-utils/idmap-plugin
%{_libdir}/%{name}/idmapwb.so
# idmap plugin
%dir %_sysconfdir/cifs-utils
%{cifs_idmap_plugin}
%dir %_libdir/cifs-utils
%{cifs_idmap_lib}
%ghost %_sysconfdir/alternatives/%{cifs_idmap_name}
%{_mandir}/man8/idmapwb.8%{ext_man}
%if 0%{?suse_version} > 1221
%if ! %{systemd}
%attr(0754,root,root) %config %{_sysconfdir}/init.d/cifs