Re: [Tails-dev] [review'n'merge 1.1.1] Tails Installer shoul…

Delete this message

Reply to this message
Autor: Andres Gomez Ramirez
Data:  
Dla: The Tails public development discussion list
Temat: Re: [Tails-dev] [review'n'merge 1.1.1] Tails Installer should not run update_system_partition_properties on MBR partitions
Hi,

> Can't we instead use the "PartitionTableScheme" property of the
> parent device? This would seem more straightforward to me:
> http://udisks.freedesktop.org/docs/1.0.5/Device.html#Device:PartitionTableScheme


yes, but actually was easier with PartitionScheme of the same device :)
Attached the fix.

Cheers,

KuronoFrom e6683d8867ad60e45c40bed6623f22941e1b0d2f Mon Sep 17 00:00:00 2001
From: Tails developers <tails@???>
Date: Tue, 26 Aug 2014 19:36:37 +0200
Subject: [PATCH] Fix to Tails Installer should not run
update_system_partition_properties on MBR partitions.

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


diff --git a/liveusb/creator.py b/liveusb/creator.py
index ad9a0ab..20981d6 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -895,6 +895,18 @@ 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 scheme is 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_scheme = str(properties.Get(udi, 'PartitionScheme'))
+        if partition_scheme == 'gpt':
+            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