From e55184eed334811efc27b79948c2956a4b35f18b Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 20 Sep 2004 01:49:13 +0000 Subject: - don't use fs::get_info_from_fstab() in install_any::use_root_part() to be able to handle renamed devices - fs::get_info_from_fstab() doesn't take a prefix anymore - small perl_checker fix in install_any.pm --- perl-install/fs.pm | 5 ++--- perl-install/install_any.pm | 18 ++++++++++++++++-- perl-install/network/tools.pm | 2 +- perl-install/standalone/bootloader-config | 2 +- perl-install/standalone/diskdrake | 2 +- perl-install/standalone/drakboot | 2 +- 6 files changed, 22 insertions(+), 9 deletions(-) (limited to 'perl-install') diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 8b0a58e74..8d76939b8 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -236,10 +236,9 @@ sub merge_info_from_fstab { merge_fstabs($loose, $fstab, @l); } -# - when using "$loose", it does not merge in type&options from the fstab sub get_info_from_fstab { - my ($all_hds, $prefix) = @_; - my @l = read_fstab($prefix, '/etc/fstab', 'keep_default'); + my ($all_hds) = @_; + my @l = read_fstab('/etc/fstab', 'keep_default'); add2all_hds($all_hds, @l) } diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 1e9893242..04c3204e5 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -213,7 +213,7 @@ sub getFile { $o_altroot ||= '/tmp/image'; $f2 = "$o_altroot/$rel" if $rel !~ m,^/, && (!$postinstall_rpms || !-e $f2); #- $f2 = "/$rel" if !$::o->{packages}{mediums}{$asked_medium}{rpmsdir} && !-e $f2; #- not a relative path, should not be necessary with new media layout - my $F; open($F, $f2) && $F or do { $f2 !~ /XXX/ and log::l("Can't open $f2: $!"); undef } + my $F; open($F, $f2) ? $F : do { $f2 !~ /XXX/ and log::l("Can't open $f2: $!"); undef } } } || errorOpeningFile($f); } @@ -1281,7 +1281,21 @@ sub use_root_part { my ($all_hds, $part, $prefix) = @_; { my $handle = any::inspect($part, $prefix) or die; - fs::get_info_from_fstab($all_hds, $handle->{dir}); + + my @l = fs::read_fstab($handle->{dir}, '/etc/fstab', 'keep_default'); + + my $root = fs::get::root_(\@l); + if (!fsedit::is_same_hd($root, $part)) { + log::l("warning: fstab says root partition is $root->{device}, whereas we were reading fstab from $part->{device}"); + my ($old, $new) = map { my $s = $_->{device}; $s =~ s/\d+$//; $s } ($root, $part); + if ($old && $new) { + log::l("replacing $old with $new"); + $_->{device} =~ s!^\Q$old!$new! foreach @l; + log::l("l contains: $_->{device} $_->{mntpoint}") foreach @l; + } + } + fs::add2all_hds($all_hds, @l); + log::l("fstab is now: $_->{device} $_->{mntpoint}") foreach fs::get::fstab($all_hds); } isSwap($_) and $_->{mntpoint} = 'swap' foreach fs::get::really_all_fstab($all_hds); #- use all available swap. } diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm index 897d83235..e1d59c69f 100644 --- a/perl-install/network/tools.pm +++ b/perl-install/network/tools.pm @@ -177,7 +177,7 @@ sub remove_initscript() { sub use_windows { my ($file) = @_; my $all_hds = fsedit::get_hds({}, undef); - fs::get_info_from_fstab($all_hds, ''); + fs::get_info_from_fstab($all_hds); my $part = find { $_->{device_windobe} eq 'C' } fs::get::fstab($all_hds); $part or my $failed = N("No partition available"); my $source = find { -d $_ && -r "$_/$file" } map { "$part->{mntpoint}/$_" } qw(windows/system winnt/system windows/system32/drivers winnt/system32/drivers); diff --git a/perl-install/standalone/bootloader-config b/perl-install/standalone/bootloader-config index 0115e6de6..2d0ec329e 100755 --- a/perl-install/standalone/bootloader-config +++ b/perl-install/standalone/bootloader-config @@ -54,7 +54,7 @@ if ($image) { my $all_hds = fsedit::get_hds(); -fs::get_info_from_fstab($all_hds, ''); +fs::get_info_from_fstab($all_hds); my $bootloader = bootloader::read([ fs::get::fstab($all_hds) ]) or die "Cannot find a boot loader installed\n"; diff --git a/perl-install/standalone/diskdrake b/perl-install/standalone/diskdrake index d55968d81..77d30bedc 100755 --- a/perl-install/standalone/diskdrake +++ b/perl-install/standalone/diskdrake @@ -75,7 +75,7 @@ my $all_hds = fsedit::get_hds({}, $in); fs::get_raw_hds('', $all_hds); -fs::get_info_from_fstab($all_hds, ''); +fs::get_info_from_fstab($all_hds); fs::merge_info_from_mtab([ fs::get::really_all_fstab($all_hds) ]); $all_hds->{current_fstab} = fs::fstab_to_string($all_hds, ''); diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot index a2b81a559..3f3330d82 100755 --- a/perl-install/standalone/drakboot +++ b/perl-install/standalone/drakboot @@ -43,7 +43,7 @@ my $in = 'interactive'->vnew('su'); my $all_hds = fsedit::get_hds(); fs::get_raw_hds('', $all_hds); -fs::get_info_from_fstab($all_hds, ''); +fs::get_info_from_fstab($all_hds); my $fstab = [ fs::get::fstab($all_hds) ]; my $bootloader = bootloader::read($fstab); -- cgit v1.2.1