Summary: Kernel module management utilities.
Name: modutils
Version: 2.4.22
Release: 8
Copyright: GPL
Group: System Environment/Kernel
Source: ftp://ftp.kernel.org/pub/linux/utils/kernel/modutils/v2.4/modutils-%{version}.tar.bz2
Patch1: modutils-2.4.10-systemmap.patch
Patch2: modutils-2.4.2-prepost.patch
Patch3: modutils-2.4.6-silence.patch
Patch4: modutils-2.4.18-versions.patch
Patch5: modutils-2.4.12-ppc3264.patch
Patch6: modutils-2.4.14-kallsyms.patch
Patch7: modutils-2.4.21-zlib.patch
Patch8: modutils-2.4.22-s390-exp-may2002.patch
Patch9: modutils-2.4.22-alias.patch
Patch10: modutils-2.4.22-genksyms.patch
Patch101: modutils-2.4.18-small.patch
Exclusiveos: Linux
Prereq: /sbin/chkconfig sh-utils
Obsoletes: modules
BuildPrereq: bison flex zlib-devel
BuildRoot: %{_tmppath}/%{name}-root

%description
The modutils package includes various programs needed for automatic
loading and unloading of modules under 2.2 and later kernels, as well
as other module management programs. Device drivers and filesystems
are two examples of loaded and unloaded modules.

%package devel
Summary: Kernel module management utilities development libraries.
Group: Development/Libraries
%description devel
The modutils-devel package includes library archives that allow programs
to implement insmod and rmmod.  Developers should not use these libraries,
they are for internal use only.

%prep
%setup -q
%patch1 -p1 -b .systemmap
%patch2 -p1 -b .prepost
%patch3 -p1 -b .silence
%patch4 -p1 -b .versions
%patch5 -p1 -b .ppc3264
%patch6 -p1 -b .kallsyms
%patch7 -p1 -b .zlib
%patch8 -p1
%patch9 -p1 -b .alias
%patch10 -p1

%build
autoconf-2.13

%ifarch i386
if [ -x /usr/bin/diet ]; then
  export CC="diet gcc"
fi
%endif
export CFLAGS="-Os -g"

# insmod.static (diet)

%configure --disable-compat-2-0 --disable-kerneld --enable-insmod-static \
        --exec_prefix=/ --disable-combined --enable-zlib --disable-strip
make -C obj %{?_smp_mflags} libobj.a
make -C util %{?_smp_mflags} libutil.a
make -C insmod %{?_smp_mflags} insmod.static
cp insmod/insmod.static ./insmod.static
make distclean

# installer use (diet, various code paths patched out)

patch -p1 -b --suffix .loader < %{PATCH101}

export CFLAGS="-Os -D__LOADER__ -Dxstrdup=strdup -Dxmalloc=malloc -Dxrealloc=realloc -Dxstrcat=strncat"
%configure --disable-compat-2-0 --disable-kerneld --enable-insmod-static \
        --exec_prefix=/ --disable-combined --enable-combined-rmmod \
        --disable-strip
make -C obj %{?_smp_mflags} dep all
make -C util %{?_smp_mflags} dep all
make -C insmod %{?_smp_mflags} dep all
mkdir libs
cp util/libutil.a libs/libmodutilutil.a
cp obj/libobj.a libs/libmodutilobj.a
cp insmod/libmodutils.a libs
patch -R -p1 < %{PATCH101}
make distclean

# normal

export CC=gcc
export CFLAGS="$RPM_OPT_FLAGS"
%configure --disable-compat-2-0 --disable-kerneld --exec_prefix=/ \
   --enable-zlib --disable-strip
make %{?_smp_mflags} dep all

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
mkdir -p $RPM_BUILD_ROOT/etc/cron.d
mkdir -p $RPM_BUILD_ROOT/sbin
mkdir -p $RPM_BUILD_ROOT/%{_libdir}
%makeinstall sbindir=$RPM_BUILD_ROOT/sbin

rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/{kdstat,kerneld}.8

find $RPM_BUILD_ROOT/sbin/ -name '*.static' -exec rm {} \;

install -m 755 insmod.static $RPM_BUILD_ROOT/sbin

install -m 644 libs/*.a $RPM_BUILD_ROOT/%{_libdir}

%clean
rm -rf $RPM_BUILD_ROOT

%post
# get rid of the old installations on upgrade
if [ -x /etc/rc.d/init.d/kerneld ] ; then
    /sbin/chkconfig --del kerneld
fi
if [ -f /etc/conf.modules -a ! -f /etc/modules.conf ] ; then
   mv -f /etc/conf.modules /etc/modules.conf
fi

%files
%defattr(-,root,root)
/sbin/*
%{_mandir}/*/*

%files devel
%defattr(-,root,root)
%{_libdir}/*.a

%changelog
* Tue Feb 11 2003 Bill Nottingham <notting@redhat.com> 2.4.22-8
- alias block-major-2 off, we never ship it as a module (#71036)

* Mon Feb  3 2003 Bill Nottingham <notting@redhat.com> 2.4.22-7
- make sure we don't use diet anywhere but x86, even if it's lying
  around
- fix zlib linkage, for real
- switch ftape alias (#7674)

* Fri Jan 31 2003 Florian La Roche <Florian.LaRoche@redhat.de>
- add patch for genksyms to not segfault in drivers/char/joystick
  for mainframe kernel builds

* Wed Jan 22 2003 Tim Powers <timp@redhat.com>
- rebuilt

* Thu Jan 16 2003 Bill Nottingham <notting@redhat.com> 2.4.22-4
- fix zlib static linkage patch

* Tue Dec 31 2002 Bill Nottingham <notting@redhat.com> 2.4.22-3
- add alias for tun/tap (#80491)

* Mon Dec 30 2002 Florian La Roche <Florian.LaRoche@redhat.de>
- add an IBM patch to also load 64bit kernel modules via a 31bit compiled app

* Mon Nov 25 2002 Bill Nottingham <notting@redhat.com> 2.4.22-1
- update to 2.4.22
- don't link zlib dynamically

* Tue Nov 19 2002 Bill Nottingham <notting@redhat.com> 2.4.21-1
- update to 2.4.21
- enable zlib for insmod.static, normal

* Fri Aug 16 2002 Bill Nottingham <notting@redhat.com> 2.4.18-2
- add check for gcc version mismatch between kernel/modules
  (<arjanv@redhat.com>)

* Tue Jul 23 2002 Bill Nottingham <notting@redhat.com> 2.4.18-1
- update to 2.4.18
- add some more default aliases
- fix checking of kernel version

* Mon Jun 24 2002 Bill Nottingham <notting@redhat.com> 2.4.16-1
- update to 2.4.16

* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Thu May 23 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Tue Apr 16 2002 Bill Nottingham <notting@redhat.com> 2.4.14-3
- force kallsyms on modules

* Mon Apr  1 2002 Bill Nottingham <notting@redhat.com> 2.4.14-2
- fix support for symbols that contain _R (<streeter@redhat.com>)

* Sat Mar  2 2002 Bill Nottingham <notting@redhat.com> 2.4.14-1
- update to 2.4.14
- take out genksyms.old, no more buildprereq for gperf

* Thu Feb 28 2002 Bill Nottingham <notting@redhat.com> 2.4.13-7/8
- rebuild against diet
- reenable rmmod in the library version, shrink it too

* Wed Feb 27 2002 Bill Nottingham <notting@redhat.com> 2.4.13-5
- rebuild in earlier environments

* Sun Feb 10 2002 Bill Nottingham <notting@redhat.com> 2.4.13-4
- various space shavings in -devel

* Fri Feb  8 2002 Bill Nottingham <notting@redhat.com> 2.4.13-3
- bump rev
- buildprereq gperf

* Mon Feb  4 2002 Bill Nottingham <notting@redhat.com> 2.4.13-1
- update to 2.4.13
- fix GPL symbol export

* Wed Jan 30 2002 Bill Nottingham <notting@redhat.com> 2.4.12-9
- shrink insmod.static

* Thu Jan 24 2002 Bill Nottingham <notting@redhat.com> 2.4.12-8
- fix installation of extra libraries (#58427)

* Thu Jan 17 2002 Bill Nottingham <notting@redhat.com> 2.4.12-7
- hack to allow depmod of 64bit kernels on 32bit PPC

* Tue Jan 15 2002 Bill Nottingham <notting@redhat.com> 2.4.12-6
- more ppc64 fixes

* Thu Jan 10 2002 Bill Nottingham <notting@redhat.com> 2.4.12-5
- fix build on combined 32/64 targets (ppc/sparc)

* Tue Dec 11 2001 Matt Wilson <msw@redhat.com>
- added a -devel subpackage that contains libraries that apps can use
  to implement insmod and rmmod

* Tue Dec  4 2001 Bill Nottingham <notting@redhat.com>
- get rid of some obsolete patches, other tweaks

* Thu Nov 29 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- update to 2.4.12

* Sat Nov 17 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- update to 2.4.11

* Tue Oct  2 2001 Bill Nottingham <notting@redhat.com>
- update to 2.4.10
- deprecate -i, -m arguments to depmod

* Tue Sep 25 2001 Bill Nottingham <notting@redhat.com>
- update to 2.4.9

* Wed Aug 29 2001 Bill Nottingham <notting@redhat.com>
- replace modutils-2.4.6-error patch with version that was integrated
  upstream

* Sat Aug 18 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- disable char-major-4 for s390/s390x

* Mon Jul  8 2001 Bill Nottingham <notting@redhat.com>
- remove /etc/cron.d/kmod

* Fri Jul  6 2001 Bill Nottingham <notting@redhat.com>
- update to 2.4.6
- alias binfmt-0000 off (#9709)
- turn off 'modules.conf is more recent than modules.dep' message (#14276,
  others)
- return nonzero from depmod if there are errors (#40935)
- fix manpage typo (#33123)

* Thu Jul 05 2001 Karsten Hopp <karsten@redhat.de>
- new S390 patch from IBM

* Tue Jun 26 2001 Elliot Lee <sopwith@redhat.com> 2.4.5-3
- Add modutils-2.4.5-stblocal.patch from Jakub. See the e-mail message
  inside the patch file for details.
- Use smp_mflags macro

* Thu Jun 21 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- add s390/s390x support

* Tue Apr 24 2001 Bill Nottingham <notting@redhat.com>
- update to 2.4.5

* Tue Mar  6 2001 Bill Nottingham <notting@redhat.com>
- add default post/preun for binfmt_misc

* Mon Feb 19 2001 Bill Nottingham <notting@redhat.com>
- change ipv6 alias to 'alias net-pf-10 off'

* Tue Feb 13 2001 Bill Nottingham <notting@redhat.com>
- add 'net-pf-10 ipv6' alias (#25405)

* Sun Jan 28 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- change "#ifdef s390" -> "#if defined(__s390__) || defined(__s390x__)"

* Tue Jan 23 2001 Bill Nottingham <notting@redhat.com>
- update to 2.4.2
- ship a genksyms.old

* Fri Jan 19 2001 Bill Nottingham <notting@redhat.com>
- fix ppp aliases

* Tue Jan  9 2001 Bill Nottingham <notting@redhat.com>
- oops, I blew away other people's changes. Fix that.
- only have tty-ldisc-11 in the aliases once

* Mon Jan  8 2001 Bill Nottingham <notting@redhat.com>
- update to 2.4.0
- tweak irda aliases
- remove vixie-cron dependency (it's not *required*)
- add missing %build (where did that go?)

* Sun Jan  7 2001 Bernhard Rosenkraenzer <bero@redhat.com>
- 2.4.0
- Get rid of obsolete char-major-60==ircom-tty patch
  (moved to 161)

* Sat Jan 06 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- add "ctc{0,1,2} -> ctc" alias for s390

* Sat Dec 23 2000 Bill Nottingham <notting@redhat.com>
- add missing comma in alias list
- add irda aliases

* Tue Dec 12 2000 Bill Nottingham <notting@redhat.com>
- add char-major-108 ppp_async alias

* Mon Dec 11 2000 Bill Nottingham <notting@redhat.com>
- fix ide-probe aliases (now ide-probe-mod)

* Wed Nov 22 2000 Matt Wilson <msw@redhat.com>
- 2.3.21, fixes more security problems.

* Thu Nov 16 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 2.3.20, fixes security holes

* Tue Oct 31 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 2.3.19
- add IrDA devices to alias patch
- update source URL

* Thu Oct 26 2000 Bill Nottingham <notting@redhat.com>
- fix ia64 module loading

* Mon Oct  2 2000 Bill Nottingham <notting@redhat.com>
- stupid ia64 tricks

* Fri Sep 29 2000 Jeff Johnson <jbj@redhat.com>
- upgrade to 2.3.17.
- sparc64 ELF hacks.

* Mon Aug 21 2000 Michael K. Johnson <johnsonm@redhat.com>
- Use %{_mandir} for removing kerneld-related man pages.

* Wed Aug  9 2000 Jakub Jelinek <jakub@redhat.com>
- fix build on SPARC

* Tue Aug  8 2000 Jakub Jelinek <jakub@redhat.com>
- update to 2.3.14

* Tue Jul 25 2000 Bill Nottingham <notting@redhat.com>
- update to 2.3.13
- turn psaux off again
- remove sound patch; it's obsolete

* Wed Jul 19 2000 Jakub Jelinek <jakub@redhat.com>
- rebuild to cope with glibc locale binary incompatibility

* Thu Jul 13 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 2.3.12
- fix up ia64

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Sat Jul  1 2000 Florian La Roche <laroche@redhat.com>
- add aliases for cipcb[0-3]

* Wed Jun 14 2000 Matt Wilson <msw@redhat.com>
- fix build on combined 32/64 bit sparc

* Thu Jun  1 2000 Bill Nottingham <notting@redhat.com>
- modules.confiscation

* Wed May 17 2000 Bill Nottingham <notting@redhat.com>
- add ia64 patch from Intel

* Wed May 17 2000 Jakub Jelinek <jakub@redhat.com>
- fix build with glibc 2.2

* Tue May 09 2000 Doug Ledford <dledford@redhat.com>
- Correct %description to reflect that we don't build kerneld by default

* Fri Apr 21 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 2.3.11

* Mon Apr  3 2000 Bill Nottingham <notting@redhat.com>
- fix net-pf-* aliases for ipx, appletalk

* Fri Mar 17 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 2.3.10

* Thu Feb 17 2000 Matt Wilson <msw@redhat.com>
- added alias for agpgart

* Mon Feb 14 2000 Bill Nottingham <notting@redhat.com>
- hardcode psaux alias to off everywhere

* Thu Feb  3 2000 Bill Nottingham <notting@redhat.com>
- add a symlink from conf.modules.5 to modules.conf.5

* Fri Jan 29 2000 Bill Nottingham <notting@redhat.com>
- fix breakage *correctly*

* Sat Jan 22 2000 Bill Nottingham <notting@redhat.com>
- fix breakage of our own cause w.r.t sound modules

* Thu Jan 06 2000 Jakub Jelinek <jakub@redhat.com>
- update to 2.3.9.
- port RH patches from 2.1.121 to 2.3.9 where needed.
- disable warning about conf.modules for now, in 7.0
  we should move to modules.conf.

* Wed Oct 13 1999 Jakub Jelinek <jakub@redhat.com>
- hardcode psaux alias on sparc to off.

* Tue Oct 05 1999 Bill Nottingham <notting@redhat.com>
- hardcode parport aliases....

* Mon Oct 04 1999 Cristian Gafton <gafton@redhat.com>
- rebuild against new glibc in the sparc tree

* Wed Sep 15 1999 Jakub Jelinek <jakub@redhat.com>
- rewrite sparckludge so that separate *64 binaries
  are not needed anymore.

* Sat Sep 11 1999 Cristian Gafton <gafton@redhat.com>
- apply the last patch in the %%prep section (doh!)

* Mon Apr 19 1999 Cristian Gafton <gafton@redhat.com>
- add support for the ppp compression modules by default

* Tue Apr 13 1999 Michael K. Johnson <johnsonm@redhat.com>
- add cron.d file to run rmmod -as

* Fri Apr 09 1999 Cristian Gafton <gafton@redhat.com>
- take out kerneld

* Mon Apr 05 1999 Cristian Gafton <gafton@redhat.com>
- add patch to make all raid personalities recognized

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com>
- auto rebuild in the new build environment (release 7)

* Thu Mar 18 1999 Cristian Gafton <gafton@redhat.com>
- obsoletes modules
- get rid of the /lib/modules/preferred hack

* Mon Mar 15 1999 Bill Nottingham <notting@redhat.com>
- added support for /lib/modules/foo/pcmcia
- make kerneld initscript not start by default

* Tue Feb 23 1999 Matt Wilson <msw@redhat.com>
- added sparc64 support from UltraPenguin

* Tue Jan 12 1999 Cristian Gafton <gafton@redhat.com>
- call libtoolize to allow it to compile on the arm

* Wed Dec 23 1998 Jeff Johnson <jbj@redhat.com>
- search /lib/modules/preferred before defaults but after specified paths.

* Tue Nov 17 1998 Cristian Gafton <gafton@redhat.com>
- upgraded to version 2.1.121

* Thu Nov 05 1998 Erik Troan <ewt@redhat.com>
- added -m, -i options

* Thu Oct 01 1998 Michael K. Johnson <johnsonm@redhat.com>
- fix syntax error I introduced when enhancing initscript

* Wed Sep 30 1998 Michael K. Johnson <johnsonm@redhat.com>
- enhance initscript

* Fri Aug 28 1998 Jeff Johnson <jbj@redhat.com>
- recompile statically linked binary for 5.2/sparc

* Tue Jul 28 1998 Jeff Johnson <jbj@redhat.com>
- pick up ultrapenguin patches (not applied for now).
- pre-generate keyword.c so gperf doesn't have to be present (not applied).
- util/sys_cm.c: fix create_module syscall (signed return on sparc too)

* Wed Jul 15 1998 Jeff Johnson <jbj@redhat.com>
- correct %postun typos

* Fri May 01 1998 Erik Troan <ewt@redhat.com>
- added /lib/modules/preferred to search path

* Fri Apr 24 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Tue Apr 07 1998 Cristian Gafton <gafton@redhat.com>
- updated to 2.1.85
- actually make use of the BuildRoot

* Fri Apr  3 1998 Jakub Jelinek <jj@ultra.linux.cz>
- Fix sparc64, add modinfo64 on sparc.

* Wed Mar 23 1998 Jakub Jelinek <jj@ultra.linux.cz>
- Handle EM_SPARCV9, kludge to support both 32bit and 64bit kernels
  from the same package on sparc/sparc64.

* Fri Nov  7 1997 Michael Fulbright
- removed warning message when conf.modules exists and is a empty

* Tue Oct 28 1997 Erik Troan <ewt@redhat.com>
- patched to honor -k in options
- added modprobe.1
- added init script

* Thu Oct 23 1997 Erik Troan <ewt@redhat.com>
- removed bogus strip of lsmod (which is a script)

* Mon Oct 20 1997 Erik Troan <ewt@redhat.com>
- updated to 2.1.55
- builds in a buildroot

* Mon Aug 25 1997 Erik Troan <ewt@redhat.com>
- added insmod.static

* Sun Aug 24 1997 Erik Troan <ewt@redhat.com>
- built on Intel
- combined rmmod and insmod