1
0
suse-module-tools/suse-module-tools.spec

150 lines
4.7 KiB
RPMSpec
Raw Normal View History

#
# spec file for package suse-module-tools
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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
Version: 12.3
Release: 0
# 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
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%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"
%if 0%{?sles_version}
install -pm644 "%_sourcedir/10-unsupported-modules.conf" \
"$b/etc/modprobe.d/"
%endif
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/"
%post
%if 0%{?sles_version}
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
%endif
%files
%defattr(-,root,root)
%dir /etc/modprobe.d
%config /etc/modprobe.d/00-system.conf
%if 0%{?sles_version}
%config(noreplace) /etc/modprobe.d/10-unsupported-modules.conf
%endif
%config(noreplace) /etc/modprobe.d/99-local.conf
%dir /etc/depmod.d
%config /etc/depmod.d/00-system.conf
%_docdir/module-init-tools
/usr/lib/module-init-tools
%changelog