From d2e6bef17c3ae499c1be02e409e9fce7bb30fe19 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 27 Aug 2002 22:08:01 +0000 Subject: remove/simplify error hanling (most of it is moved to fsedit.pm) --- perl-install/install_any.pm | 27 +++++++-------------------- perl-install/install_steps_interactive.pm | 21 +-------------------- 2 files changed, 8 insertions(+), 40 deletions(-) diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 9dc5b573d..85ce06463 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -1003,22 +1003,11 @@ sub use_root_part { } sub getHds { - my ($o, $f_err) = @_; - my $ok = 1; + my ($o, $in) = @_; my $try_scsi = !$::expert; - my $flags = $o->{partitioning}; - - my @drives = detect_devices::hds(); -# add2hash_($o->{partitioning}, { readonly => 1 }) if partition_table::raw::typeOfMBR($drives[0]{device}) eq 'system_commander'; getHds: - my $all_hds = catch_cdie { fsedit::hds(\@drives, $flags) } - sub { - $ok = 0; - my $err = formatError($@); - log::l("error reading partition table: $err"); - !$flags->{readonly} && $f_err and $f_err->($err); - }; + my $all_hds = fsedit::get_hds($o->{partitioning}, $in); my $hds = $all_hds->{hds}; if (is_empty_array_ref($hds) && $try_scsi) { @@ -1026,15 +1015,13 @@ sub getHds { $o->setupSCSI; #- ask for an unautodetected scsi card goto getHds; } - if (!$::testing) { - @$hds = grep { eval { partition_table::raw::test_for_bad_drives($_) }; !$@ } @$hds; - } - $ok = fsedit::verifyHds($hds, $flags->{readonly}, $ok) - if !($flags->{clearall} || $flags->{clear}); + if (is_empty_array_ref($hds)) { #- no way + die _("An error occurred - no valid devices were found on which to create new filesystems. Please check your hardware for the cause of this problem"); + } #- try to figure out if the same number of hds is available, use them if ok. - $ok && $hds && @$hds > 0 && @{$o->{all_hds}{hds} || []} == @$hds and return $ok; + @{$o->{all_hds}{hds} || []} == @$hds and return 1; fs::get_raw_hds('', $all_hds); fs::add2all_hds($all_hds, @{$o->{manualFstab}}); @@ -1062,7 +1049,7 @@ sub getHds { } #- a good job is to mount SunOS root partition, and to use mount point described here in /etc/vfstab. - $ok; + 1; } sub log_sizes { diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 04ec5abed..95d8a5ae5 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -360,26 +360,7 @@ sub ask_mntpoint_s { sub doPartitionDisks { my ($o) = @_; - my $warned; - install_any::getHds($o, sub { - my ($err) = @_; - $warned = 1; - if ($o->ask_yesorno(_("Error"), -_("I can't read your partition table, it's too corrupted for me :( -I can try to go on, erasing over bad partitions (ALL DATA will be lost!). -The other solution is to not allow DrakX to modify the partition table. -(the error is %s) - -Do you agree to loose all the partitions? -", $err))) { - 0; - } else { - $o->{partitioning}{readonly} = 1; - 1; - } - }) or $warned or $o->ask_warn('', -_("DiskDrake failed to read correctly the partition table. -Continue at your own risk!")); + install_any::getHds($o, $o); if (arch() =~ /ppc/ && detect_devices::get_mac_generation =~ /NewWorld/) { #- need to make bootstrap part if NewWorld machine - thx Pixel ;^) if (defined $partition_table::mac::bootstrap_part) { -- cgit v1.2.1