- 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/");
+ if ($modprobe_file) {
+ if (! -e "$tmp/etc/modprobe.d") {
+ doit("install","-d","$tmp/etc/modprobe.d");
+ }
+ my $old="/etc/modprobe.d/".pkgfilename($package);
+ my $new=$old.".conf";
+ doit("install","-m","0644",$modprobe_file,"$tmp/$new");
+ autoscript($package,"preinst","preinst-moveconffile","s!#OLD#!$old!g;s!#PACKAGE#!$package!g");
+ autoscript($package,"postinst","postinst-moveconffile","s!#OLD#!$old!g;s!#NEW#!$new!g");
+ }
+
+ if (! $dh{NOSCRIPTS}) {
+ foreach my $kvers (find_kernel_modules("$tmp/lib/modules")) {
+ autoscript($package,"postinst","postinst-modules","s/#KVERS#/$kvers/g");
+ autoscript($package,"postrm","postrm-modules","s/#KVERS#/$kvers/g");
+ }