From 2c5020419c6e499779c350f2c04e0c950303ef03 Mon Sep 17 00:00:00 2001 From: joey Date: Thu, 4 May 2000 22:52:49 +0000 Subject: [PATCH] r349: * dh_installmodules: still add depmod -a calls if run on a package that has no debian/modules file, but does contain modules. --- debian/changelog | 7 +++++++ dh_installmodules | 18 +++++++++++++++--- dh_installmodules.1 | 4 +++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 04beb88..a937bb6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Thu, 4 May 2000 15:32:42 -0700 + debhelper (2.0.95) unstable; urgency=low * Fixes for perl 5.6. diff --git a/dh_installmodules b/dh_installmodules index a801630..dd75c72 100755 --- a/dh_installmodules +++ b/dh_installmodules @@ -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/"); - } } } diff --git a/dh_installmodules.1 b/dh_installmodules.1 index fb3a315..aee47d3 100644 --- a/dh_installmodules.1 +++ b/dh_installmodules.1 @@ -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 -- 2.39.2