From 96e1e09fe5e0535ce05d02a0123c74ae88114d24 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 5 Nov 2002 19:41:42 +0000 Subject: introduce a new flag: getting_rid_of_readonly_allowed. It is set when the partition table badly handled by diskdrake, but we are still allowed to wipe the partition table and start with something new. --- perl-install/diskdrake/interactive.pm | 10 ++++++++-- perl-install/fsedit.pm | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index 46989c40c..9020e999f 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -105,6 +105,7 @@ struct hd { string info # name of the hd, eg: 'QUANTUM ATLAS IV 9 WLS' bool readonly # is it allowed to modify the partition table + bool getting_rid_of_readonly_allowed # is it forbidden to write because the partition table is badly handled, or is it because we MUST not change the partition table bool isDirty # does it need to be written to the disk bool needKernelReread # must we tell the kernel to reread the partition table bool hasBeenDirty # for undo @@ -264,7 +265,11 @@ sub Done { ################################################################################ sub hd_possible_actions { my ($in, $hd, $all_hds) = @_; - __("Clear all"), if_($::isInstall && !$hd->{readonly}, __("Auto allocate")), __("More"); + ( + if_(!$hd->{readonly} || $hd->{getting_rid_of_readonly_allowed}, __("Clear all")), + if_(!$hd->{readonly} && $::isInstall, __("Auto allocate")), + __("More"), + ); } sub hd_possible_actions_interactive { my ($in, $hd, $all_hds) = @_; @@ -282,7 +287,8 @@ sub Clear_all { if (isLVM($hd)) { lvm::lv_delete($hd, $_) foreach @parts } else { - $hd->{readonly} = 0; #- give a way out of readonly-ness. Dangerous! + $hd->{readonly} = 0; #- give a way out of readonly-ness. only allowed when getting_rid_of_readonly_allowed + $hd->{getting_rid_of_readonly_allowed} = 0; partition_table::raw::zero_MBR_and_dirty($hd); } } diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 4c2c43316..c262bcd59 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -792,6 +792,7 @@ sub use_proc_partitions { log::l("using /proc/partitions since diskdrake failed :("); partition_table::raw::zero_MBR($hd); $hd->{readonly} = 1; + $hd->{getting_rid_of_readonly_allowed} = 1; $hd->{primary} = { normal => [ grep { $_->{rootDevice} eq $hd->{device} } read_proc_partitions([$hd]) ] }; } -- cgit v1.2.1