From 86237df0ca5fbcb73bca789f876c9f72bfd49100 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 6 Sep 2004 06:53:57 +0000 Subject: detect linux software raid magic --- perl-install/fs/type.pm | 17 ++++++++++++++++- perl-install/fsedit.pm | 11 +++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'perl-install') diff --git a/perl-install/fs/type.pm b/perl-install/fs/type.pm index 137731c4b..70ca967bf 100644 --- a/perl-install/fs/type.pm +++ b/perl-install/fs/type.pm @@ -278,7 +278,22 @@ sub fs_type_from_magic { sub type_subpart_from_magic { my ($part) = @_; my $dev = devices::make($part->{device}); - my $t = typeFromMagic($dev, @partitions_signatures) or return; + + my $check_md = sub { + my ($F) = @_; + my $MD_RESERVED_SECTORS = 128; + my $sector = round_down($part->{size}, $MD_RESERVED_SECTORS) - $MD_RESERVED_SECTORS; #- MD_NEW_SIZE_SECTORS($part->{size}) + if (c::lseek_sector(fileno $F, $sector, 0)) { + my $tmp; + my $signature = "\xfc\x4e\x2b\xa9"; + sysread($F, $tmp, length $signature); + $tmp eq $signature and return "Linux RAID"; + } + ''; + }; + my $t = typeFromMagic($dev, + $check_md, + @partitions_signatures) or return; my $p = type_name2subpart($t) || fs_type2subpart($t) || internal_error("unknown name/fs $t"); if ($p->{fs_type} eq 'ext2') { diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index ddb848e32..3d2565bca 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -63,6 +63,8 @@ sub raids { my @parts = fs::get::hds_fstab(@$hds); my @l = grep { isRawRAID($_) } @parts or return []; + + log::l("looking for raids in " . join(' ', map { $_->{device} } @l)); require raid; raid::detect_during_install(@l) if $::isInstall; @@ -183,8 +185,13 @@ Do you agree to lose all the partitions? # checking the magic of the filesystem, don't rely on pt_type foreach (grep { member($_->{fs_type}, 'vfat', 'ntfs', 'ext2') || $_->{pt_type} == 0x100 } @parts) { - if (my $fs_type = fs::type::fs_type_from_magic($_)) { - $_->{fs_type} = $fs_type; + if (my $type = fs::type::type_subpart_from_magic($_)) { + if ($type->{fs_type}) { + #- keep {pt_type} + $_->{fs_type} = $fs_type; + } else { + put_in_hash($_, $type); + } } else { $_->{bad_fs_type_magic} = 1; } -- cgit v1.2.1