def run(self, device_name):
        retval = None
        device_path = payload_utils.get_device_path(device_name)

        # FIXME: Use a unique mount point.
        mounts = payload_utils.get_mount_paths(device_path)
        mountpoint = None
        # We have to check both ISO_DIR and the DRACUT_ISODIR because we
        # still reference both, even though /mnt/install is a symlink to
        # /run/install.  Finding mount points doesn't handle the symlink
        if constants.ISO_DIR not in mounts and constants.DRACUT_ISODIR not in mounts:
            # We're not mounted to either location, so do the mount
            mountpoint = constants.ISO_DIR
            payload_utils.mount_device(device_name, mountpoint)

        # If any directory was chosen, return that.  Otherwise, return None.
        rc = self.window.run()
        if rc == Gtk.ResponseType.OK:
            f = self._chooser.get_filename()
            if f:
                retval = f.replace(constants.ISO_DIR, "")

        if not mounts:
            payload_utils.unmount_device(device_name, mountpoint)

        self.window.destroy()
        return retval
Example #2
0
 def _mount_device(self):
     """ Mount the device so we can search it for ISOs. """
     mounts = payload_utils.get_mount_paths(self._device.path)
     # We have to check both ISO_DIR and the DRACUT_ISODIR because we
     # still reference both, even though /mnt/install is a symlink to
     # /run/install.  Finding mount points doesn't handle the symlink
     if ISO_DIR not in mounts and DRACUT_ISODIR not in mounts:
         # We're not mounted to either location, so do the mount
         payload_utils.mount_device(self._device, ISO_DIR)
Example #3
0
    def _setup_media(self, device):
        method = self.data.method
        if method.method == "harddrive":
            try:
                method.dir = self._find_and_mount_iso(device, ISO_DIR, method.dir, INSTALL_TREE)
            except PayloadSetupError as ex:
                log.warning(str(ex))

                try:
                    self._setup_install_tree(device, method.dir, INSTALL_TREE)
                except PayloadSetupError as ex:
                    log.error(str(ex))
                    raise PayloadSetupError("failed to setup installation tree or ISO from HDD")

        # Check to see if the device is already mounted, in which case
        # we don't need to mount it again
        elif method.method == "cdrom" and payload_utils.get_mount_paths(device.path):
            return
        else:
            payload_utils.mount_device(device, INSTALL_TREE)
Example #4
0
    def _setup_media(self, device):
        method = self.data.method
        if method.method == "harddrive":
            try:
                method.dir = self._find_and_mount_iso(device, ISO_DIR, method.dir, INSTALL_TREE)
            except PayloadSetupError as ex:
                log.warning(str(ex))

                try:
                    self._setup_install_tree(device, method.dir, INSTALL_TREE)
                except PayloadSetupError as ex:
                    log.error(str(ex))
                    raise PayloadSetupError("failed to setup installation tree or ISO from HDD")

        # Check to see if the device is already mounted, in which case
        # we don't need to mount it again
        elif method.method == "cdrom" and payload_utils.get_mount_paths(device.path):
            return
        else:
            device.format.setup(mountpoint=INSTALL_TREE)
Example #5
0
 def _device_is_mounted_as_source(self, device):
     device_mounts = payload_utils.get_mount_paths(device.path)
     return INSTALL_TREE in device_mounts or DRACUT_REPODIR in device_mounts