[Also posted to gentoo-dev and forum]

In order to scratch an itch that I've been having with either a new
kernel install or a recompilation of a kernel with a new config and
forgetting packages that installed kernel modules, I've created
kernelmod-rebuild to assist in the process of rebuilding packages.

This script is based on revdep-rebuild (i.e. I started with it and
changed it to do what I want) but instead of looking for broken library
dependencies, it looks for packages that have installed kernel modules.

What this script does is locate the packages that have installed modules
into /lib/modules, determines which ebuilds to rebuild based on that
list and rebuilds them.

What this script doesn't do is locate the packages such as vmware that
installed modules outside of the emerge process (since portage is
unaware of those modules). Unfortunately, you will still have to
remember to rerun the configuration process for those packages.

Here is the usage statement from the script

garath root # kernelmod-rebuild --help
Usage: /usr/bin/kernelmod-rebuild [OPTIONS] [--] [EMERGE_OPTIONS]

Rebuild packages that have installed kernel modules

  -X, --package-names  recompile based on package names, not exact versions
  -q, --quiet          be less verbose

Calls emerge, all other options are used for it (e. g. -p, --pretend).

Here is a sample run of the script on my system:

garath root # kernelmod-rebuild --package-names --quiet --pretend --verbose

Finding packages which install kernel modules...
Packages will be recompiled.

Collecting list of packages to rebuild... done.

Cleaning list of packages to rebuild... done.

Evaluating package order... done.

All prepared. Starting rebuild...

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R   ] media-sound/alsa-driver-0.9.8  -oss
[ebuild   R   ] media-video/nvidia-kernel-1.0.4496-r3

Now you can remove -p (or --pretend) from arguments and re-run kernelmod-rebuild.

This script is useful for when you decide to try out the latest
test-kernel, but can't remember all of the packages that you've
installed that build modules.  It is also useful when you make changes
to your kernel config and recompiled that kernel (as that can
occasionally break modules depending upon what you changed).

The ebuild for this script is located at
http://varnerfamily.org/pvarner/gentoo/kernelmod-rebuild-0.1.ebuild.tar.gz

To install the ebuild, download the tar file and extract it to your
portage overlay directory.  For example, I have set the variable
PORTDIR_OVERLAY in my make.conf file to /usr/local/portage.  Here is how
I installed the package on my machine:

garath root # cd /usr/local/portage
garath portage # wget 
http://varnerfamily.org/pvarner/gentoo/kernelmod-rebuild-0.1.ebuild.tar.gz
garath portage # tar xvzf kernelmod-rebuild-0.1.ebuild.tar.gz
garath portage # rm kernelmod-rebuild-0.1.ebuild.tar.gz
garath portage # emerge -pv kernelmod-rebuild
garath portage # emerge -v kernelmod-rebuild

If you are on a different architecture than x86, you either need to edit
the ebuild or set ACCEPT_KEYWORDS="~arch" as I have marked those
architectures unstable/testing since I don't have machines to test on. 
It should work properly, but I couldn't test it :)

If you want to report a bug, either reply to this thread or send me an
email to the address listed in the man page.

Finally, I have submitted the ebuild to bugzilla (bug# 39421)
<http://bugs.gentoo.org/show_bug.cgi?id=34921> with the request that the
script be included in the gentoolkit package.  Hopefully, it will be
accepted as part of the toolkit, but even if it isn't, I hope that some
of you can find it useful.

Regards,
Paul

--
[EMAIL PROTECTED] mailing list

Reply via email to