summaryrefslogtreecommitdiffstats
path: root/perl-install/fsedit.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-09-19 14:57:17 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-09-19 14:57:17 +0000
commit11b0e9fe0e06fc002cbb4df903dba1541fb88019 (patch)
treea65d1d60a01c99cd11e8118706abeb36906fc748 /perl-install/fsedit.pm
parent826763e26b59688ccbb0a5adc5a5e46a32fe532d (diff)
downloaddrakx-11b0e9fe0e06fc002cbb4df903dba1541fb88019.tar
drakx-11b0e9fe0e06fc002cbb4df903dba1541fb88019.tar.gz
drakx-11b0e9fe0e06fc002cbb4df903dba1541fb88019.tar.bz2
drakx-11b0e9fe0e06fc002cbb4df903dba1541fb88019.tar.xz
drakx-11b0e9fe0e06fc002cbb4df903dba1541fb88019.zip
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)
Diffstat (limited to 'perl-install/fsedit.pm')
-rw-r--r--perl-install/fsedit.pm22
1 files changed, 21 insertions, 1 deletions
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;