File module-init-tools.spec of Package module-init-tools

#
# spec file for package module-init-tools (Version 3.4)
#
# Copyright (c) 2009 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/
#

# norootforbuild


Name:           module-init-tools
BuildRequires:  zlib-devel
Version:        3.4
Release:        56.<RELEASE11>
License:        GPL v2 or later
Group:          System/Kernel
# 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
Provides:       modules modutils
Obsoletes:      modules modutils
# the update kernel requires this symbol to make sure m-i-t is updated first
Provides:       module-init-tools_fix_bnc480524
AutoReqProv:    on
Summary:        Utilities to Load Modules into the Kernel
Url:            http://www.kerneltools.org/
Source0:        http://www.kernel.org/pub/linux/kernel/people/jcm/module-init-tools/module-init-tools-%{version}.tar.bz2
# the manpages are missing from the source tarball and builddepending on
# docbook-utils.rpm wouldn't be nice...
Source1:        module-init-tools-manpages-%version.tar.gz
Source2:        package-manpages.sh
Source3:        kernelversion
Source4:        README.SUSE
Source6:        modprobe.conf.tar.gz
Source7:        depmod.conf
Source8:        unsupported-modules
Source9:        weak-modules
Source10:       weak-modules2
Patch1:         module-init-tools-config_filter.diff
# XXX: do we still need this one?
Patch2:         module-init-tools-insmod-zlib.diff
Patch3:         module-init-tools-dump-modversions.diff
Patch4:         module-init-tools-modprobe-fastgetline.diff
Patch5:         module-init-tools-eintr.diff
Patch6:         module-init-tools-options-priority.diff
Patch7:         modprobe-different-exit-codes.patch
Patch8:         mit-unsupported-modules.patch
Patch9:         mit-zlibsupport-use-mmap.patch
Patch10:        module-options-from-kernel-cmdline.patch
Patch11:        depmod-abort-on-oom.patch
Patch12:        depmod-use-modules.order.patch
Patch13:        depmod-fix-is_higher_priority.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Utilities for loading kernel modules. Included are 'insmod', 'lsmod',
'rmmod', 'depmod', and 'modprobe'. The configuration file
/etc/modprobe.* can be used to pass parameters to the modules. 'depmod'
should be used after compiling a new kernel to generate the dependency
information. 'insmod' does not use the dependency nor the options file.
Therefore, 'modprobe' is normally used to load a module.



Authors:
--------
    Rusty Russell <rusty@rustcorp.com.au>
    Adam J. Richter <adam@yggdrasil.com>
    Jon Masters <jcm@jonmasters.org>

%prep
%setup -q -b1 -a6
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9
%patch10 -p1
%patch11
%patch12
%patch13
# don't try to regenerate the patched manpages (patch7 and patch9)
touch modprobe.conf.5 modprobe.8

%build
autoreconf --force --install
CFLAGS="$RPM_OPT_FLAGS" \
	./configure \
	--prefix=/ \
	--mandir=%{_mandir} \
	--enable-zlib
make %{?jobs:-j%jobs}

%install
make DESTDIR=$RPM_BUILD_ROOT install
rm $RPM_BUILD_ROOT/sbin/insmod.static
install -m755 %_sourcedir/kernelversion $RPM_BUILD_ROOT/sbin
install -m644 %_sourcedir/README.SUSE .
ln -sf /bin/lsmod $RPM_BUILD_ROOT/sbin/lsmod
#
# now assemble the parts for modprobe.conf
#
cd modprobe.conf
cp modprobe.conf.common modprobe.conf
if [ -f modprobe.conf.$RPM_ARCH ] ; then
	cat modprobe.conf.$RPM_ARCH >> modprobe.conf
fi
cat modprobe.conf.last >> modprobe.conf
install -d -m 755 $RPM_BUILD_ROOT/etc/modprobe.d
install -m644 %_sourcedir/unsupported-modules $RPM_BUILD_ROOT/etc/modprobe.d
install -m644 modprobe.conf $RPM_BUILD_ROOT/etc/modprobe.conf
install -m644 modprobe.conf.local $RPM_BUILD_ROOT/etc/modprobe.conf.local
install -d -m 755 $RPM_BUILD_ROOT/etc/depmod.d
install -m 644 %_sourcedir/depmod.conf $RPM_BUILD_ROOT/etc/
install -d -m 755 $RPM_BUILD_ROOT/usr/lib/%name
install -m 755 %_sourcedir/weak-modules{,2} $RPM_BUILD_ROOT/usr/lib/%name/

%clean
rm -rf $RPM_BUILD_ROOT

%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
	# if this is a _new_ SLES install, don't allow unsupported modules
	if test "$1" != 1; then
		return
	fi
	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
}
test_allow_on_install "$@"
if test "$allow" = "0"; then
	sed -ri 's/^( *allow_unsupported_modules *) 1/\1 0/' \
		/etc/modprobe.d/unsupported-modules
fi

%files
%defattr(-,root,root)
%config /etc/modprobe.conf
%config /etc/depmod.conf
%dir /etc/depmod.d
%config(noreplace) /etc/modprobe.d/unsupported-modules
%config(noreplace) /etc/modprobe.conf.local
%doc AUTHORS COPYING ChangeLog FAQ NEWS README TODO
%doc README.SUSE
%doc %{_mandir}/man?/*
/bin/*
/sbin/*
/usr/lib/%name
/etc/modprobe.d

%changelog
openSUSE Build Service is sponsored by