5 dh_installmodules - register modules with modutils
11 use Debian::Debhelper::Dh_Lib;
16 B<dh_installmodules> [S<I<debhelper options>>] [B<-n>] [B<--name=>I<name>]
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.
40 =item B<--name=>I<name>
42 Use "name" as the filename the modules file is installed in
43 etc/modutils/. When this parameter is used, dh_installmodules looks for and
44 installs files named debian/package.name.modules instead of the usual
45 debian/package.modules.
51 Note that this command is not idempotent. "dh_clean -k" should be called
52 between invocations of this command. Otherwise, it may cause multiple
53 instances of the same text to be added to maintainer scripts.
59 # Returns true if there are any .o files in the passed directory.
60 sub find_kernel_modules {
64 return unless -d $searchdir;
65 find(sub { push @results, $_ if /\.o$/ }, $searchdir);
69 foreach my $package (@{$dh{DOPACKAGES}}) {
70 my $tmp=tmpdir($package);
71 my $file=pkgfile($package,"modules");
74 doit("install","-d",$tmp);
78 if (! -e "$tmp/etc/modutils") {
79 doit("install","-d","$tmp/etc/modutils");
81 doit("install","-m","0644",$file,"$tmp/etc/modutils/".pkgfilename($package));
84 if (! $dh{NOSCRIPTS} &&
85 ($file || find_kernel_modules("$tmp/lib/modules"))) {
86 autoscript($package,"postinst","postinst-modules","s/#PACKAGE#/$package/");
87 autoscript($package,"postrm","postrm-modules","s/#PACKAGE#/$package/");
95 This program is a part of debhelper.
99 Joey Hess <joeyh@debian.org>