From 03d7d48114f72ac6762a6e236799ac93d9e04303 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Wed, 4 Feb 2015 21:08:24 +0000 Subject: Do not try to delete partitions if the partition table was overwritten --- perl-install/install/NEWS | 1 + perl-install/partition_table/gpt.pm | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'perl-install') diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index a73a53efc..d7195097b 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,5 +1,6 @@ - default to GPT on disks larger than 4TB, not LVM - fix GPT initialization on empty disk +- fix failure to delete partitions after switching to GPT Version 16.51 - 3 February 2015 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"; } } -- cgit v1.2.1