summaryrefslogtreecommitdiffstats
path: root/cluster/data/gen_modules_conf.pl.pl
diff options
context:
space:
mode:
Diffstat (limited to 'cluster/data/gen_modules_conf.pl.pl')
-rwxr-xr-xcluster/data/gen_modules_conf.pl.pl47
1 files changed, 47 insertions, 0 deletions
diff --git a/cluster/data/gen_modules_conf.pl.pl b/cluster/data/gen_modules_conf.pl.pl
new file mode 100755
index 000000000..0fa8e265f
--- /dev/null
+++ b/cluster/data/gen_modules_conf.pl.pl
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+
+use list_modules;
+
+my %kinds = (
+ scsi => 'disk/scsi|hardware_raid',
+ network => 'network/main|usb|gigabit',
+);
+
+my %kinds2all_modules = map {
+ $_ => [ list_modules::category2modules($kinds{$_}) ];
+} keys %kinds;
+
+$kinds2all_modules{usb} = [ qw(usb-uhci usb-ohci ehci-hcd) ];
+
+use Data::Dumper;
+print Data::Dumper->Dump([\%kinds2all_modules], ['$kinds2all_modules']);
+
+print <<'EOF';
+my @l = map { /^(\S+)\s*:/ ? $1 : () } `lspcidrake`;
+
+my %kinds2modules = map {
+ $_ => [ intersection(\@l, $kinds2all_modules->{$_}) ];
+} qw(usb scsi);
+
+$kinds2modules{network} = [
+ grep {
+ my $l = $_;
+ scalar grep { $_ eq $l } @{ $kinds2all_modules->{network} }
+ } @l
+];
+
+if (my @scsi = @{$kinds2modules{scsi}}) {
+ print "probeall scsi_hostadapter ", join(" ", @scsi), "\n";
+}
+if (my @usb = @{$kinds2modules{usb}}) {
+ print "probeall usb-interface ", join(" ", @usb), "\n";
+}
+my $eth = 0;
+foreach (@{$kinds2modules{network}}) {
+ print "alias eth$eth $_\n";
+ $eth++;
+}
+
+sub intersection { my (%l, @m); @l{@{shift @_}} = (); foreach (@_) { @m = grep { exists $l{$_} } @$_; %l = (); @l{@m} = () } keys %l }
+EOF
+