- 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");
+ }
+ doit("install","-m","0644",$modprobe_file,"$tmp/etc/modprobe.d/".pkgfilename($package));
+ }
+
+ if (! $dh{NOSCRIPTS}) {
+ if ($modutils_file) {
+ autoscript($package,"postinst","postinst-update-modules");
+ autoscript($package,"postrm","postrm-update-modules");
+ }
+
+ 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");
+ }