Exemplo n.º 1
0
    def _check_required_passphrase(self):
        """Ask a user for a default passphrase if required."""
        if not is_passphrase_required(self._partitioning):
            return

        dialog = PassphraseDialog(self.data)

        with self.main_window.enlightbox(dialog.window):
            rc = dialog.run()

        if rc != 1:
            return

        set_required_passphrase(self._partitioning, dialog.passphrase)
Exemplo n.º 2
0
    def _check_encrypted(self):
        # even if they're not doing autopart, setting autopart.encrypted
        # establishes a default of encrypting new devices
        if not self.encrypted:
            return True

        dialog = PassphraseDialog(self.data)
        rc = self.run_lightbox_dialog(dialog)
        if rc != 1:
            return False

        self.passphrase = dialog.passphrase
        return True
Exemplo n.º 3
0
    def _setup_passphrase(self):
        dialog = PassphraseDialog(self.data)
        rc = self.run_lightbox_dialog(dialog)
        if rc != 1:
            return False

        self.passphrase = dialog.passphrase

        for device in self.storage.devices:
            if device.format.type == "luks" and not device.format.exists:
                if not device.format.hasKey:
                    device.format.passphrase = self.passphrase

        return True
Exemplo n.º 4
0
    def _check_encrypted(self):
        # even if they're not doing autopart, setting autopart.encrypted
        # establishes a default of encrypting new devices
        if not self.encrypted:
            return True

        dialog = PassphraseDialog(self.data)
        rc = self.run_lightbox_dialog(dialog)
        if rc != 1:
            return False

        self.passphrase = dialog.passphrase

        for device in self.storage.devices:
            if device.format.type == "luks" and not device.format.exists:
                if not device.format.hasKey:
                    device.format.passphrase = self.passphrase

        return True
Exemplo n.º 5
0
    def _skip_to_automatic_partitioning(self):
        """Skip to the automatic partitioning.

        The user has requested to create the partitioning automatically.
        Ask for missing information and set up the automatic partitioning,
        so it can be later applied in the execute method.
        """
        # Set up the encryption.
        self._partitioning_request.encrypted = self._encrypted_checkbox.get_active(
        )

        # Ask for a passphrase.
        if self._partitioning_request.encrypted:
            dialog = PassphraseDialog(self.data,
                                      self._partitioning_request.passphrase)

            rc = self.run_lightbox_dialog(dialog)
            if rc != 1:
                self._back_clicked = False
                return

            self._partitioning_request.passphrase = dialog.passphrase

        # Set up the disk selection and initialization.
        self.apply()

        # Use the automatic partitioning and reset it.
        self._partitioning = create_partitioning(PARTITIONING_METHOD_AUTOMATIC)

        self._partitioning.Request = \
            PartitioningRequest.to_structure(self._partitioning_request)

        # Reclaim space.
        disks = filter_disks_by_names(self._available_disks,
                                      self._selected_disks)
        rc = self._check_space_and_run_dialog(self._partitioning, disks)

        if rc == RESPONSE_RECLAIM:
            dialog = ResizeDialog(self.data, self.payload, self._partitioning,
                                  disks)
            dialog.refresh()
            rc = self.run_lightbox_dialog(dialog)

        # Plan the next action.
        if rc == RESPONSE_OK:
            # nothing special needed
            self._skip_to_spoke(None)
            return

        if rc == RESPONSE_CANCEL:
            # A cancel button was clicked on one of the dialogs.  Stay on this
            # spoke.  Generally, this is because the user wants to add more disks.
            self._back_clicked = False
            return

        if rc == RESPONSE_MODIFY_SW:
            # The "Fedora software selection" link was clicked on one of the
            # dialogs.  Send the user to the software spoke.
            self._skip_to_spoke("SoftwareSelectionSpoke")
            return

        if rc == RESPONSE_QUIT:
            # Not enough space, and the user can't do anything about it so
            # they chose to quit.
            raise SystemExit("user-selected exit")

        # I don't know how we'd get here, but might as well have a
        # catch-all.  Just stay on this spoke.
        self._back_clicked = False
        return