From c718e2dfd677b2d3e6acce231eecd2632c5ac5e0 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sat, 4 Aug 2001 23:37:08 +0000 Subject: add ext3 support --- perl-install/fs.pm | 21 ++++++++++----------- perl-install/fsedit.pm | 11 ++++++++++- perl-install/partition_table.pm | 6 ++++-- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 167b0b383..9973c5780 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -89,6 +89,11 @@ sub format_ext2($@) { run_program::run("mke2fs", @options, devices::make($dev)) or die _("%s formatting of %s failed", "ext2", $dev); } +sub format_ext3 { + my ($dev, @options) = @_; + format_ext2($dev, "-j", @options); +} + sub format_reiserfs($@) { my ($dev, @options) = @_; @@ -131,6 +136,8 @@ sub real_format_part { if (isExt2($part)) { push @options, "-F" if isLoopback($part); format_ext2($part->{device}, @options); + } elsif (isThisFs("ext3", $part)) { + format_ext3($part->{device}, @options); } elsif (isThisFs("reiserfs", $part)) { format_reiserfs($part->{device}, @options, if_(c::kernel_version() =~ /^\Q2.2/, "-v", "1")); } elsif (isThisFs("xfs", $part)) { @@ -221,27 +228,19 @@ sub mount($$$;$) { $mount_opt = 'check=relaxed'; eval { modules::load('vfat') }; #- try using vfat eval { modules::load('msdos') } if $@; #- otherwise msdos... - } elsif ($fs eq 'hfs') { - eval { modules::load('hfs') }; - } elsif ($fs eq 'ufs') { - eval { modules::load('ufs') }; - } elsif ($fs eq 'xfs') { - eval { modules::load('xfs') }; - } elsif ($fs eq 'jfs') { - eval { modules::load('jfs') }; } elsif ($fs eq 'reiserfs') { #- could be better if we knew if there is a /boot or not #- without knowing it, / is forced to be mounted with notail # if $where =~ m|/(boot)?$|; $mount_opt = 'notail'; #- notail in any case - eval { modules::load('reiserfs') }; - } elsif ($fs eq 'romfs') { - eval { modules::load('romfs') }; } elsif ($fs eq 'ext2') { run_program::run("fsck.ext2", "-a", $dev); $? & 0x0100 and log::l("fsck corrected partition $dev"); $? & 0xfeff and die _("fsck failed with exit code %d or signal %d", $? >> 8, $? & 255); } + if (member($fs, qw(hfs romfs ufs reiserfs xfs jfs ext3))) { + eval { modules::load($fs) }; + } $where =~ s|/$||; log::l("calling mount($dev, $where, $fs, $flag, $mount_opt)"); diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 37b875f22..85cd6f6b6 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -60,7 +60,16 @@ arch() !~ /^sparc/ ? ( ) : (), ); -sub typeOfPart { typeFromMagic(devices::make($_[0]), @partitions_signatures) } +sub typeOfPart { + my $dev = devices::make($_[0]); + my $t = typeFromMagic($dev, @partitions_signatures); + if ($t == 0x83) { + #- there is no magic to differentiate ext3 and ext2. Using libext2fs + #- to check if it has a journal + $t = 0x483 if c::is_ext3($dev); + } + $t; +} #-###################################################################################### #- Functions diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm index f8ead8aad..c3e7fe2fc 100644 --- a/perl-install/partition_table.pm +++ b/perl-install/partition_table.pm @@ -18,7 +18,7 @@ use log; if (arch() =~ /ppc/) { @important_types = ('Linux native', 'Linux swap', 'Apple HFS Partition', 'Apple Bootstrap'); } else { - @important_types = ('Linux native', 'Linux swap', if_(arch() =~ /i.86/, 'ReiserFS', 'JFS', 'DOS FAT16', 'Win98 FAT32')); + @important_types = ('Linux native', 'Linux swap', if_(arch() =~ /i.86/, 'ReiserFS', 'JFS', 'ext3', 'DOS FAT16', 'Win98 FAT32')); } @important_types2 = ('Linux RAID', 'Linux Logical Volume Manager partition'); @@ -36,6 +36,7 @@ arch() =~ /^ppc/ ? ( 0x183 => 'ReiserFS', 0x283 => 'XFS', 0x383 => 'JFS', + 0x483 => 'ext3', ) : arch() =~ /^sparc/ ? ( 0x1 => 'SunOS boot', 0x2 => 'SunOS root', @@ -191,6 +192,7 @@ arch() !~ /sparc/ ? ( 0x183=> 'reiserfs', 0x283=> 'xfs', 0x383=> 'jfs', + 0x483=> 'ext3', 0x401 => 'apple', 0x402 => 'hfs', nfs => 'nfs', #- hack @@ -237,7 +239,7 @@ sub isAppleBootstrap($) { $type2fs{$_[0]{type}} eq 'apple' && defined $_[0]{isBo sub isHiddenMacPart { defined $_[0]{isMap} } sub isLoopback { defined $_[0]{loopback_file} } sub isThisFs { $type2fs{$_[1]{type}} eq $_[0] } -sub isTrueFS { isExt2($_[0]) || isThisFs("reiserfs", $_[0]) || isThisFs("xfs", $_[0]) || isThisFs("jfs", $_[0]) } +sub isTrueFS { member($type2fs{$_[0]{type}}, qw(ext2 reiserfs xfs jfs ext3)) } sub isMountableRW { isTrueFS($_[0]) || isOtherAvailableFS($_[0]) } sub isNonMountable { isRAID($_[0]) || isLVM($_[0]) } -- cgit v1.2.1