[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH] Don't clear the first partition on any disk with a Mac disk label (#492154).



---
 storage/partitioning.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/storage/partitioning.py b/storage/partitioning.py
index c478be6..6fa6904 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
-- 
1.6.1.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]