[Pkg-privacy-commits] [tails-installer] 06/09: Determine the parent of the drive too and get better information on portability

anonym anonym-tails-guest at moszumanska.debian.org
Thu Jan 12 15:15:19 UTC 2017


This is an automated email from the git hooks/post-receive script.

anonym-tails-guest pushed a commit to annotated tag 3.14.0
in repository tails-installer.

commit 667a54bf2ee167a8f907e2e06324cf5f79247ba2
Author: Martin Briza <mbriza at redhat.com>
Date:   Fri May 22 15:23:02 2015 +0200

    Determine the parent of the drive too and get better information on portability
---
 liveusb/creator.py | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/liveusb/creator.py b/liveusb/creator.py
index 3640c08..9c562bb 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -515,14 +515,17 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
 
         for name, device in self.udisks.GetManagedObjects().iteritems():
             if ('org.freedesktop.UDisks2.Block' in device and
-                'org.freedesktop.UDisks2.Filesystem' in device):
+                'org.freedesktop.UDisks2.Filesystem' in device and
+                'org.freedesktop.UDisks2.Partition' in device):
                 self.log.debug('Found block device with filesystem on %s' % name)
             else:
                 continue
 
+            partition = device['org.freedesktop.UDisks2.Partition']
             fs = device['org.freedesktop.UDisks2.Filesystem']
             blk = device['org.freedesktop.UDisks2.Block']
 
+            """
             if blk['HintAuto'] is False:
                 self.log.debug('Skipping non-automounting filesystem: %s' % name)
                 continue
@@ -538,10 +541,22 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
             if blk['HintIgnore'] is True:
                 self.log.debug('Skipping ignorable device: %s' % name)
                 continue
+            """
             if blk['Drive'] == '/':
                 self.log.debug('Skipping root drive: %s' % name)
                 continue
 
+            drive_obj = self.bus.get_object("org.freedesktop.UDisks2", blk['Drive'])
+            drive = dbus.Interface(drive_obj, "org.freedesktop.DBus.Properties").GetAll("org.freedesktop.UDisks2.Drive")
+
+            # this is probably the only check we need, including Drive != "/"
+            if (not drive[u'Removable'] or
+                drive[u'Optical'] or
+                    (drive[u'ConnectionBus'] != 'usb' and
+                     drive[u'ConnectionBus'] != 'sdio')):
+                self.log.debug('Skipping a device that is not removable, connected via USB or is optical: %s' % name)
+                continue
+
             data = {
                 'udi': str(blk['Drive']),
                 'label': str(blk['IdLabel']),
@@ -582,6 +597,11 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
             data['free'] = mount and \
                     self.get_free_bytes(mount) / 1024**2 or None
 
+            print(partition[u'Table'])
+            parent_obj = self.bus.get_object("org.freedesktop.UDisks2", partition[u'Table'])
+            parent = dbus.Interface(parent_obj, "org.freedesktop.DBus.Properties").Get("org.freedesktop.UDisks2.Block", "Device")
+            data['parent'] = strify(parent)
+
             self.log.debug(pformat(data))
 
             self.drives[data['device']] = data

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/tails-installer.git



More information about the Pkg-privacy-commits mailing list