diff --git a/cifs-utils.changes b/cifs-utils.changes index a112c90..c787277 100644 --- a/cifs-utils.changes +++ b/cifs-utils.changes @@ -53,6 +53,13 @@ Tue Nov 17 13:42:23 UTC 2020 - Ludwig Nussel - prepare usrmerge (boo#1029961) +------------------------------------------------------------------- +Tue Aug 11 12:45:15 UTC 2020 - Aurelien Aptel + +- 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 diff --git a/cifs-utils.spec b/cifs-utils.spec index 2c8199d..b7bcf82 100644 --- a/cifs-utils.spec +++ b/cifs-utils.spec @@ -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