From 5fd254ac761d176927bad809363b8b99c2c7245c Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Thu, 7 May 2009 17:39:00 -0400 Subject: Don't clear the first partition on any disk with a Mac disk label (#492154). --- storage/partitioning.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'storage') diff --git a/storage/partitioning.py b/storage/partitioning.py index a330133da..97316b42b 100644 --- a/storage/partitioning.py +++ b/storage/partitioning.py @@ -256,6 +256,13 @@ def shouldClear(part, clearPartType, clearPartDisks=None, protectedPartitions=No if clearPartType == CLEARPART_TYPE_NONE: return False + # Never clear the special first partition on a Mac disk label, as that + # holds the partition table itself. + if part.disk.partedDisk.type == "mac" and \ + part.partedPartition.number == 1 and \ + part.partedPartition.name == "Apple": + return False + # If we got a list of disks to clear, make sure this one's on it if clearPartDisks and part.disk.name not in clearPartDisks: return False -- cgit