def install(self, source, target, persist, allow_system_internal=False):
        # TODO evand 2009-07-31: Lock source and target.
        logging.debug('install source: %s' % source)
        logging.debug('install target: %s' % target)
        logging.debug('install persistence: %d' % persist)

        # There's no going back now...
        self.bus.remove_signal_receiver(self._device_added, 'DeviceAdded',
                                        DISKS_IFACE, DISKS_IFACE,
                                        '/org/freedesktop/UDisks')
        self.bus.remove_signal_receiver(self._device_changed, 'DeviceChanged',
                                        DISKS_IFACE, DISKS_IFACE,
                                        '/org/freedesktop/UDisks')
        self.bus.remove_signal_receiver(self._device_removed, 'DeviceRemoved',
                                        DISKS_IFACE, DISKS_IFACE,
                                        '/org/freedesktop/UDisks')

        stype = self.sources[source]['type']
        if stype == misc.SOURCE_CD:
            dk = self.bus.get_object(DISKS_IFACE, source)

            def get_source(prop):
                return dk.Get(source, prop, dbus_interface=PROPS_IFACE)

            if not get_source('device-is-mounted'):
                source = dk.FilesystemMount('', [],
                                            dbus_interface=DEVICE_IFACE)
            else:
                source = get_source('device-mount-paths')[0]
        elif stype == misc.SOURCE_ISO:
            isofile = self.sources[source]['device']
            source = self.helper.MountISO(isofile)
            self.mounted_source = source

        dk = self.bus.get_object(DISKS_IFACE, target)

        def get_target(prop):
            return dk.Get(target, prop, dbus_interface=PROPS_IFACE)

        dev = get_target('device-file')
        if stype == misc.SOURCE_IMG:
            target = None
            self.helper.Unmount(target)
        else:
            if not get_target('device-is-mounted'):
                target = dk.FilesystemMount('', [],
                                            dbus_interface=DEVICE_IFACE)
            else:
                target = get_target('device-mount-paths')[0]
            self.helper.RemountRW(dev)
        Backend.install(self,
                        source,
                        target,
                        persist,
                        device=dev,
                        allow_system_internal=allow_system_internal)
 def install(self, source, target, persist):
     target_dev = None
     source_type = self.sources[source]['type']
     if source_type == misc.SOURCE_IMG:
         target_dev = get_device_num_for_letter(target)
         if target_dev < 1:
             logging.error('Could not determine the disk number.  Got %d.' %
                           target_dev)
             # TODO evand 2009-08-28: Fail.
             return
         target_dev = '\\\\?\\Device\\Hardisk%d\\Partition0' % target_dev
     Backend.install(self, source, target, persist, device=target_dev)
Beispiel #3
0
    def install(self, source, target, persist, allow_system_internal=False):
        # TODO evand 2009-07-31: Lock source and target.
        logging.debug('install source: %s' % source)
        logging.debug('install target: %s' % target)
        logging.debug('install persistence: %d' % persist)

        # There's no going back now...
        self.bus.remove_signal_receiver(self._device_added,
            'DeviceAdded',
            DISKS_IFACE,
            DISKS_IFACE,
            '/org/freedesktop/UDisks')
        self.bus.remove_signal_receiver(self._device_changed,
            'DeviceChanged',
            DISKS_IFACE,
            DISKS_IFACE,
            '/org/freedesktop/UDisks')
        self.bus.remove_signal_receiver(self._device_removed,
            'DeviceRemoved',
            DISKS_IFACE,
            DISKS_IFACE,
            '/org/freedesktop/UDisks')

        stype = self.sources[source]['type']
        if stype == SOURCE_CD:
            dk = self.bus.get_object(DISKS_IFACE, source)
            def get(prop):
                return dk.Get(source, prop, dbus_interface=PROPS_IFACE)
            if not get('device-is-mounted'):
                source = dk.FilesystemMount('', [], dbus_interface=DEVICE_IFACE)
            else:
                source = get('device-mount-paths')[0]
        elif stype == SOURCE_ISO:
            isofile = self.sources[source]['device']
            source = self.helper.MountISO(isofile)
            self.mounted_source = source
        
        dk = self.bus.get_object(DISKS_IFACE, target)
        def get(prop):
            return dk.Get(target, prop, dbus_interface=PROPS_IFACE)
        dev = get('device-file')
        if stype == SOURCE_IMG:
            target = None
            self.helper.Unmount(target)
        else:
            if not get('device-is-mounted'):
                target = dk.FilesystemMount('', [], dbus_interface=DEVICE_IFACE)
            else:
                target = get('device-mount-paths')[0]
            self.helper.RemountRW(dev)
        Backend.install(self, source, target, persist, device=dev,
                        allow_system_internal=allow_system_internal)
Beispiel #4
0
    def install(self, source, target, allow_system_internal=False):
        # TODO evand 2009-07-31: Lock source and target.
        logging.debug('install source: %s' % source)
        logging.debug('install target: %s' % target)

        # There's no going back now...
        for handle in self.handles:
            self.manager.disconnect(handle)

        dev = self.targets[target]['device']
        self.helper.Unmount(target)

        Backend.install(self, source, target, device=dev,
                        allow_system_internal=allow_system_internal)
Beispiel #5
0
 def __init__(self, allow_system_internal=False, bus=None, show_all=False):
     Backend.__init__(self)
     self.mounted_source = ''
     self.formatting = []
     self.show_all = show_all
     self.allow_system_internal = allow_system_internal
     logging.debug('UDisksBackend')
     DBusGMainLoop(set_as_default=True)
     if bus:
         self.bus = bus
     else:
         self.bus = dbus.SystemBus()
     udisks_obj = self.bus.get_object(DISKS_IFACE,
                                      '/org/freedesktop/UDisks')
     self.udisks = dbus.Interface(udisks_obj, DISKS_IFACE)
     self.helper = self.bus.get_object('com.ubuntu.USBCreator',
                                       '/com/ubuntu/USBCreator')
     self.helper = dbus.Interface(self.helper, 'com.ubuntu.USBCreator')
 def __init__(self, allow_system_internal=False, bus=None, show_all=False):
     Backend.__init__(self)
     self.mounted_source = ''
     self.formatting = []
     self.show_all = show_all
     self.allow_system_internal = allow_system_internal
     logging.debug('UDisksBackend')
     DBusGMainLoop(set_as_default=True)
     if bus:
         self.bus = bus
     else:
         self.bus = dbus.SystemBus()
     udisks_obj = self.bus.get_object(DISKS_IFACE,
                                      '/org/freedesktop/UDisks')
     self.udisks = dbus.Interface(udisks_obj, DISKS_IFACE)
     self.helper = self.bus.get_object('com.ubuntu.USBCreator',
                                       '/com/ubuntu/USBCreator')
     self.helper = dbus.Interface(self.helper, 'com.ubuntu.USBCreator')
Beispiel #7
0
    def __init__(self, allow_system_internal=False, bus=None):
        Backend.__init__(self)
        self.handles = []
        self.allow_system_internal = allow_system_internal
        logging.debug('UDisks2Backend')
        DBusGMainLoop(set_as_default=True)
        threads_init()
        if bus:
            self.bus = bus
        else:
            self.bus = dbus.SystemBus()

        self.udisks = UDisks.Client.new_sync(None)

        self.helper = self.bus.get_object('com.ubuntu.USBCreator',
                                          '/com/ubuntu/USBCreator')
        self.helper = dbus.Interface(self.helper, 'com.ubuntu.USBCreator')
        self.helper.connect_to_signal('Progress', self.got_progress)
        self.no_options = GLib.Variant('a{sv}', {})
Beispiel #8
0
    def __init__(self, allow_system_internal=False, bus=None, show_all=False):
        Backend.__init__(self)
        self.mounted_source = ''
        self.formatting = []
        self.handles = []
        self.show_all = show_all
        self.allow_system_internal = allow_system_internal
        logging.debug('UDisks2Backend')
        DBusGMainLoop(set_as_default=True)
        threads_init()
        if bus:
            self.bus = bus
        else:
            self.bus = dbus.SystemBus()

        self.udisks = UDisks.Client.new_sync(None)

        self.helper = self.bus.get_object('com.ubuntu.USBCreator',
                                          '/com/ubuntu/USBCreator')
        self.helper = dbus.Interface(self.helper, 'com.ubuntu.USBCreator')
Beispiel #9
0
    def install(self, source, target, persist, allow_system_internal=False):
        # TODO evand 2009-07-31: Lock source and target.
        logging.debug('install source: %s' % source)
        logging.debug('install target: %s' % target)
        logging.debug('install persistence: %d' % persist)

        # There's no going back now...
        for handle in self.handles:
            self.manager.disconnect(handle)

        stype = self.sources[source]['type']
        if stype == misc.SOURCE_CD:
            source = self.sources[source]['mount']
        elif stype == misc.SOURCE_ISO:
            isofile = self.sources[source]['device']
            source = self.helper.MountISO(isofile)
            self.mounted_source = source

        dev = self.targets[target]['device']
        if stype == misc.SOURCE_IMG:
            target_path = None
            self.helper.Unmount(target)
        else:
            obj = self.udisks.get_object(target)
            fs = obj.get_filesystem()
            mount_points = fs.get_cached_property(
                'MountPoints').get_bytestring_array()
            if len(mount_points) == 0:
                target_path = fs.call_mount_sync(no_options, None)
            else:
                target_path = mount_points[0]
            self.helper.RemountRW(dev)
        Backend.install(self,
                        source,
                        target_path,
                        persist,
                        device=dev,
                        allow_system_internal=allow_system_internal)
Beispiel #10
0
 def cancel_install(self):
     Backend.cancel_install(self)
Beispiel #11
0
 def cancel_install(self):
     Backend.cancel_install(self)
     self.unmount()
Beispiel #12
0
 def __init__(self):
     Backend.__init__(self)
     logging.debug('FastbootBackend')
     self.client = GUdev.Client(subsystems=['usb'])
 def cancel_install(self):
     Backend.cancel_install(self)
     self.unmount()
 def __init__(self):
     Backend.__init__(self)