5 dh_installmodules - register modules with modutils
11 use Debian::Debhelper::Dh_Lib;
16 B<dh_installmodules> [S<I<debhelper options>>] [B<-n>]
20 dh_installmodules is a debhelper program that is responsible for
21 registering kernel modules with modutils.
23 Files named debian/package.modules will be installed as
24 etc/modutils/package in the package build directory.
26 Then postinst and postrm commands are automatically generated to register
27 the modules when the package is installed. See L<dh_installdeb(1)> for an
28 explanation of how this works. Note that this will be done for any
29 package this program acts on which has either the above-mentioned file, or
30 has .o files in /lib/modules.
36 =item B<-n>, B<--noscripts>
38 Do not modify postinst/postrm scripts.
44 Note that this command is not idempotent. "dh_clean -k" should be called
45 between invocations of this command. Otherwise, it may cause multiple
46 instances of the same text to be added to maintainer scripts.
52 # Returns true if there are any .o files in the passed directory.
53 sub find_kernel_modules {
57 return unless -d $searchdir;
58 find(sub { push @results, $_ if /\.o$/ }, $searchdir);
62 foreach my $package (@{$dh{DOPACKAGES}}) {
63 my $tmp=tmpdir($package);
64 my $file=pkgfile($package,"modules");
67 doit("install","-d",$tmp);
71 if (! -e "$tmp/etc/modutils") {
72 doit("install","-d","$tmp/etc/modutils");
74 doit("install","-m","0644",$file,"$tmp/etc/modutils/$package");
77 if (! $dh{NOSCRIPTS} &&
78 ($file || find_kernel_modules("$tmp/lib/modules"))) {
79 autoscript($package,"postinst","postinst-modules","s/#PACKAGE#/$package/");
80 autoscript($package,"postrm","postrm-modules","s/#PACKAGE#/$package/");
88 This program is a part of debhelper.
92 Joey Hess <joeyh@debian.org>