summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-09-03 12:26:27 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-09-03 12:26:27 +0000
commita384dec9ada016af7631ecb2b29bd972045dc9b2 (patch)
tree35e469c0c929a20dc19f62081567eb51cc82b40b
parentdf097c88179d6241e0f8155f56e6c6fdbecb344a (diff)
downloaddrakx-a384dec9ada016af7631ecb2b29bd972045dc9b2.tar
drakx-a384dec9ada016af7631ecb2b29bd972045dc9b2.tar.gz
drakx-a384dec9ada016af7631ecb2b29bd972045dc9b2.tar.bz2
drakx-a384dec9ada016af7631ecb2b29bd972045dc9b2.tar.xz
drakx-a384dec9ada016af7631ecb2b29bd972045dc9b2.zip
fix mtab reading and pseudo-device use
-rw-r--r--perl-install/devices.pm2
-rw-r--r--perl-install/fs.pm18
-rw-r--r--perl-install/fsedit.pm7
3 files changed, 17 insertions, 10 deletions
diff --git a/perl-install/devices.pm b/perl-install/devices.pm
index 96faf3060..15f470e47 100644
--- a/perl-install/devices.pm
+++ b/perl-install/devices.pm
@@ -52,7 +52,7 @@ sub entry {
my ($type, $major, $minor);
local ($_) = @_;
- if (/^([\da-f]{3,4})$/i) {
+ if (/^0x([\da-f]{3,4})$/i) {
$type = c::S_IFBLK();
($major, $minor) = unmakedev(hex $1);
} elsif (/^sd(.)(\d{0,2})/) {
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index ab6c2a230..1a183cb8c 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -66,7 +66,7 @@ sub merge_fstabs {
my ($p2) = grep { fsedit::is_same_hd($_, $p) } @l or next;
@l = grep { !fsedit::is_same_hd($_, $p) } @l;
- $p->{type} ne $p2->{type} && $p->{type} ne 'auto' && $p2->{type} ne 'auto' and
+ $p->{type} ne $p2->{type} && type2fs($p) ne type2fs($p2) && $p->{type} ne 'auto' && $p2->{type} ne 'auto' and
log::l("err, fstab and partition table do not agree for $p->{device} type: " . (type2fs($p) || type2name($p->{type})) . " vs ", (type2fs($p2) || type2name($p2->{type}))), next;
$p->{mntpoint} = $p2->{mntpoint} if delete $p->{unsafeMntpoint};
@@ -74,9 +74,6 @@ sub merge_fstabs {
$p->{type} ||= $p2->{type};
$p->{options} = $p2->{options} if $p->{type} eq 'defaults';
add2hash($p, $p2);
- if ($p->{device} ne $p2->{device}) {
- print "HERE\n";
- }
$p->{device_alias} ||= $p2->{device_alias} || $p2->{device} if $p->{device} ne $p2->{device};
}
@l;
@@ -96,10 +93,19 @@ sub add2all_hds {
}
}
+sub get_major_minor {
+ (undef, $_->{major}, $_->{minor}) = devices::entry($_->{device}) foreach @_;
+}
+
sub merge_info_from_mtab {
my ($fstab) = @_;
- my @l1 = map {; { device => $_->{device}, type => fs2type('swap') } } read_fstab('', '/proc/swaps');
+ my @l1 = map { my $l = $_;
+ my %l = (type => fs2type('swap'));
+ $l{$_} = $l->{$_} foreach qw(device major minor);
+ \%l;
+ } read_fstab('', '/proc/swaps');
+
my @l2 = map { read_fstab('', $_) } '/etc/mtab', '/proc/mounts';
foreach (@l1, @l2) {
@@ -398,7 +404,7 @@ sub get_raw_hds {
detect_devices::floppies(), detect_devices::cdroms(),
(map { $_->{device} .= '4'; $_ } detect_devices::zips())
];
- (undef, $_->{major}, $_->{minor}) = devices::entry($_->{device}) foreach @{$all_hds->{raw_hds}};
+ get_major_minor(@{$all_hds->{raw_hds}});
my @fstab = read_fstab($prefix, "/etc/fstab", 'all_options');
$all_hds->{nfss} = [ grep { isNfs($_) } @fstab ];
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index 42a6b7311..2c96c39fc 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -165,8 +165,9 @@ sub hds {
}
- my $l = { %{ empty_all_hds() }, hds => \@hds, lvms => \@lvms, raids => \@raids };
- $l;
+ my $all_hds = { %{ empty_all_hds() }, hds => \@hds, lvms => \@lvms, raids => \@raids };
+ fs::get_major_minor(get_all_fstab($all_hds));
+ $all_hds;
}
@@ -200,7 +201,7 @@ sub readProcPartitions {
foreach my $part (@parts) {
my $dev;
if ($devfs_like) {
- $dev = -e "/dev/$part->{dev}" ? $part->{dev} : sprintf("%x%02x", $part->{major}, $part->{minor});
+ $dev = -e "/dev/$part->{dev}" ? $part->{dev} : sprintf("0x%x%02x", $part->{major}, $part->{minor});
$part->{rootDevice} = $devfs2normal{dirname($part->{dev}) . '/disc'};
} else {
$dev = $part->{dev};