How to load a kernel module automatically?

Till Maas opensource at till.name
Mon Apr 2 17:22:21 UTC 2007


On So April 1 2007, Ville Skyttä wrote:

> You got it backwards, the simplistic scriptlets posted would do things in
> situations where they shouldn't be doing anything (this depends on the
> packaging scheme used - I'm assuming you're using the
> http://fedoraproject.org/wiki/Packaging/KernelModules one).

I only knew the dkms way in more detail, where this should not cause any 
trouble you described:

%post
rmmod uinput || :
%{_sysconfdir}/sysconf/modules/%{name}.modules || :

and with the kmod way something like this (I do not really understand without 
reading it in detail, how the different kernel flavors are separated, so 
maybe this has to be done for each variant slightly different) may work:

%post
if [ "%{kversion}" == "$(uname -r)" ]
then
rmmod module || :
%{_sysconfdir}/sysconf/modules/%{name}.modules || :
fi

This will only remove and/or load the module , when one for the current kernel 
is available (which is with the dkms scheme normally the case) and because of 
no action in %preun, no other harm will caused. But if this causes any other 
trouble, I would be pleased to be noticed about it.

Regards,
Till
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-maintainers/attachments/20070402/59fe7623/attachment.sig>


More information about the Fedora-maintainers mailing list