diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-12-09 20:14:31 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-12-09 20:14:31 +0000 |
commit | e696409f531a91c512a4c2768accccb58ec9f278 (patch) | |
tree | d183875dd9be74b7d0f1b4363d0520ebdb8ef8d4 | |
parent | 4a96a57480abda1195b8b67ad1a8175e7bc8ba13 (diff) | |
download | drakx-e696409f531a91c512a4c2768accccb58ec9f278.tar drakx-e696409f531a91c512a4c2768accccb58ec9f278.tar.gz drakx-e696409f531a91c512a4c2768accccb58ec9f278.tar.bz2 drakx-e696409f531a91c512a4c2768accccb58ec9f278.tar.xz drakx-e696409f531a91c512a4c2768accccb58ec9f278.zip |
- handle more locally "Reload partition table" (esp. without using setstep)
=> no exception is called through gtk
-rw-r--r-- | perl-install/diskdrake/hd_gtk.pm | 10 | ||||
-rw-r--r-- | perl-install/diskdrake/interactive.pm | 20 | ||||
-rw-r--r-- | perl-install/install_interactive.pm | 13 |
3 files changed, 27 insertions, 16 deletions
diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm index 1db5a6c6d..2c2be3faa 100644 --- a/perl-install/diskdrake/hd_gtk.pm +++ b/perl-install/diskdrake/hd_gtk.pm @@ -20,7 +20,7 @@ use fsedit; use fs; my ($width, $height, $minwidth) = (400, 50, 5); -my ($all_hds, $in, $current_kind, $current_entry, $update_all); +my ($all_hds, $in, $do_force_reload, $current_kind, $current_entry, $update_all); my ($w, @notebook, $done_button); =begin @@ -48,7 +48,7 @@ notebook current_kind[] =cut sub main { - ($in, $all_hds, my $nowizard) = @_; + ($in, $all_hds, my $nowizard, $do_force_reload) = @_; @notebook = (); @@ -115,8 +115,10 @@ sub try_ { my $v = eval { $f->($in, @args, $all_hds) }; if (my $err = $@) { - $err =~ /setstep/ and die ''; - $in->ask_warn(N("Error"), formatError($err)); + $in->ask_warn(N("Error"), formatError($err)); + } + if ($v eq 'force_reload') { + $all_hds = $do_force_reload->(); } $current_entry = '' if !diskdrake::interactive::is_part_existing($current_entry, $all_hds); diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index 599991db6..f588061f2 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -164,7 +164,7 @@ struct all_hds { sub main { - my ($in, $all_hds) = @_; + my ($in, $all_hds, $_nowizard, $do_force_reload) = @_; if ($in->isa('interactive::gtk')) { require diskdrake::hd_gtk; @@ -204,7 +204,13 @@ sub main { messages => format_part_info($current_hd, $current_part), }, [ { val => \$a, list => $actions, format => \&translate, type => 'list', sort => 0, gtk => { use_boxradio => 0 } } ]) or last; - $actions{$a}(); + my $v = eval { $actions{$a}() }; + if (my $err = $@) { + $in->ask_warn(N("Error"), formatError($err)); + } + if ($v eq 'force_reload') { + $all_hds = $do_force_reload->(); + } $current_hd = $current_part = '' if !is_part_existing($current_part, $all_hds); } else { $choose_part->(); @@ -317,21 +323,19 @@ sub Auto_allocate { sub More { my ($in, $hd) = @_; + my $r; $in->ask_from('', '', [ { val => N("Save partition table"), clicked_may_quit => sub { SaveInFile($in, $hd); 1 } }, { val => N("Restore partition table"), clicked_may_quit => sub { ReadFromFile($in, $hd); 1 } }, { val => N("Rescue partition table"), clicked_may_quit => sub { Rescuept($in, $hd); 1 } }, - if_($::isInstall, - { val => N("Reload partition table"), clicked => sub { - $::o->{all_hds} = fsedit::empty_all_hds(); - die "setstep doPartitionDisks\n" if $::setstep; - } }), + if_($::isInstall || 1, + { val => N("Reload partition table"), clicked_may_quit => sub { $r = 'force_reload'; 1 } }), if_($::isInstall, { text => N("Removable media automounting"), val => \$::o->{useSupermount}, type => 'bool' }, ), ], - ); + ) && $r; } sub ReadFromFile { diff --git a/perl-install/install_interactive.pm b/perl-install/install_interactive.pm index ab565eef8..f9db4f6c1 100644 --- a/perl-install/install_interactive.pm +++ b/perl-install/install_interactive.pm @@ -8,6 +8,7 @@ use partition_table qw(:types); use partition_table::raw; use detect_devices; use install_steps; +use install_any; use devices; use fsedit; use log; @@ -40,10 +41,15 @@ sub partition_with_diskdrake { $o->set_help('partition_with_diskdrake'); do { $ok = 1; + my $do_force_reload = sub { + $o->{all_hds} = fsedit::empty_all_hds(); + install_any::getHds($o, $o); + $o->{all_hds}; + }; require diskdrake::interactive; { local $::expert = $::expert; - diskdrake::interactive::main($o, $all_hds, $nowizard); + diskdrake::interactive::main($o, $all_hds, $nowizard, $do_force_reload); } if (delete $o->{wizard}) { partitionWizard($o, 'nodiskdrake') or redo; @@ -246,13 +252,12 @@ sub partitionWizard { if (my $sol = $o->ask_from_listf('', N("The DrakX Partitioning wizard found the following solutions:"), sub { $_[0][1] }, \@solutions)) { log::l("partitionWizard calling solution $sol->[1]"); my $ok = eval { $sol->[2]->() }; - die if $@ =~ /setstep/; $@ and $o->ask_warn('', N("Partitioning failed: %s", $@)); $ok or goto &partitionWizard; + 1; } else { - $nodiskdrake ? return : die "setstep setupSCSI\n"; + 0; } - 1; } sub upNetwork { |