From 11b0e9fe0e06fc002cbb4df903dba1541fb88019 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 19 Sep 2007 14:57:17 +0000 Subject: create partition_table_initialize() and partition_table_clear_and_initialize() which are wrappers around partition_table::initialize() but which also create a singleton VG automatically (so that it's easier for the user) --- perl-install/fsedit.pm | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'perl-install/fsedit.pm') diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 1dc809ac4..d1871dc48 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -167,7 +167,8 @@ sub get_hds { } if ($flags->{clearall} || member($hd->{device}, @{$flags->{clear} || []})) { - partition_table::raw::zero_MBR_and_dirty($hd); + my $lvms = []; #- temporary one, will be re-created later in get_hds() + partition_table_initialize($lvms, $hd, $o_in); } else { my $handle_die_and_cdie = sub { if (my $type = fs::type::type_subpart_from_magic($hd)) { @@ -551,4 +552,23 @@ sub change_type { 1; } +sub partition_table_clear_and_initialize { + my ($lvms, $hd, $o_in, $o_type, $b_warn) = @_; + $hd->clear_existing; + partition_table_initialize($lvms, $hd, $o_in, $o_type, $b_warn); +} + +sub partition_table_initialize { + my ($lvms, $hd, $o_in, $b_warn, $o_type) = @_; + partition_table::initialize($hd, $o_type); + if ($hd->isa('partition_table::lvm')) { + if ($b_warn && $o_in) { + $o_in->ask_okcancel_('', N("ALL existing partitions and their data will be lost on drive %s", partition_table::description($hd))) or return; + } + require lvm; + lvm::check($o_in ? $o_in->do_pkgs : do_pkgs_standalone->new) if $::isStandalone; + lvm::create_singleton_vg($lvms, fs::get::hds_fstab($hd)); + } +} + 1; -- cgit v1.2.1