Skip to content

Commit

Permalink
suse: Change install path for modprobe.d
Browse files Browse the repository at this point in the history
Starting with SLES15SP4, all modprobe files needs to be installed in /lib/modprobe.d
User settings (in the case of mlx4.conf) can be set by having a file with the same name
in /etr/mod.probe.d as it was before.

Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
  • Loading branch information
nmorey committed Mar 8, 2022
1 parent 015554f commit f5a69fb
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions suse/rdma-core.spec
Expand Up @@ -21,6 +21,11 @@
%define with_static %{?_with_static: 1} %{?!_with_static: 0}
%define with_pyverbs %{?_with_pyverbs: 1} %{?!_with_pyverbs: 0}

%if 0%{?suse_version} < 1550 && 0%{?sle_version} <= 150300
# systemd-rpm-macros is wrong in 15.3 and below
%define _modprobedir /lib/modprobe.d
%endif

%define git_ver %{nil}
Name: rdma-core
Version: 40.0
Expand Down Expand Up @@ -49,6 +54,8 @@ Group: Productivity/Networking/Other
%define dma_coherent 1
%endif

%global modprobe_d_files 50-libmlx4.conf truescale.conf %{?dma_coherent:mlx4.conf}

# Almost everything is licensed under the OFA dual GPLv2, 2 Clause BSD license
# providers/ipathverbs/ Dual licensed using a BSD license with an extra patent clause
# providers/rxe/ Incorporates code from ipathverbs and contains the patent clause
Expand Down Expand Up @@ -414,6 +421,7 @@ easy, object-oriented access to IB verbs.
-DCMAKE_INSTALL_INCLUDEDIR:PATH=include \
-DCMAKE_INSTALL_INFODIR:PATH=%{_infodir} \
-DCMAKE_INSTALL_MANDIR:PATH=%{_mandir} \
-DCMAKE_INSTALL_MODPROBEDIR:PATH=%{_modprobedir} \
-DCMAKE_INSTALL_SYSCONFDIR:PATH=%{_sysconfdir} \
-DCMAKE_INSTALL_SYSTEMD_SERVICEDIR:PATH=%{_unitdir} \
-DCMAKE_INSTALL_SYSTEMD_BINDIR:PATH=%{_prefix}/lib/systemd \
Expand Down Expand Up @@ -444,24 +452,23 @@ cd ..
mkdir -p %{buildroot}/%{_sysconfdir}/rdma

%global dracutlibdir %%{_prefix}/lib/dracut/
%global sysmodprobedir %%{_sysconfdir}/modprobe.d

mkdir -p %{buildroot}%{_udevrulesdir}
mkdir -p %{buildroot}%{dracutlibdir}/modules.d/05rdma
mkdir -p %{buildroot}%{sysmodprobedir}
mkdir -p %{buildroot}%{_modprobedir}
mkdir -p %{buildroot}%{_unitdir}

# Port type setup for mlx4 dual port cards
install -D -m0644 redhat/rdma.mlx4.sys.modprobe %{buildroot}%{sysmodprobedir}/50-libmlx4.conf
install -D -m0644 redhat/rdma.mlx4.sys.modprobe %{buildroot}%{_modprobedir}/50-libmlx4.conf
install -D -m0644 redhat/rdma.mlx4.conf %{buildroot}/%{_sysconfdir}/rdma/mlx4.conf
chmod 0644 %{buildroot}%{sysmodprobedir}/50-libmlx4.conf
chmod 0644 %{buildroot}%{_modprobedir}/mlx4.conf
install -D -m0755 redhat/rdma.mlx4-setup.sh %{buildroot}%{_libexecdir}/mlx4-setup.sh

# Dracut file for IB support during boot
install -D -m0644 suse/module-setup.sh %{buildroot}%{dracutlibdir}/modules.d/05rdma/module-setup.sh

%if "%{_libexecdir}" != "/usr/libexec"
sed 's-/usr/libexec-%{_libexecdir}-g' -i %{buildroot}%{sysmodprobedir}/50-libmlx4.conf
sed 's-/usr/libexec-%{_libexecdir}-g' -i %{buildroot}%{_modprobedir}/50-libmlx4.conf
sed 's-/usr/libexec-%{_libexecdir}-g' -i %{buildroot}%{dracutlibdir}/modules.d/05rdma/module-setup.sh
%endif

Expand Down Expand Up @@ -500,11 +507,25 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
%post -n libibmad%{mad_major} -p /sbin/ldconfig
%postun -n libibmad%{mad_major} -p /sbin/ldconfig

%pre
# Avoid restoring outdated stuff in posttrans
for _f in %{?modprobe_d_files}; do
[ ! -f "/etc/modprobe.d/${_f}.rpmsave" ] || \
mv -f "/etc/modprobe.d/${_f}.rpmsave" "/etc/modprobe.d/${_f}.rpmsave.old" || :
done

%post
# we ship udev rules, so trigger an update.
%{_bindir}/udevadm trigger --subsystem-match=infiniband --action=change || true
%{_bindir}/udevadm trigger --subsystem-match=infiniband_mad --action=change || true

%posttrans
# Migration of modprobe.conf files to _modprobedir
for _f in %{?modprobe_d_files}; do
[ ! -f "/etc/modprobe.d/${_f}.rpmsave" ] || \
mv -fv "/etc/modprobe.d/${_f}.rpmsave" "/etc/modprobe.d/${_f}" || :
done

#
# ibacm
#
Expand Down Expand Up @@ -577,7 +598,7 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
%dir %{_udevrulesdir}
%dir %{_sysconfdir}/udev
%dir %{_sysconfdir}/udev/rules.d
%dir %{_sysconfdir}/modprobe.d
%dir %{_modprobedir}
%doc %{_docdir}/%{name}-%{version}/README.md
%doc %{_docdir}/%{name}-%{version}/udev.md
%config(noreplace) %{_sysconfdir}/rdma/mlx4.conf
Expand All @@ -587,9 +608,9 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
%config(noreplace) %{_sysconfdir}/rdma/modules/rdma.conf
%config(noreplace) %{_sysconfdir}/rdma/modules/roce.conf
%if 0%{?dma_coherent}
%config(noreplace) %{_sysconfdir}/modprobe.d/mlx4.conf
%{_modprobedir}/mlx4.conf
%endif
%config(noreplace) %{_sysconfdir}/modprobe.d/truescale.conf
%{_modprobedir}/truescale.conf
%config(noreplace) %{_sysconfdir}/udev/rules.d/70-persistent-ipoib.rules
%{_unitdir}/rdma-hw.target
%{_unitdir}/rdma-load-modules@.service
Expand All @@ -603,7 +624,7 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
%{_udevrulesdir}/90-rdma-hw-modules.rules
%{_udevrulesdir}/90-rdma-ulp-modules.rules
%{_udevrulesdir}/90-rdma-umad.rules
%{sysmodprobedir}/50-libmlx4.conf
%{_modprobedir}/50-libmlx4.conf
%{_libexecdir}/mlx4-setup.sh
%{_libexecdir}/truescale-serdes.cmds
%license COPYING.*
Expand Down

0 comments on commit f5a69fb

Please sign in to comment.