From 6e9c6ce48159d3df1cb69788bebc503ff8697e26 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 2 Jun 2005 05:21:21 +0000 Subject: allow upgrading a chroot (using drakx-in-chroot) --- perl-install/install2.pm | 4 ++-- perl-install/install_any.pm | 13 ++++++++++--- perl-install/install_steps_interactive.pm | 9 +++++---- 3 files changed, 17 insertions(+), 9 deletions(-) (limited to 'perl-install') diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 84f718c3b..6d40d923f 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -448,8 +448,8 @@ sub main { } if ($::local_install) { push @auto, -# 'selectLanguage', 'selectKeyboard', 'miscellaneous', - 'selectInstallClass', 'doPartitionDisks', 'formatPartitions', 'setupBootloader'; +# 'selectLanguage', 'selectKeyboard', 'miscellaneous', 'selectInstallClass', + 'doPartitionDisks', 'formatPartitions', 'setupBootloader'; fs::mount_usbfs(''); #- do it now so that when_load doesn't do it } diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 70ab8285f..371de8790 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -1429,11 +1429,18 @@ sub suggest_mount_points { sub find_root_parts { my ($fstab, $prefix) = @_; + + if ($::local_install) { + my $f = common::release_file('/mnt') or return; + chomp(my $s = cat_("/mnt$f")); + $s =~ s/\s+for\s+\S+//; + return { release => $s, release_file => $f }; + } + map { my $handle = any::inspect($_, $prefix); if (my $f = $handle && common::release_file($handle->{dir})) { - my $s = cat_("$handle->{dir}$f"); - chomp($s); + chomp(my $s = cat_("$handle->{dir}$f")); $s =~ s/\s+for\s+\S+//; log::l("find_root_parts found $_->{device}: $s"); { release => $s, part => $_, release_file => $f }; @@ -1530,7 +1537,7 @@ sub use_root_part { my ($all_hds, $part, $o_in) = @_; my $migrate_device_names; { - my $handle = any::inspect($part, $::prefix) or die; + my $handle = any::inspect($part, $::prefix) or internal_error(); my @from_fstab = fs::read_fstab($handle->{dir}, '/etc/fstab', 'keep_default'); diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index c44c60350..460e489f8 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -139,7 +139,7 @@ sub selectInstallClass { my ($o) = @_; if (my @l = install_any::find_root_parts($o->{fstab}, $o->{prefix})) { - log::l("proposing to upgrade partitions " . join(" ", map { $_->{part}{device} } @l)); + log::l("proposing to upgrade partitions " . join(" ", map { $_->{part} && $_->{part}{device} } @l)); my @releases = uniq(map { $_->{release} } @l); if (@releases != @l) { @@ -158,9 +158,10 @@ sub selectInstallClass { format => sub { ref($_[0]) ? N("Upgrade %s", $_[0]{release}) : translate($_[0]) } } ]); if (ref $p) { - my $part = $p->{part}; - log::l("choosing to upgrade partition $part->{device}"); - $o->{migrate_device_names} = install_any::use_root_part($o->{all_hds}, $part, $o); + if ($p->{part}) { + log::l("choosing to upgrade partition $p->{part}{device}"); + $o->{migrate_device_names} = install_any::use_root_part($o->{all_hds}, $p->{part}, $o); + } foreach (grep { $_->{mntpoint} } @{$o->{fstab}}) { my ($options, $_unknown) = fs::mount_options::unpack($_); $options->{encrypted} or next; -- cgit v1.2.1