diff options
-rw-r--r-- | perl-install/detect_devices.pm | 28 | ||||
-rw-r--r-- | perl-install/fsedit.pm | 5 |
2 files changed, 24 insertions, 9 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 54f803756..cabc7807c 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -10,6 +10,7 @@ use vars qw($pcitable_addons $usbtable_addons); use log; use common; use devices; +use run_program; use c; #-##################################################################################### @@ -551,22 +552,33 @@ sub hasMousePS2 { } sub raidAutoStartIoctl { - eval { modules::load('md') }; - my $md = devices::make("md0"); local *F; - sysopen F, $md, 2 or return; + sysopen F, devices::make("md0"), 2 or return; ioctl F, 2324, 0; } +sub raidAutoStartRaidtab { + my (@parts) = @_; + #- faking a raidtab, it seems to be working :-))) + #- (choosing md0, but it works for the others!) + foreach (@parts) { + output("/etc/raidtab", "raiddev /dev/md0\n device " . devices::make($_->{device}) . "\n"); + run_program::run('raidstart', devices::make("md0")); + } +} + sub raidAutoStart { + my (@parts) = @_; + log::l("raidAutoStart"); + eval { modules::load('md') }; my %personalities = ( '1' => 'linear', '2' => 'raid0', '3' => 'raid1', '4' => 'raid5' ); - raidAutoStartIoctl() or log::l("warning, RAID_AUTORUN not supported by kernel"), return; - if (my @needed_perso = map { if_(/^kmod: failed.*md-personality-(.)/, $personalities{$1}) } syslog()) { + raidAutoStartIoctl() or raidAutoStartRaidtab(@parts); + if (my @needed_perso = map { + if_(/^kmod: failed.*md-personality-(.)/ || + /^md: personality (.) is not loaded/, $personalities{$1}) } syslog()) { log::l("RAID: autostart needs personality from $_"), eval { modules::load(@needed_perso) }; - return raidAutoStartIoctl(); - } else { - 1; + raidAutoStartIoctl() or raidAutoStartRaidtab(@parts); } } diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index afff117ad..5b700d387 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -90,7 +90,10 @@ sub raids { my ($hds) = @_; my @parts = get_fstab(@$hds); - (grep { isRawRAID($_) } @parts) && detect_devices::raidAutoStart() or return []; + { + my @l = grep { isRawRAID($_) } @parts or return []; + detect_devices::raidAutoStart(@l); + } fs::get_major_minor(@parts); my %devname2part = map { $_->{dev} => { %$_, device => $_->{dev} } } read_partitions(); |