How to load a kernel module automatically?

Ville Skyttä ville.skytta at iki.fi
Sun Apr 1 15:36:42 UTC 2007


On Sunday 01 April 2007, Till Maas wrote:
>
> In the spec:
>
> %post
> %{_sysconfdir}/sysconf/modules/%{name}.modules || :
>
> %preun
> rmmod uinput || :
>
> /etc/sysconfig/modules/*.modules are executed at boottime, and the
> scriptlets load and remove the module at the right moment.

%post above is broken, it'll fail to do the right thing if the module is 
already loaded.  %preun is broken too, it'll cause the module to be removed 
on package upgrades (assuming it succeeds).  The scriptlets above also don't 
take into account if the package being installed/upgraded/erased contains 
modules for the currently running kernel in the first place; if not, they're 
not desirable.  I think it's generally better to not try adding/removing 
modules in scriptlets at all, but just do the depmod -a(e) for the correct 
kernel.




More information about the Fedora-maintainers mailing list