]> git.donarmstrong.com Git - debhelper.git/commitdiff
r349: * dh_installmodules: still add depmod -a calls if run on a package that
authorjoey <joey>
Thu, 4 May 2000 22:52:49 +0000 (22:52 +0000)
committerjoey <joey>
Thu, 4 May 2000 22:52:49 +0000 (22:52 +0000)
     has no debian/modules file, but does contain modules.

debian/changelog
dh_installmodules
dh_installmodules.1

index 04beb88903c4f443e195c94322c0a0cecf5720dc..a937bb6c65aa8ff98dc687cba6bb8af24bfb8fe7 100644 (file)
@@ -1,3 +1,10 @@
+debhelper (2.0.96) unstable; urgency=low
+
+  * dh_installmodules: still add depmod -a calls if run on a package that
+    has no debian/modules file, but does contain modules.
+
+ -- Joey Hess <joeyh@debian.org>  Thu,  4 May 2000 15:32:42 -0700
+
 debhelper (2.0.95) unstable; urgency=low
 
   * Fixes for perl 5.6.
index a80163068a083e4007563f53786583fcd643e2f5..dd75c72b6ff48633508e14278327baab34694f0d 100755 (executable)
@@ -3,8 +3,19 @@
 # Register modules with modutils.
 
 use Debian::Debhelper::Dh_Lib;
+use File::Find;
 init();
 
+# Returns true if there are any .o files in the passed directory.
+sub find_kernel_modules {
+       my $searchdir=shift;
+       my @results=();
+
+       return unless -d $searchdir;
+       find(sub { push @results, $_ if /\.o$/ }, $searchdir);
+       return @results > 0;
+}
+
 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
        $TMP=tmpdir($PACKAGE);
        $file=pkgfile($PACKAGE,"modules");
@@ -18,10 +29,11 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
                        doit("install","-d","$TMP/etc/modutils");
                        doit("install","-m","0644",$file,"$TMP/etc/modutils/$PACKAGE");
                }
-               
-               if (! $dh{NOSCRIPTS}) {
+       }
+
+       if (! $dh{NOSCRIPTS} &&
+           ($file || find_kernel_modules("$TMP/lib/modules"))) {
                        autoscript($PACKAGE,"postinst","postinst-modules","s/#PACKAGE#/$PACKAGE/");
                        autoscript($PACKAGE,"postrm","postrm-modules","s/#PACKAGE#/$PACKAGE/");
-               }
        }
 }
index fb3a315781796bcf1bf0aa7b2fb85df065a3a4d6..aee47d36244dbe2b3a2dc4d04d7c29704a6f64c7 100644 (file)
@@ -15,7 +15,9 @@ in the package build directory.
 Then postinst and postrm commands are automatically generated to register
 the modules when the package is installed. See
 .BR dh_installdeb (1)
-for an explanation of how this works.
+for an explanation of how this works. Note that this will be done for any
+package this program acts on which has either the above-mentioned file, or 
+has .o files in /lib/modules.
 .SH OPTIONS
 .TP
 .B debhelper options