2012-11-23 16:19:32 +01:00
|
|
|
#
|
|
|
|
# spec file for package suse-module-tools
|
|
|
|
#
|
2021-04-22 19:23:42 +02:00
|
|
|
# Copyright (c) 2021 SUSE LLC
|
2012-11-23 16:19:32 +01:00
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
2018-10-26 16:41:41 +02:00
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
2012-11-23 16:19:32 +01:00
|
|
|
#
|
|
|
|
|
|
|
|
|
2019-06-14 18:06:06 +02:00
|
|
|
# Define _rpmmacrodir if it's not defined yet
|
|
|
|
%{!?_rpmmacrodir: %global _rpmmacrodir %{_rpmconfigdir}/macros.d}
|
|
|
|
%define modules_load_dir /usr/lib/modules-load.d
|
|
|
|
|
2019-02-13 17:58:42 +01:00
|
|
|
# List of legacy file systems to be blacklisted by default
|
2021-04-15 11:07:44 +02:00
|
|
|
%global fs_blacklist adfs affs bfs befs cramfs efs erofs exofs freevxfs hfs hpfs jfs minix nilfs2 ntfs omfs qnx4 qnx6 sysv ufs
|
2019-02-13 17:58:42 +01:00
|
|
|
|
2020-05-27 23:10:59 +02:00
|
|
|
%if 0%{?sle_version} >= 120200 && 0%{?sle_version} < 150000
|
2020-01-15 22:13:20 +01:00
|
|
|
%global softdep_br_netfilter 1
|
|
|
|
%endif
|
|
|
|
|
2012-11-23 16:19:32 +01:00
|
|
|
Name: suse-module-tools
|
2021-05-27 20:50:43 +02:00
|
|
|
Version: 16.1
|
2012-11-23 16:19:32 +01:00
|
|
|
Release: 0
|
2017-06-19 15:16:47 +02:00
|
|
|
Summary: Configuration for module loading and SUSE-specific utilities for KMPs
|
2018-10-26 16:41:41 +02:00
|
|
|
License: GPL-2.0-or-later
|
2017-06-19 15:16:47 +02:00
|
|
|
Group: System/Base
|
2020-01-09 13:32:49 +01:00
|
|
|
URL: https://github.com/openSUSE/suse-module-tools
|
2017-06-19 15:16:47 +02:00
|
|
|
Source0: %{name}-%{version}.tar.xz
|
2018-11-05 21:53:40 +01:00
|
|
|
Source1: %{name}.rpmlintrc
|
2020-08-25 17:45:58 +02:00
|
|
|
Requires: /usr/bin/grep
|
|
|
|
Requires: /usr/bin/gzip
|
|
|
|
Requires: /usr/bin/sed
|
2018-10-26 19:17:37 +02:00
|
|
|
Requires: coreutils
|
2016-02-23 15:09:56 +01:00
|
|
|
Requires: findutils
|
2018-10-26 19:17:37 +02:00
|
|
|
Requires: rpm
|
2020-08-25 17:45:58 +02:00
|
|
|
Requires(post): /usr/bin/grep
|
|
|
|
Requires(post): /usr/bin/sed
|
|
|
|
Requires(post): coreutils
|
2021-05-27 13:10:39 +02:00
|
|
|
# Use weak dependencies for dracut and kmod in order to
|
2019-01-30 18:01:31 +01:00
|
|
|
# keep Ring0 lean. In normal deployments, these packages
|
|
|
|
# will be available anyway.
|
2021-05-27 13:10:39 +02:00
|
|
|
Recommends: dracut
|
2019-01-30 18:01:31 +01:00
|
|
|
Recommends: kmod
|
2021-05-27 13:10:39 +02:00
|
|
|
# This release requires the dracut module 90nvdimm
|
|
|
|
Conflicts: dracut < 49.1
|
2012-11-23 16:19:32 +01:00
|
|
|
|
|
|
|
%description
|
2018-12-12 08:57:48 +01:00
|
|
|
This package contains helper scripts for KMP installation and
|
2012-11-23 16:19:32 +01:00
|
|
|
uninstallation, as well as default configuration files for depmod and
|
|
|
|
modprobe. These utilities are provided by kmod-compat or
|
|
|
|
module-init-tools, whichever implementation you choose to install.
|
|
|
|
|
2021-05-27 20:50:43 +02:00
|
|
|
|
2012-11-23 16:19:32 +01:00
|
|
|
%prep
|
2017-06-19 15:16:47 +02:00
|
|
|
%setup -q
|
2012-11-23 16:19:32 +01:00
|
|
|
|
|
|
|
%build
|
|
|
|
|
|
|
|
%install
|
|
|
|
# now assemble the parts for modprobe.conf
|
2017-06-19 15:16:47 +02:00
|
|
|
cp modprobe.conf/modprobe.conf.common 00-system.conf
|
|
|
|
if [ -f "modprobe.conf/modprobe.conf.$RPM_ARCH" ]; then
|
|
|
|
cat "modprobe.conf/modprobe.conf.$RPM_ARCH" >>00-system.conf
|
2012-11-23 16:19:32 +01:00
|
|
|
fi
|
2017-06-19 15:16:47 +02:00
|
|
|
install -d -m 755 "%{buildroot}%{_sysconfdir}/modprobe.d"
|
|
|
|
install -pm644 "10-unsupported-modules.conf" \
|
|
|
|
"%{buildroot}%{_sysconfdir}/modprobe.d/"
|
|
|
|
install -pm644 00-system.conf "%{buildroot}%{_sysconfdir}/modprobe.d/"
|
2020-01-15 22:13:20 +01:00
|
|
|
|
|
|
|
%if 0%{?softdep_br_netfilter}
|
|
|
|
# softdep bridge->br_netfilter, SLE only
|
|
|
|
install -pm644 modprobe.conf/00-system-937216.conf %{buildroot}%{_sysconfdir}/modprobe.d
|
|
|
|
%endif
|
2019-01-31 23:04:12 +01:00
|
|
|
%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150100
|
2019-01-30 18:01:31 +01:00
|
|
|
install -pm644 modprobe.conf/modprobe.conf.blacklist "%{buildroot}%{_sysconfdir}/modprobe.d/50-blacklist.conf"
|
|
|
|
%endif
|
2017-06-19 15:16:47 +02:00
|
|
|
install -pm644 modprobe.conf/modprobe.conf.local "%{buildroot}%{_sysconfdir}/modprobe.d/99-local.conf"
|
|
|
|
install -d -m 755 "%{buildroot}%{_sysconfdir}/depmod.d"
|
|
|
|
install -pm 644 "depmod-00-system.conf" \
|
|
|
|
"%{buildroot}%{_sysconfdir}/depmod.d/00-system.conf"
|
2012-11-23 16:19:32 +01:00
|
|
|
|
2019-11-07 21:40:04 +01:00
|
|
|
# "/usr/lib/module-init-tools" name hardcoded in KMPs, mkinitrd, etc.
|
|
|
|
install -d -m 755 "%{buildroot}/usr/lib/module-init-tools"
|
2021-05-27 13:10:39 +02:00
|
|
|
install -pm 755 weak-modules2 "%{buildroot}/usr/lib/module-init-tools/"
|
2019-11-07 21:40:04 +01:00
|
|
|
install -pm 755 driver-check.sh "%{buildroot}/usr/lib/module-init-tools/"
|
2012-11-23 16:19:32 +01:00
|
|
|
|
2019-05-17 10:20:20 +02:00
|
|
|
%if 0%{?suse_version} < 1550
|
2014-04-09 11:56:47 +02:00
|
|
|
# rpm macros and helper
|
2019-05-17 10:20:20 +02:00
|
|
|
# The RPM Macros have been moved to the package rpm-config-SUSE after CODE15, thus are no longer
|
|
|
|
# shipped here
|
2019-05-10 15:22:47 +02:00
|
|
|
install -d -m 755 "%{buildroot}%{_rpmmacrodir}"
|
|
|
|
install -pm 644 "macros.initrd" "%{buildroot}%{_rpmmacrodir}"
|
2019-05-17 10:20:20 +02:00
|
|
|
%endif
|
2019-11-07 21:40:04 +01:00
|
|
|
install -pm 755 "regenerate-initrd-posttrans" "%{buildroot}/usr/lib/module-init-tools/"
|
2014-04-09 11:56:47 +02:00
|
|
|
|
2017-06-19 15:16:47 +02:00
|
|
|
install -d -m 755 "%{buildroot}%{_prefix}/bin"
|
|
|
|
install -pm 755 kmp-install "%{buildroot}%{_bindir}/"
|
2014-03-12 14:45:04 +01:00
|
|
|
|
2016-05-09 10:35:02 +02:00
|
|
|
# systemd service to load /boot/sysctl.conf-`uname -r`
|
2019-11-07 21:40:04 +01:00
|
|
|
install -d -m 755 "%{buildroot}%{_unitdir}/systemd-sysctl.service.d"
|
|
|
|
install -pm 644 50-kernel-uname_r.conf "%{buildroot}%{_unitdir}/systemd-sysctl.service.d"
|
2018-11-02 21:35:11 +01:00
|
|
|
|
2018-11-07 15:59:36 +01:00
|
|
|
# Ensure that the sg driver is loaded early (bsc#1036463)
|
|
|
|
# Not needed in SLE11, where sg is loaded via udev rule.
|
2019-06-14 18:06:06 +02:00
|
|
|
install -d -m 755 "%{buildroot}%{modules_load_dir}"
|
|
|
|
install -pm 644 sg.conf "%{buildroot}%{modules_load_dir}"
|
2021-05-27 13:10:39 +02:00
|
|
|
%ifarch ppc64 ppc64le
|
2020-11-04 21:33:48 +01:00
|
|
|
install -d -m 755 %{buildroot}/usr/lib/systemd/system-generators
|
|
|
|
install -m 755 udev-trigger-generator %{buildroot}/usr/lib/systemd/system-generators
|
|
|
|
%endif
|
2018-11-02 21:35:11 +01:00
|
|
|
|
|
|
|
mkdir -p %{buildroot}%{_defaultlicensedir}
|
2016-05-09 10:35:02 +02:00
|
|
|
|
2019-02-13 17:58:42 +01:00
|
|
|
%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150100
|
|
|
|
for mod in %{fs_blacklist}; do
|
|
|
|
echo "\
|
|
|
|
# The $mod file system is blacklisted by default because it isn't actively
|
2019-02-19 17:21:40 +01:00
|
|
|
# supported by SUSE, not well maintained, or may have security vulnerabilites.
|
2019-02-13 17:58:42 +01:00
|
|
|
# To enable autoloading the $mod file system module, comment out the
|
|
|
|
# \"blacklist $mod\" statement below. ENABLE AT YOUR OWN RISK.
|
|
|
|
#
|
|
|
|
# File system modules loaded at installation time of the %{name} package
|
|
|
|
# are not blacklisted. This is achieved by commenting out the blacklist
|
|
|
|
# line in the post-installation script. To prevent the post-installation
|
|
|
|
# script from modifying this file, delete the line containing \"THIS FILE MAY
|
|
|
|
# BE MODIFIED\" at the bottom.
|
|
|
|
blacklist $mod
|
|
|
|
# __THIS FILE MAY BE MODIFIED__" \
|
|
|
|
>%{buildroot}%{_sysconfdir}/modprobe.d/60-blacklist_fs-"$mod".conf
|
|
|
|
done
|
|
|
|
%endif
|
|
|
|
|
2012-11-23 16:19:32 +01:00
|
|
|
%post
|
2018-10-26 19:17:37 +02:00
|
|
|
%if 0%{?sle_version} >= 150000
|
|
|
|
# Delete obsolete unsupported-modules file from SLE11
|
|
|
|
rm -f %{_sysconfdir}/modprobe.d/unsupported-modules
|
2018-11-02 21:35:11 +01:00
|
|
|
%else
|
|
|
|
# Logic for releases below CODE 15
|
2018-10-26 19:17:37 +02:00
|
|
|
%if 0%{?is_opensuse} == 1
|
2018-11-02 21:35:11 +01:00
|
|
|
allowed=1
|
2018-10-26 19:17:37 +02:00
|
|
|
%else
|
2018-11-02 21:35:11 +01:00
|
|
|
allowed=0
|
2018-10-26 19:17:37 +02:00
|
|
|
%endif
|
2012-11-23 16:19:32 +01:00
|
|
|
test_allow_on_install()
|
|
|
|
{
|
|
|
|
# configure handling of unsupported modules
|
|
|
|
# default is to allow them
|
|
|
|
allow=1
|
|
|
|
# if the obsolete LOAD_UNSUPPORTED_MODULES_AUTOMATICALLY variable is
|
|
|
|
# set to no, don't allow (this was used in SLES 9 and 10)
|
2017-06-19 15:16:47 +02:00
|
|
|
if test -e %{_sysconfdir}/sysconfig/hardware/config; then
|
|
|
|
. %{_sysconfdir}/sysconfig/hardware/config
|
2012-11-23 16:19:32 +01:00
|
|
|
if test "x$LOAD_UNSUPPORTED_MODULES_AUTOMATICALLY" = "xno"; then
|
|
|
|
allow=0
|
|
|
|
fi
|
|
|
|
# obsolete
|
2017-06-19 15:16:47 +02:00
|
|
|
rm %{_sysconfdir}/sysconfig/hardware/config
|
2012-11-23 16:19:32 +01:00
|
|
|
fi
|
|
|
|
# don't change the setting during upgrade
|
|
|
|
if test "$1" != 1; then
|
2018-11-02 21:35:11 +01:00
|
|
|
allow=
|
2012-11-23 16:19:32 +01:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
# on SLES, the default is not to allow unsupported modules
|
2017-06-19 15:16:47 +02:00
|
|
|
if grep -qs "Enterprise Server" %{_sysconfdir}/os-release; then
|
2012-11-23 16:19:32 +01:00
|
|
|
allow=0
|
|
|
|
else
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
# unless the admin passed "oem-modules=1" to the kernel during install
|
|
|
|
if grep -qs '\<oem-modules=1\>' /proc/cmdline; then
|
|
|
|
allow=1
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
# or if the installer already loaded some unsupported modules
|
2018-10-26 19:17:37 +02:00
|
|
|
# (see TAINT_NO_SUPPORT in /etc/src/linux/include/linux/kernel.h)
|
2012-11-23 16:19:32 +01:00
|
|
|
tainted=$(cat /proc/sys/kernel/tainted 2>/dev/null || echo 0)
|
|
|
|
if test $((tainted & (1<<30))) != 0; then
|
|
|
|
allow=1
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
# upgrade from old locations
|
2017-06-19 15:16:47 +02:00
|
|
|
if test -e %{_sysconfdir}/modprobe.d/unsupported-modules; then
|
|
|
|
mv -f %{_sysconfdir}/modprobe.d/unsupported-modules \
|
|
|
|
%{_sysconfdir}/modprobe.d/10-unsupported-modules.conf
|
2012-11-23 16:19:32 +01:00
|
|
|
fi
|
|
|
|
test_allow_on_install "$@"
|
2018-11-02 21:35:11 +01:00
|
|
|
if test -n "$allow" -a "$allow" != "$allowed"; then
|
|
|
|
sed -ri 's/^( *allow_unsupported_modules *) [01]/\1 '"$allow"'/' \
|
2017-06-19 15:16:47 +02:00
|
|
|
%{_sysconfdir}/modprobe.d/10-unsupported-modules.conf
|
2012-11-23 16:19:32 +01:00
|
|
|
fi
|
2018-11-02 21:35:11 +01:00
|
|
|
%endif
|
2014-03-11 08:13:11 +01:00
|
|
|
|
2018-10-26 19:17:37 +02:00
|
|
|
# upgrade from old locations
|
|
|
|
if test -e %{_sysconfdir}/modprobe.conf.local; then
|
|
|
|
mv -f %{_sysconfdir}/modprobe.conf.local \
|
|
|
|
%{_sysconfdir}/modprobe.d/99-local.conf
|
|
|
|
fi
|
|
|
|
|
2019-02-13 17:58:42 +01:00
|
|
|
# Avoid systems becoming unbootable by blacklisting filesystem
|
|
|
|
# modules. Modules loaded at installation time will not be
|
|
|
|
# blacklisted (the blacklist statement is commented out).
|
|
|
|
# config(noreplace) makes sure that this is not overwritten by rpm.
|
|
|
|
%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150100
|
|
|
|
for mod in %{fs_blacklist}; do
|
|
|
|
conf=%{_sysconfdir}/modprobe.d/60-blacklist_fs-"$mod".conf
|
|
|
|
if [ -f "$conf" ] && \
|
|
|
|
grep -q '^# __THIS FILE MAY BE MODIFIED__$' "$conf" && \
|
|
|
|
sed '/^nodev/d;' /proc/filesystems | grep -q "\<$mod\>"; then
|
|
|
|
sed -i '
|
|
|
|
/^# next line was commented out by postinstall script of %{name}$/d
|
|
|
|
/^blacklist '"$mod"'/{i\
|
|
|
|
# next line was commented out by postinstall script of %{name}
|
|
|
|
s/^/# /
|
|
|
|
}' "$conf"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
%endif
|
|
|
|
|
2012-11-23 16:19:32 +01:00
|
|
|
%files
|
|
|
|
%defattr(-,root,root)
|
2018-11-02 21:35:11 +01:00
|
|
|
|
|
|
|
%if 0%{?sle_version:%{sle_version}}%{!?sle_version:150000} <= 120200
|
|
|
|
%dir %{_defaultlicensedir}
|
|
|
|
%endif
|
2018-10-26 19:17:37 +02:00
|
|
|
%license LICENSE
|
|
|
|
%doc README.SUSE
|
2017-06-19 15:16:47 +02:00
|
|
|
%dir %{_sysconfdir}/modprobe.d
|
|
|
|
%config %{_sysconfdir}/modprobe.d/00-system.conf
|
2020-01-15 22:13:20 +01:00
|
|
|
%if 0%{?softdep_br_netfilter}
|
|
|
|
%config(noreplace) %{_sysconfdir}/modprobe.d/00-system-937216.conf
|
|
|
|
%endif
|
2017-06-19 15:16:47 +02:00
|
|
|
%config(noreplace) %{_sysconfdir}/modprobe.d/10-unsupported-modules.conf
|
2019-01-31 23:04:12 +01:00
|
|
|
%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150100
|
2019-01-30 18:01:31 +01:00
|
|
|
%config(noreplace) %{_sysconfdir}/modprobe.d/50-blacklist.conf
|
2019-02-13 17:58:42 +01:00
|
|
|
%config(noreplace) %{_sysconfdir}/modprobe.d/60-blacklist_fs-*.conf
|
2019-01-30 18:01:31 +01:00
|
|
|
%endif
|
2017-06-19 15:16:47 +02:00
|
|
|
%config(noreplace) %{_sysconfdir}/modprobe.d/99-local.conf
|
|
|
|
%dir %{_sysconfdir}/depmod.d
|
|
|
|
%config %{_sysconfdir}/depmod.d/00-system.conf
|
2019-05-17 10:20:20 +02:00
|
|
|
%if 0%{?suse_version} < 1550
|
2019-05-10 15:22:47 +02:00
|
|
|
%{_rpmmacrodir}/macros.initrd
|
2019-05-17 10:20:20 +02:00
|
|
|
%endif
|
2017-06-19 15:16:47 +02:00
|
|
|
%{_bindir}/kmp-install
|
2019-11-07 21:40:04 +01:00
|
|
|
/usr/lib/module-init-tools
|
|
|
|
%{_unitdir}/systemd-sysctl.service.d
|
2019-06-14 18:06:06 +02:00
|
|
|
%dir %{modules_load_dir}
|
|
|
|
%{modules_load_dir}/sg.conf
|
2020-11-04 21:33:48 +01:00
|
|
|
%ifarch ppc64le
|
|
|
|
/usr/lib/systemd/system-generators
|
|
|
|
%endif
|
2012-11-23 16:19:32 +01:00
|
|
|
|
|
|
|
%changelog
|