[PATCH 7/7] Add UI support for encrypted automatic partitioning.
David Lehman
dlehman at redhat.com
Thu Oct 4 14:59:21 UTC 2012
Activating the checkbutton effectively sets the default behavior
of applying encryption to all new block devices, even in the
custom spoke.
---
pyanaconda/ui/gui/spokes/custom.py | 5 +++++
pyanaconda/ui/gui/spokes/storage.glade | 30 +++++++++++++++++++++++++++++-
pyanaconda/ui/gui/spokes/storage.py | 17 +++++++++++++++++
3 files changed, 51 insertions(+), 1 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 5af61c2..ec60cad 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -1449,6 +1449,11 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
(mountpoint and mountpoint.startswith("/boot"))):
device_type = AUTOPART_TYPE_PLAIN
+ # some devices should never be encrypted
+ if ((mountpoint and mountpoint.startswith("/boot")) or
+ fstype in ("biosboot", "prepboot")):
+ encrypted = False
+
disks = self._clearpartDevices
self.clear_errors()
diff --git a/pyanaconda/ui/gui/spokes/storage.glade b/pyanaconda/ui/gui/spokes/storage.glade
index 981f6b4..ec24e65 100644
--- a/pyanaconda/ui/gui/spokes/storage.glade
+++ b/pyanaconda/ui/gui/spokes/storage.glade
@@ -710,7 +710,35 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="encryption_checkbutton">
+ <property name="label" translatable="yes">Encrypt my data. I'll set a passphrase later.</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 8295e99..52790da 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -44,6 +44,7 @@ from gi.repository import AnacondaWidgets
from pyanaconda.ui.gui import GUIObject, communication
from pyanaconda.ui.gui.spokes import NormalSpoke
from pyanaconda.ui.gui.spokes.lib.cart import SelectedDisksDialog
+from pyanaconda.ui.gui.spokes.lib.passphrase import PassphraseDialog
from pyanaconda.ui.gui.spokes.lib.detailederror import DetailedErrorDialog
from pyanaconda.ui.gui.categories.storage import StorageCategory
from pyanaconda.ui.gui.utils import enlightbox, gdk_threaded
@@ -405,6 +406,9 @@ class StorageSpoke(NormalSpoke, StorageChecker):
self.encrypted = self.data.autopart.encrypted
self.passphrase = self.data.autopart.passphrase
+ encrypt_checkbutton = self.builder.get_object("encryption_checkbutton")
+ encrypt_checkbutton.set_active(self.encrypted)
+
# update the selections in the ui
overviews = self.local_disks_box.get_children()
for overview in overviews:
@@ -580,8 +584,21 @@ class StorageSpoke(NormalSpoke, StorageChecker):
# depending on custom/autopart, either set up autopart or show
# custom partitioning ui
self.autopart = not dialog.custom
+
+ # even if they're not doing autopart, setting autopart.encrypted
+ # establishes a default of encrypting new devices
+ encrypt_button = self.builder.get_object("encryption_checkbutton")
+ self.encrypted = encrypt_button.get_active()
+
if dialog.custom:
self.skipTo = "CustomPartitioningSpoke"
+ elif self.encrypted:
+ dialog = PassphraseDialog(self.data)
+ rc = self.run_lightbox_dialog(dialog)
+ if rc == 0:
+ return
+
+ self.passphrase = dialog.passphrase
self.on_back_clicked(self.window)
elif rc == dialog.RESPONSE_CANCEL:
--
1.7.7.6
More information about the anaconda-patches
mailing list