summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table/gpt.pm
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@gmail.com>2015-02-04 21:08:24 +0000
committerPascal Terjan <pterjan@gmail.com>2015-02-04 21:09:33 +0000
commit03d7d48114f72ac6762a6e236799ac93d9e04303 (patch)
tree3dad59d6b0633729fe5b872579991df6fcaf60fe /perl-install/partition_table/gpt.pm
parent8558c1b6785d2853747ef69dcf8a1fe0268531ea (diff)
downloaddrakx-03d7d48114f72ac6762a6e236799ac93d9e04303.tar
drakx-03d7d48114f72ac6762a6e236799ac93d9e04303.tar.gz
drakx-03d7d48114f72ac6762a6e236799ac93d9e04303.tar.bz2
drakx-03d7d48114f72ac6762a6e236799ac93d9e04303.tar.xz
drakx-03d7d48114f72ac6762a6e236799ac93d9e04303.zip
Do not try to delete partitions if the partition table was overwritten
Diffstat (limited to 'perl-install/partition_table/gpt.pm')
-rw-r--r--perl-install/partition_table/gpt.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm
index 021bdc6bd..3d4206f68 100644
--- a/perl-install/partition_table/gpt.pm
+++ b/perl-install/partition_table/gpt.pm
@@ -132,9 +132,12 @@ sub read_one {
sub write {
my ($hd, $_sector, $_pt, $_info) = @_;
+ my $partitions_killed;
+
# Initialize the disk if current partition table is not gpt
if (c::get_disk_type($hd->{file}) ne "gpt") {
c::set_disk_type($hd->{file}, "gpt");
+ $partitions_killed = 1;
}
foreach (@{$hd->{will_tell_kernel}}) {
@@ -143,7 +146,7 @@ sub write {
print "($action, $part_number, $o_start, $o_size)\n";
if ($action eq 'add') {
c::disk_add_partition($hd->{file}, $o_start, $o_size, $part->{fs_type}) or die "failed to add partition";
- } elsif ($action eq 'del') {
+ } elsif ($action eq 'del' and !$partitions_killed) {
c::disk_del_partition($hd->{file}, $part_number) or die "failed to del partition";
}
}