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. This is for use by
25 modutils. Files named debian/package.modprobe will be installed in
26 etc/modprobe.d/package in the package build directory, to be used by
27 module-init-tools's version of modprobe.
29 Then postinst and postrm commands are automatically generated to register
30 the modules when the package is installed. See L<dh_installdeb(1)> for an
31 explanation of how this works. Note that this will be done for any
32 package this program acts on which has either a package.modules file, or
33 has .o or .ko files in /lib/modules.
39 =item B<-n>, B<--noscripts>
41 Do not modify postinst/postrm scripts.
43 =item B<--name=>I<name>
45 Use "name" as the filename the modules file is installed in
46 etc/modutils/. When this parameter is used, dh_installmodules looks for and
47 installs files named debian/package.name.modules instead of the usual
48 debian/package.modules.
54 Note that this command is not idempotent. "dh_clean -k" should be called
55 between invocations of this command. Otherwise, it may cause multiple
56 instances of the same text to be added to maintainer scripts.
62 # Returns true if there are any .o or .ko files in the passed directory.
63 sub find_kernel_modules {
67 return unless -d $searchdir;
68 find(sub { push @results, $_ if /\.k?o$/ }, $searchdir);
72 foreach my $package (@{$dh{DOPACKAGES}}) {
73 my $tmp=tmpdir($package);
74 my $modutils_file=pkgfile($package,"modules");
75 my $modprobe_file=pkgfile($package,"modprobe");
78 doit("install","-d",$tmp);
82 if (! -e "$tmp/etc/modutils") {
83 doit("install","-d","$tmp/etc/modutils");
85 doit("install","-m","0644",$modutils_file,"$tmp/etc/modutils/".pkgfilename($package));
89 if (! -e "$tmp/etc/modprobe.d") {
90 doit("install","-d","$tmp/etc/modprobe.d");
92 doit("install","-m","0644",$modprobe_file,"$tmp/etc/modprobe.d/".pkgfilename($package));
95 if (! $dh{NOSCRIPTS} &&
96 ($modutils_file || find_kernel_modules("$tmp/lib/modules"))) {
97 autoscript($package,"postinst","postinst-modules","s/#PACKAGE#/$package/");
98 autoscript($package,"postrm","postrm-modules","s/#PACKAGE#/$package/");
106 This program is a part of debhelper.
110 Joey Hess <joeyh@debian.org>