diff options
-rw-r--r-- | perl-install/common.pm | 4 | ||||
-rw-r--r-- | perl-install/fsedit.pm | 8 | ||||
-rw-r--r-- | perl-install/install2.pm | 11 |
3 files changed, 14 insertions, 9 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm index 4220b06d7..fbaf4cd80 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -131,9 +131,9 @@ sub before_leaving(&) { sub catch_cdie(&&) { my ($f, $catch) = @_; + local @common::cdie_catches; unshift @common::cdie_catches, $catch; &$f(); - shift @common::cdie_catches; } sub cdie { @@ -141,7 +141,7 @@ sub cdie { foreach (@common::cdie_catches) { &{$_}(@_) and return; } - die @_; + die join '', @_; } sub all { diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 6d07796d6..fc555c056 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -3,7 +3,7 @@ package fsedit; use diagnostics; use strict; -use common qw(:common :constant); +use common qw(:common :constant :functional); use partition_table qw(:types); use partition_table_raw; use Data::Dumper; @@ -50,10 +50,8 @@ sub hds($$) { eval { partition_table::read($hd, $flags->{clearall}) }; if ($@) { -# $@ =~ /bad magic number/ or die; - $flags->{eraseBadPartitions} ? - partition_table_raw::zero_MBR($hd) : - die; + &cdie($@) unless $flags->{eraseBadPartitions}; + partition_table_raw::zero_MBR($hd); } push @hds, $hd; } diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 9f64b17ee..bafaa515d 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -4,7 +4,7 @@ use diagnostics; use strict; use vars qw($o); -use common qw(:common :file :system); +use common qw(:common :file :system :functional); use install_any qw(:all); use log; use network; @@ -282,7 +282,14 @@ sub setupSCSI { sub partitionDisks { $o->{drives} = [ detect_devices::hds() ]; - $o->{hds} = fsedit::hds($o->{drives}, $o->{default}{partitioning}); + $o->{hds} = catch_cdie { fsedit::hds($o->{drives}, $o->{default}{partitioning}) } + sub { + $o->ask_warn(_("Error"), +_("I can't read your partition table, it's too corrupted for me :( +I'll try to go on blanking bad partitions")); + 1; + }; + unless (@{$o->{hds}} > 0) { $o->setupSCSI if $o->{autoSCSI}; # ask for an unautodetected scsi card } |