[Tails-dev] [review'n'merge 1.1.1] Tails Installer should no…

Delete this message

Reply to this message
Author: Andres Gomez Ramirez
Date:  
To: tails-dev@boum.org
Subject: [Tails-dev] [review'n'merge 1.1.1] Tails Installer should not run update_system_partition_properties on MBR partitions.
Hello,

Since I don't have yet a repository for liveusb-creator, I'm sending this single patch.

Ticket: https://labs.riseup.net/code/issues/7716.

Cheers,

kurono
From 4475ee91f4534a96cb774733d8cc791e03a36cf9 Mon Sep 17 00:00:00 2001
From: Tails developers <tails@???>
Date: Thu, 7 Aug 2014 23:53:08 +0200
Subject: [PATCH] Tails Installer should not run
update_system_partition_properties on MBR partitions

---
 liveusb/creator.py | 13 +++++++++++++
 liveusb/gui.py     |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)


diff --git a/liveusb/creator.py b/liveusb/creator.py
index ad9a0ab..19605f0 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -895,6 +895,19 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
         # do it (as of Wheezy).
         self._set_partition_flags(self.drive['parent'], 1, SYSTEM_PARTITION_FLAGS)


+    def is_partition_GPT(self):
+
+        # Check if the partition type is a valid GUID,
+        # if so it is a GPT.
+        udi = self.drive['udi']
+        dev_obj = self.bus.get_object("org.freedesktop.UDisks", udi)
+        properties = dbus.Interface(dev_obj, "org.freedesktop.DBus.Properties")
+        partition_type = str(properties.Get(udi, 'PartitionType'))
+        if re.match( r'^[0-9A-F]{8}(-[0-9A-F]{4}){3}-[0-9A-F]{12}$', partition_type):
+            return True
+        else:
+            return False
+
     def switch_drive_to_system_partition(self):
         self._full_drive = self._drive
         append = False
diff --git a/liveusb/gui.py b/liveusb/gui.py
index d2f89f8..4b89f03 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -239,7 +239,7 @@ class LiveUSBThread(QtCore.QThread):
             self.live.update_configs()


             self.live.reset_mbr()
-            if not self.parent.opts.partition:
+            if not self.parent.opts.partition and self.live.is_partition_GPT():
                 self.live.update_system_partition_properties()
             self.live.install_bootloader()
             # self.live.bootable_partition()
-- 
1.8.3.2