2012-11-23 16:19:32 +01:00
|
|
|
#
|
|
|
|
# spec file for package suse-module-tools
|
|
|
|
#
|
2016-02-23 15:09:56 +01:00
|
|
|
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
|
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.
|
|
|
|
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
Name: suse-module-tools
|
2016-04-21 12:23:56 +02:00
|
|
|
Version: 12.4
|
2012-11-23 16:19:32 +01:00
|
|
|
Release: 0
|
2016-02-23 15:09:56 +01:00
|
|
|
Requires: /sbin/depmod
|
|
|
|
Requires: /sbin/mkinitrd
|
|
|
|
Requires: findutils
|
|
|
|
Requires: gzip
|
2012-11-23 16:19:32 +01:00
|
|
|
# for grepping /etc/SUSE-release
|
|
|
|
PreReq: grep
|
|
|
|
# nm and rpmsort (rpm) are required by the weak-modules script which is invoked
|
|
|
|
# in post, it also requires getopt (coreutils) and sed
|
|
|
|
PreReq: coreutils rpm
|
|
|
|
# XXX: this should be nm OR eu-nm, the script works with both
|
|
|
|
PreReq: /usr/bin/eu-nm /bin/sed
|
|
|
|
Summary: Configuration for module loading and SUSE-specific utilities for KMPs
|
|
|
|
License: GPL-2.0+
|
|
|
|
Group: System/Base
|
|
|
|
Source: README.SUSE
|
|
|
|
Source2: modprobe.conf.tar.bz2
|
|
|
|
Source3: depmod-00-system.conf
|
|
|
|
Source4: 10-unsupported-modules.conf
|
|
|
|
Source5: weak-modules
|
|
|
|
Source6: weak-modules2
|
|
|
|
Source7: driver-check.sh
|
2014-03-11 08:13:11 +01:00
|
|
|
Source8: suse-module-tools.rpmlintrc
|
2014-03-12 14:45:04 +01:00
|
|
|
Source9: modsign-verify
|
2014-03-31 21:51:08 +02:00
|
|
|
Source10: kmp-install
|
2014-04-09 11:56:47 +02:00
|
|
|
Source11: macros.initrd
|
|
|
|
Source12: regenerate-initrd-posttrans
|
2016-05-09 10:35:02 +02:00
|
|
|
Source13: 50-kernel-uname_r.conf
|
2012-11-23 16:19:32 +01:00
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
|
|
|
|
%description
|
|
|
|
This package contains helper scripts for KMP installation and
|
|
|
|
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.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -Tcqa2
|
|
|
|
|
|
|
|
%build
|
|
|
|
|
|
|
|
%install
|
|
|
|
b="%buildroot"
|
|
|
|
mkdir -p "$b/%_docdir/module-init-tools"
|
|
|
|
install -pm644 "%_sourcedir/README.SUSE" "$b/%_docdir/module-init-tools"
|
|
|
|
#
|
|
|
|
# now assemble the parts for modprobe.conf
|
|
|
|
#
|
|
|
|
cd modprobe.conf
|
|
|
|
cp modprobe.conf.common 00-system.conf
|
|
|
|
if [ -f "modprobe.conf.$RPM_ARCH" ]; then
|
|
|
|
cat "modprobe.conf.$RPM_ARCH" >>00-system.conf
|
|
|
|
fi
|
|
|
|
install -d -m 755 "$b/etc/modprobe.d"
|
|
|
|
install -pm644 "%_sourcedir/10-unsupported-modules.conf" \
|
|
|
|
"$b/etc/modprobe.d/"
|
|
|
|
install -pm644 00-system.conf "$b/etc/modprobe.d/"
|
|
|
|
install -pm644 modprobe.conf.local "$b/etc/modprobe.d/99-local.conf"
|
|
|
|
install -d -m 755 "$b/etc/depmod.d"
|
|
|
|
install -pm 644 "%_sourcedir/depmod-00-system.conf" \
|
|
|
|
"$b/etc/depmod.d/00-system.conf"
|
|
|
|
|
|
|
|
# "module-init-tools" name hardcoded in KMPs, mkinitrd, etc.
|
|
|
|
install -d -m 755 "$b/usr/lib/module-init-tools"
|
|
|
|
install -pm 755 %_sourcedir/weak-modules{,2} "$b/usr/lib/module-init-tools/"
|
|
|
|
install -pm 755 %_sourcedir/driver-check.sh "$b/usr/lib/module-init-tools/"
|
|
|
|
|
2014-04-09 11:56:47 +02:00
|
|
|
# rpm macros and helper
|
|
|
|
install -d -m 755 "$b/etc/rpm"
|
|
|
|
install -pm 644 "%_sourcedir/macros.initrd" "$b/etc/rpm/"
|
|
|
|
install -pm 755 "%_sourcedir/regenerate-initrd-posttrans" "$b/usr/lib/module-init-tools/"
|
|
|
|
|
2014-03-12 14:45:04 +01:00
|
|
|
# modsign-verify for verifying module signatures
|
|
|
|
install -d -m 755 "$b/usr/bin"
|
|
|
|
install -pm 755 %_sourcedir/modsign-verify "$b/usr/bin/"
|
2014-03-31 21:51:08 +02:00
|
|
|
install -pm 755 %_sourcedir/kmp-install "$b/usr/bin/"
|
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`
|
|
|
|
install -d -m 755 "$b/usr/lib/systemd/system/systemd-sysctl.service.d"
|
|
|
|
install -pm 755 %_sourcedir/50-kernel-uname_r.conf "$b/usr/lib/systemd/system/systemd-sysctl.service.d"
|
|
|
|
|
2012-11-23 16:19:32 +01:00
|
|
|
%post
|
|
|
|
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)
|
|
|
|
if test -e /etc/sysconfig/hardware/config; then
|
|
|
|
. /etc/sysconfig/hardware/config
|
|
|
|
if test "x$LOAD_UNSUPPORTED_MODULES_AUTOMATICALLY" = "xno"; then
|
|
|
|
allow=0
|
|
|
|
fi
|
|
|
|
# obsolete
|
|
|
|
rm /etc/sysconfig/hardware/config
|
|
|
|
fi
|
|
|
|
# don't change the setting during upgrade
|
|
|
|
if test "$1" != 1; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
# on SLES, the default is not to allow unsupported modules
|
|
|
|
if grep -qs "Enterprise Server" /etc/SuSE-release; then
|
|
|
|
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
|
|
|
|
# (see TAINT_NO_SUPPORT in /usr/src/linux/include/linux/kernel.h)
|
|
|
|
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
|
|
|
|
if test -e /etc/modprobe.d/unsupported-modules; then
|
|
|
|
mv -f /etc/modprobe.d/unsupported-modules \
|
|
|
|
/etc/modprobe.d/10-unsupported-modules.conf
|
|
|
|
fi
|
|
|
|
if test -e /etc/modprobe.conf.local; then
|
|
|
|
mv -f /etc/modprobe.conf.local \
|
|
|
|
/etc/modprobe.d/99-local.conf
|
|
|
|
fi
|
|
|
|
test_allow_on_install "$@"
|
|
|
|
if test "$allow" = "0"; then
|
|
|
|
sed -ri 's/^( *allow_unsupported_modules *) 1/\1 0/' \
|
|
|
|
/etc/modprobe.d/10-unsupported-modules.conf
|
|
|
|
fi
|
2014-03-11 08:13:11 +01:00
|
|
|
|
2012-11-23 16:19:32 +01:00
|
|
|
%files
|
|
|
|
%defattr(-,root,root)
|
|
|
|
%dir /etc/modprobe.d
|
|
|
|
%config /etc/modprobe.d/00-system.conf
|
|
|
|
%config(noreplace) /etc/modprobe.d/10-unsupported-modules.conf
|
|
|
|
%config(noreplace) /etc/modprobe.d/99-local.conf
|
|
|
|
%dir /etc/depmod.d
|
|
|
|
%config /etc/depmod.d/00-system.conf
|
2014-04-09 11:56:47 +02:00
|
|
|
%config /etc/rpm/macros.initrd
|
2012-11-23 16:19:32 +01:00
|
|
|
%_docdir/module-init-tools
|
2014-03-31 21:51:08 +02:00
|
|
|
/usr/bin/kmp-install
|
2014-03-12 14:45:04 +01:00
|
|
|
/usr/bin/modsign-verify
|
2012-11-23 16:19:32 +01:00
|
|
|
/usr/lib/module-init-tools
|
2016-05-09 10:35:02 +02:00
|
|
|
/usr/lib/systemd/system/systemd-sysctl.service.d
|
2012-11-23 16:19:32 +01:00
|
|
|
|
|
|
|
%changelog
|