Merge lp:~xnox/ubiquity/crypto-done into lp:ubiquity

Proposed by Dimitri John Ledkov
Status: Merged
Approved by: Colin Watson
Approved revision: 5588
Merged at revision: 5581
Proposed branch: lp:~xnox/ubiquity/crypto-done
Merge into: lp:ubiquity
Diff against target: 1348 lines (+765/-188)
12 files modified
bin/ubiquity (+7/-0)
d-i/lists/any (+2/-0)
debian/changelog (+15/-1)
debian/ubiquity.templates (+61/-3)
doc/ubi-partman-page-ask-statemachine.dot (+36/-0)
gui/gtk/stepPartAsk.ui (+124/-9)
gui/gtk/stepPartAuto.ui (+1/-40)
gui/gtk/stepPartCrypto.ui (+245/-0)
tests/test_gtkui.py (+2/-2)
ubiquity/plugins/ubi-partman.py (+214/-100)
ubiquity/plugins/ubi-usersetup.py (+10/-33)
ubiquity/validation.py (+48/-0)
To merge this branch: bzr merge lp:~xnox/ubiquity/crypto-done
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+117664@code.launchpad.net

Description of the change

This branch adds support for automatic crypt recipe.

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

This merge proposal depends on:
https://code.launchpad.net/~dmitrij.ledkov/partman-crypto/finish.d/+merge/117657

The resulting installation:
- boots in KVM using the recovery option
- fails to boot 'normally' in KVM
- untested on bare metal

Revision history for this message
Colin Watson (cjwatson) wrote :

This basically looks good, thanks! I confess I haven't gone through all
the state machines in fine detail or anything, but just a few nits and
then I think you should go ahead and merge this so that we can iterate
quickly.

> +Type: Text

Lower-case "text" in all these "Type:" lines.

> + <span foreground="darkred">Warning:</span> If you lose this security key, all data will be lost. if you need to, write down your key and keep it in a safe place elsewhere.

Capital letter at the start of sentences ("If you need to, ..."). Same
in the .ui file.

> - self.assertLessEqual(alloc.width, 640)
> - self.assertLessEqual(alloc.height, 500)
> + self.assertLessEqual(alloc.width, 640, page.module.NAME)
> + self.assertLessEqual(alloc.height, 500, page.module.NAME)

page.module.NAME doesn't seem like a helpful message on test failure.
At least include the expected and observed values.

> + if self.current_page == self.page_crypto and \
> + not self.get_crypto_keys():

Use grouping with parentheses in preference to backslash-continuation
(similarly elsewhere). So:

  if (self.current_page == self.page_crypto and
      not self.get_crypto_keys()):

No doubt we're not entirely consistent about this in existing code, but
let's do this in new code.

> + '^partman-crypto/.*passphrase.*',

> + elif question == 'partman-crypto/weak_passphrase':
> + self.preseed_bool(question, True, seen=False)
> + return True
> +
> + elif question.startswith('partman-crypto/passphrase'):
> + if not self.ui.get_crypto_keys():
> + return False
> + self.preseed(question, self.ui.get_crypto_keys())
> + return True
> +

I'd like to see these two sections match to avoid later problems if the
set of questions asked changes, so I think your entries in the question
list should preferably be:

  '^partman-crypto/weak_passphrase$',
  '^partman-crypto/passphrase.*',

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

On 01/08/12 15:46, Colin Watson wrote:
> This basically looks good, thanks! I confess I haven't gone through all
> the state machines in fine detail or anything, but just a few nits and
> then I think you should go ahead and merge this so that we can iterate
> quickly.
>
>> +Type: Text
>
> Lower-case "text" in all these "Type:" lines.
>

ok.

>> + <span foreground="darkred">Warning:</span> If you lose this security key, all data will be lost. if you need to, write down your key and keep it in a safe place elsewhere.
>
> Capital letter at the start of sentences ("If you need to, ..."). Same
> in the .ui file.
>

ok.

>> - self.assertLessEqual(alloc.width, 640)
>> - self.assertLessEqual(alloc.height, 500)
>> + self.assertLessEqual(alloc.width, 640, page.module.NAME)
>> + self.assertLessEqual(alloc.height, 500, page.module.NAME)
>
> page.module.NAME doesn't seem like a helpful message on test failure.
> At least include the expected and observed values.
>

It already does, by default. So it now looks like this:

======================================================================
FAIL: test_pages_fit_on_a_netbook (test_gtkui.TestFrontend)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tdlk/canonical/installer/crypto/tests/test_gtkui.py", line
79, in test_pages_fit_on_a_netbook
    self.assertLessEqual(alloc.height, 500, page.module.NAME)
AssertionError: 593 not less than or equal to 500 : language

----------------------------------------------------------------------

Which appears to be a peculiar fill packing bug which is visible when
manually starting ubiquity with a custom build, but not visible in
during the welcome screen. Will look into this more later.

>> + if self.current_page == self.page_crypto and \
>> + not self.get_crypto_keys():
>
> Use grouping with parentheses in preference to backslash-continuation
> (similarly elsewhere). So:
>
> if (self.current_page == self.page_crypto and
> not self.get_crypto_keys()):
>
> No doubt we're not entirely consistent about this in existing code, but
> let's do this in new code.
>

ok.

>> + '^partman-crypto/.*passphrase.*',
>
>> + elif question == 'partman-crypto/weak_passphrase':
>> + self.preseed_bool(question, True, seen=False)
>> + return True
>> +
>> + elif question.startswith('partman-crypto/passphrase'):
>> + if not self.ui.get_crypto_keys():
>> + return False
>> + self.preseed(question, self.ui.get_crypto_keys())
>> + return True
>> +
>
> I'd like to see these two sections match to avoid later problems if the
> set of questions asked changes, so I think your entries in the question
> list should preferably be:
>
> '^partman-crypto/weak_passphrase$',
> '^partman-crypto/passphrase.*',
>

ok.

--
Regards,
Dmitrijs.

lp:~xnox/ubiquity/crypto-done updated
5588. By Dimitri John Ledkov

Review comments

Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/ubiquity'
--- bin/ubiquity 2012-07-16 14:29:13 +0000
+++ bin/ubiquity 2012-08-01 15:23:23 +0000
@@ -495,6 +495,10 @@
495 parser.add_option('--enable-partauto-lvm', dest='partauto_lvm',495 parser.add_option('--enable-partauto-lvm', dest='partauto_lvm',
496 action='store_true',496 action='store_true',
497 help='Enable LVM in the automatic partitioner.')497 help='Enable LVM in the automatic partitioner.')
498 parser.add_option('--enable-partauto-crypto', dest='partauto_crypto',
499 action='store_true',
500 help='Enable Full Disk encryption in the automatic'
501 'partitioner.')
498 parser.add_option('--no-webcam', dest='webcam',502 parser.add_option('--no-webcam', dest='webcam',
499 default=True, action='store_false',503 default=True, action='store_false',
500 help='Disable the webcam page.')504 help='Disable the webcam page.')
@@ -537,6 +541,9 @@
537 if options.partauto_lvm:541 if options.partauto_lvm:
538 os.environ['UBIQUITY_PARTAUTO_LVM'] = '1'542 os.environ['UBIQUITY_PARTAUTO_LVM'] = '1'
539543
544 if options.partauto_crypto:
545 os.environ['UBIQUITY_PARTAUTO_CRYPTO'] = '1'
546
540 if not options.webcam:547 if not options.webcam:
541 os.environ['UBIQUITY_NO_WEBCAM'] = '1'548 os.environ['UBIQUITY_NO_WEBCAM'] = '1'
542549
543550
=== modified file 'd-i/lists/any'
--- d-i/lists/any 2012-07-10 00:16:28 +0000
+++ d-i/lists/any 2012-08-01 15:23:23 +0000
@@ -10,12 +10,14 @@
10netcfg10netcfg
11partconf11partconf
12partman-auto12partman-auto
13partman-auto-crypto
13partman-auto-loop14partman-auto-loop
14partman-auto-lvm15partman-auto-lvm
15partman-base16partman-base
16partman-basicfilesystems17partman-basicfilesystems
17partman-basicmethods18partman-basicmethods
18partman-btrfs19partman-btrfs
20partman-crypto
19partman-ext321partman-ext3
20partman-jfs22partman-jfs
21partman-lvm23partman-lvm
2224
=== modified file 'debian/changelog'
--- debian/changelog 2012-07-31 12:29:30 +0000
+++ debian/changelog 2012-08-01 15:23:23 +0000
@@ -1,9 +1,23 @@
1ubiquity (2.11.19) UNRELEASED; urgency=low1ubiquity (2.11.19) UNRELEASED; urgency=low
22
3 [ Colin Watson ]
3 * Simplify DebconfFilter.process_line slightly.4 * Simplify DebconfFilter.process_line slightly.
4 * Simplify KeyboardNames._load_file using collections.defaultdict.5 * Simplify KeyboardNames._load_file using collections.defaultdict.
56
6 -- Colin Watson <cjwatson@ubuntu.com> Tue, 31 Jul 2012 13:26:31 +01007 [ Dmitrijs Ledkovs ]
8 * Make the UI layout test print the failed page/step name.
9 * Add crypt security key setup page and move crypt/lvm checkboxes to the
10 ask page.
11 * Refactor password validation from ubi-usersetup into a reusable
12 component (for ubi-partman).
13 * Refactor set_autopartition_options method in ubi-partman.py.
14 * Add crypto option to ubi-partman.
15 * Add command line flag to enable crypt checkbox on the ask page.
16 * Add partman-crypto to the dependencies.
17 * Add translation strings for crypto.
18 * Add graphviz diagram of available ask page options.
19
20 -- Dmitrijs Ledkovs <dmitrij.ledkov@ubuntu.com> Wed, 01 Aug 2012 15:02:14 +0100
721
8ubiquity (2.11.18) quantal; urgency=low22ubiquity (2.11.18) quantal; urgency=low
923
1024
=== modified file 'debian/ubiquity.templates'
--- debian/ubiquity.templates 2012-07-16 10:10:04 +0000
+++ debian/ubiquity.templates 2012-08-01 15:23:23 +0000
@@ -1368,6 +1368,64 @@
1368 This computer currently has no detected operating systems. What would you1368 This computer currently has no detected operating systems. What would you
1369 like to do?1369 like to do?
13701370
1371Template: ubiquity/text/part_auto_use_lvm_checkbox1371Template: ubiquity/text/use_crypto_title
1372Type: text1372Type: text
1373_Description: Set up LVM1373_Description:
1374 Encrypt the new Ubuntu installation for security
1375
1376Template: ubiquity/text/use_crypto_desc
1377Type: text
1378_Description:
1379 You will choose a security key in the next step.
1380
1381Template: ubiquity/text/use_lvm_title
1382Type: text
1383_Description:
1384 Use LVM with the new Ubuntu installation
1385
1386Template: ubiquity/text/use_lvm_desc
1387Type: text
1388_Description:
1389 This will set up Logical Volume Management. It allows taking snapshots and easier partition resizing.
1390
1391Template: ubiquity/text/verified_crypto_label
1392Type: text
1393_Description:
1394 Confirm the security key:
1395
1396Template:ubiquity/text/crypto_label
1397Type: text
1398_Description:
1399 Choose a security key:
1400
1401Template:ubiquity/text/crypto_description
1402Type: text
1403_Description:
1404 Disk encryption protects your files in case you lose your computer. It requires you to enter a security key each time the computer starts up.
1405
1406Template:ubiquity/text/crypto_description_2
1407Type: text
1408_Description:
1409 Any files outside of Ubuntu will not be encrypted.
1410
1411Template:ubiquity/text/crypto_warning
1412Type: text
1413_Description:
1414 <span foreground="darkred">Warning:</span> If you lose this security key, all data will be lost. If you need to, write down your key and keep it in a safe place elsewhere.
1415
1416Template:ubiquity/text/crypto_exta_label
1417Type: text
1418_Description:
1419 For more security:
1420
1421Template:ubiquity/text/fill_with_random_data
1422Type: text
1423_Description:
1424 Overwrite empty disk space
1425
1426Template:ubiquity/text/crypto_extra_time
1427Type: text
1428_Description:
1429 The installation may take much longer.
1430
1431
13741432
=== added file 'doc/ubi-partman-page-ask-statemachine.dot'
--- doc/ubi-partman-page-ask-statemachine.dot 1970-01-01 00:00:00 +0000
+++ doc/ubi-partman-page-ask-statemachine.dot 2012-08-01 15:23:23 +0000
@@ -0,0 +1,36 @@
1digraph {
2 { rank = same;
3 use_device;
4 resize;
5 custom;
6 wubi;
7 reuse;
8 replace;
9 };
10 { rank = same;
11 switch_to_install;
12 go_to_manual;
13 go_to_wubi;
14 };
15 { node [shape = diamond];
16 biggest_free;
17 one_disk;
18 have_crypto;
19 };
20 use_device -> one_disk;
21 one_disk -> go_to_auto [label="no"];
22 one_disk -> have_crypto [label="yes"];
23 go_to_auto -> have_crypto [label="if use_device"];
24 have_crypto -> switch_to_install [label="no"];
25 have_crypto -> go_to_crypto [label="yes"];
26 go_to_crypto -> switch_to_install;
27 resize -> biggest_free;
28 biggest_free -> switch_to_install [label="yes"];
29 biggest_free -> go_to_auto [label="no"];
30 go_to_auto -> switch_to_install;
31 custom -> go_to_manual;
32 reuse -> switch_to_install;
33 replace -> switch_to_install;
34 wubi -> go_to_wubi;
35 go_to_crypto;
36};
037
=== modified file 'gui/gtk/stepPartAsk.ui'
--- gui/gtk/stepPartAsk.ui 2012-06-07 19:38:33 +0000
+++ gui/gtk/stepPartAsk.ui 2012-08-01 15:23:23 +0000
@@ -1,7 +1,6 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<interface>2<interface>
3 <requires lib="gtk+" version="2.24"/>3 <!-- interface-requires gtk+ 3.0 -->
4 <!-- interface-naming-policy project-wide -->
5 <!-- interface-local-resource-path /home/evan/bzr/ubiquity.partitioner-redesign/pixmaps/partitioner -->4 <!-- interface-local-resource-path /home/evan/bzr/ubiquity.partitioner-redesign/pixmaps/partitioner -->
6 <object class="GtkAlignment" id="stepPartAsk">5 <object class="GtkAlignment" id="stepPartAsk">
7 <property name="visible">True</property>6 <property name="visible">True</property>
@@ -39,6 +38,7 @@
39 <property name="spacing">12</property>38 <property name="spacing">12</property>
40 <child>39 <child>
41 <object class="GtkRadioButton" id="resize_use_free">40 <object class="GtkRadioButton" id="resize_use_free">
41 <property name="use_action_appearance">False</property>
42 <property name="visible">True</property>42 <property name="visible">True</property>
43 <property name="can_focus">True</property>43 <property name="can_focus">True</property>
44 <property name="receives_default">False</property>44 <property name="receives_default">False</property>
@@ -46,10 +46,10 @@
46 <property name="xalign">0</property>46 <property name="xalign">0</property>
47 <property name="active">True</property>47 <property name="active">True</property>
48 <property name="draw_indicator">True</property>48 <property name="draw_indicator">True</property>
49 <signal name="clicked" handler="part_ask_option_changed" swapped="no"/>
50 <accessibility>49 <accessibility>
51 <relation type="labelled-by" target="resize_use_free_title"/>50 <relation type="labelled-by" target="resize_use_free_title"/>
52 </accessibility>51 </accessibility>
52 <signal name="clicked" handler="part_ask_option_changed" swapped="no"/>
53 <child>53 <child>
54 <object class="GtkBox" id="hbox1">54 <object class="GtkBox" id="hbox1">
55 <property name="visible">True</property>55 <property name="visible">True</property>
@@ -122,6 +122,7 @@
122 </child>122 </child>
123 <child>123 <child>
124 <object class="GtkRadioButton" id="replace_partition">124 <object class="GtkRadioButton" id="replace_partition">
125 <property name="use_action_appearance">False</property>
125 <property name="visible">True</property>126 <property name="visible">True</property>
126 <property name="can_focus">True</property>127 <property name="can_focus">True</property>
127 <property name="receives_default">False</property>128 <property name="receives_default">False</property>
@@ -129,10 +130,10 @@
129 <property name="xalign">0</property>130 <property name="xalign">0</property>
130 <property name="draw_indicator">True</property>131 <property name="draw_indicator">True</property>
131 <property name="group">resize_use_free</property>132 <property name="group">resize_use_free</property>
132 <signal name="clicked" handler="part_ask_option_changed" swapped="no"/>
133 <accessibility>133 <accessibility>
134 <relation type="labelled-by" target="replace_partition_title"/>134 <relation type="labelled-by" target="replace_partition_title"/>
135 </accessibility>135 </accessibility>
136 <signal name="clicked" handler="part_ask_option_changed" swapped="no"/>
136 <child>137 <child>
137 <object class="GtkBox" id="hbox5">138 <object class="GtkBox" id="hbox5">
138 <property name="visible">True</property>139 <property name="visible">True</property>
@@ -205,16 +206,18 @@
205 </child>206 </child>
206 <child>207 <child>
207 <object class="GtkRadioButton" id="reuse_partition">208 <object class="GtkRadioButton" id="reuse_partition">
209 <property name="use_action_appearance">False</property>
208 <property name="visible">True</property>210 <property name="visible">True</property>
209 <property name="can_focus">True</property>211 <property name="can_focus">True</property>
210 <property name="receives_default">False</property>212 <property name="receives_default">False</property>
211 <property name="use_action_appearance">False</property>213 <property name="use_action_appearance">False</property>
214 <property name="xalign">0.5</property>
212 <property name="draw_indicator">True</property>215 <property name="draw_indicator">True</property>
213 <property name="group">resize_use_free</property>216 <property name="group">resize_use_free</property>
214 <signal name="clicked" handler="part_ask_option_changed" swapped="no"/>
215 <accessibility>217 <accessibility>
216 <relation type="labelled-by" target="reuse_partition_title"/>218 <relation type="labelled-by" target="reuse_partition_title"/>
217 </accessibility>219 </accessibility>
220 <signal name="clicked" handler="part_ask_option_changed" swapped="no"/>
218 <child>221 <child>
219 <object class="GtkBox" id="hbox2">222 <object class="GtkBox" id="hbox2">
220 <property name="visible">True</property>223 <property name="visible">True</property>
@@ -287,6 +290,7 @@
287 </child>290 </child>
288 <child>291 <child>
289 <object class="GtkRadioButton" id="use_device">292 <object class="GtkRadioButton" id="use_device">
293 <property name="use_action_appearance">False</property>
290 <property name="visible">True</property>294 <property name="visible">True</property>
291 <property name="can_focus">True</property>295 <property name="can_focus">True</property>
292 <property name="receives_default">False</property>296 <property name="receives_default">False</property>
@@ -294,10 +298,10 @@
294 <property name="xalign">0</property>298 <property name="xalign">0</property>
295 <property name="draw_indicator">True</property>299 <property name="draw_indicator">True</property>
296 <property name="group">resize_use_free</property>300 <property name="group">resize_use_free</property>
297 <signal name="clicked" handler="part_ask_option_changed" swapped="no"/>
298 <accessibility>301 <accessibility>
299 <relation type="labelled-by" target="use_device_title"/>302 <relation type="labelled-by" target="use_device_title"/>
300 </accessibility>303 </accessibility>
304 <signal name="clicked" handler="part_ask_option_changed" swapped="no"/>
301 <child>305 <child>
302 <object class="GtkBox" id="hbox3">306 <object class="GtkBox" id="hbox3">
303 <property name="visible">True</property>307 <property name="visible">True</property>
@@ -369,6 +373,116 @@
369 </packing>373 </packing>
370 </child>374 </child>
371 <child>375 <child>
376 <object class="GtkCheckButton" id="use_crypto">
377 <property name="use_action_appearance">False</property>
378 <property name="visible">True</property>
379 <property name="can_focus">True</property>
380 <property name="receives_default">False</property>
381 <property name="use_action_appearance">False</property>
382 <property name="xalign">0</property>
383 <property name="draw_indicator">True</property>
384 <child>
385 <object class="GtkBox" id="vbox7">
386 <property name="visible">True</property>
387 <property name="can_focus">False</property>
388 <property name="orientation">vertical</property>
389 <property name="spacing">3</property>
390 <child>
391 <object class="GtkLabel" id="use_crypto_title">
392 <property name="visible">True</property>
393 <property name="can_focus">False</property>
394 <property name="xalign">0</property>
395 <property name="yalign">0</property>
396 <property name="label" translatable="yes">Encrypt the new Ubuntu installation for security</property>
397 <property name="wrap">True</property>
398 </object>
399 <packing>
400 <property name="expand">False</property>
401 <property name="fill">True</property>
402 <property name="position">0</property>
403 </packing>
404 </child>
405 <child>
406 <object class="GtkLabel" id="use_crypto_desc">
407 <property name="visible">True</property>
408 <property name="can_focus">False</property>
409 <property name="xalign">0</property>
410 <property name="yalign">0</property>
411 <property name="label" translatable="yes">&lt;span weight="light" size="small"&gt;You’ll choose a security key in the next step.&lt;/span&gt;</property>
412 <property name="use_markup">True</property>
413 <property name="wrap">True</property>
414 </object>
415 <packing>
416 <property name="expand">False</property>
417 <property name="fill">True</property>
418 <property name="position">1</property>
419 </packing>
420 </child>
421 </object>
422 </child>
423 </object>
424 <packing>
425 <property name="expand">False</property>
426 <property name="fill">True</property>
427 <property name="position">4</property>
428 </packing>
429 </child>
430 <child>
431 <object class="GtkCheckButton" id="use_lvm">
432 <property name="use_action_appearance">False</property>
433 <property name="visible">True</property>
434 <property name="can_focus">True</property>
435 <property name="receives_default">False</property>
436 <property name="use_action_appearance">False</property>
437 <property name="xalign">0</property>
438 <property name="draw_indicator">True</property>
439 <child>
440 <object class="GtkBox" id="vbox8">
441 <property name="visible">True</property>
442 <property name="can_focus">False</property>
443 <property name="orientation">vertical</property>
444 <property name="spacing">3</property>
445 <child>
446 <object class="GtkLabel" id="use_lvm_title">
447 <property name="visible">True</property>
448 <property name="can_focus">False</property>
449 <property name="xalign">0</property>
450 <property name="yalign">0</property>
451 <property name="label" translatable="yes">Use LVM with the new Ubuntu installation</property>
452 <property name="wrap">True</property>
453 </object>
454 <packing>
455 <property name="expand">False</property>
456 <property name="fill">True</property>
457 <property name="position">0</property>
458 </packing>
459 </child>
460 <child>
461 <object class="GtkLabel" id="use_lvm_desc">
462 <property name="visible">True</property>
463 <property name="can_focus">False</property>
464 <property name="xalign">0</property>
465 <property name="yalign">0</property>
466 <property name="label" translatable="yes">&lt;span weight="light" size="small"&gt;This will set up Logical Volume Management. It allows taking snapshots and easier partition resizing.&lt;/span&gt;</property>
467 <property name="use_markup">True</property>
468 <property name="wrap">True</property>
469 </object>
470 <packing>
471 <property name="expand">False</property>
472 <property name="fill">True</property>
473 <property name="position">1</property>
474 </packing>
475 </child>
476 </object>
477 </child>
478 </object>
479 <packing>
480 <property name="expand">False</property>
481 <property name="fill">True</property>
482 <property name="position">5</property>
483 </packing>
484 </child>
485 <child>
372 <object class="GtkAlignment" id="alignment1">486 <object class="GtkAlignment" id="alignment1">
373 <property name="visible">True</property>487 <property name="visible">True</property>
374 <property name="can_focus">False</property>488 <property name="can_focus">False</property>
@@ -384,11 +498,12 @@
384 <packing>498 <packing>
385 <property name="expand">False</property>499 <property name="expand">False</property>
386 <property name="fill">True</property>500 <property name="fill">True</property>
387 <property name="position">4</property>501 <property name="position">6</property>
388 </packing>502 </packing>
389 </child>503 </child>
390 <child>504 <child>
391 <object class="GtkRadioButton" id="custom_partitioning">505 <object class="GtkRadioButton" id="custom_partitioning">
506 <property name="use_action_appearance">False</property>
392 <property name="visible">True</property>507 <property name="visible">True</property>
393 <property name="can_focus">True</property>508 <property name="can_focus">True</property>
394 <property name="receives_default">False</property>509 <property name="receives_default">False</property>
@@ -396,10 +511,10 @@
396 <property name="xalign">0</property>511 <property name="xalign">0</property>
397 <property name="draw_indicator">True</property>512 <property name="draw_indicator">True</property>
398 <property name="group">resize_use_free</property>513 <property name="group">resize_use_free</property>
399 <signal name="clicked" handler="part_ask_option_changed" swapped="no"/>
400 <accessibility>514 <accessibility>
401 <relation type="labelled-by" target="custom_partitioning_title"/>515 <relation type="labelled-by" target="custom_partitioning_title"/>
402 </accessibility>516 </accessibility>
517 <signal name="clicked" handler="part_ask_option_changed" swapped="no"/>
403 <child>518 <child>
404 <object class="GtkBox" id="hbox4">519 <object class="GtkBox" id="hbox4">
405 <property name="visible">True</property>520 <property name="visible">True</property>
@@ -467,7 +582,7 @@
467 <packing>582 <packing>
468 <property name="expand">False</property>583 <property name="expand">False</property>
469 <property name="fill">True</property>584 <property name="fill">True</property>
470 <property name="position">5</property>585 <property name="position">7</property>
471 </packing>586 </packing>
472 </child>587 </child>
473 </object>588 </object>
474589
=== modified file 'gui/gtk/stepPartAuto.ui'
--- gui/gtk/stepPartAuto.ui 2012-07-16 10:10:04 +0000
+++ gui/gtk/stepPartAuto.ui 2012-08-01 15:23:23 +0000
@@ -1,8 +1,6 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<interface>2<interface>
3 <requires lib="gtk+" version="2.24"/>3 <!-- interface-requires gtk+ 3.0 -->
4 <!-- interface-requires gtkwidgets 0.0 -->
5 <!-- interface-naming-policy toplevel-contextual -->
6 <object class="GtkListStore" id="liststore1">4 <object class="GtkListStore" id="liststore1">
7 <columns>5 <columns>
8 <!-- column-name gchararray1 -->6 <!-- column-name gchararray1 -->
@@ -156,43 +154,6 @@
156 <property name="position">2</property>154 <property name="position">2</property>
157 </packing>155 </packing>
158 </child>156 </child>
159 <child>
160 <object class="GtkAlignment" id="alignment1">
161 <property name="visible">True</property>
162 <property name="can_focus">False</property>
163 <property name="top_padding">16</property>
164 <child>
165 <object class="GtkBox" id="vbox_part_auto_recipes">
166 <property name="visible">True</property>
167 <property name="can_focus">False</property>
168 <property name="orientation">vertical</property>
169 <child>
170 <object class="GtkCheckButton" id="part_auto_use_lvm_checkbox">
171 <property name="label" translatable="yes">Set up LVM</property>
172 <property name="use_action_appearance">False</property>
173 <property name="visible">True</property>
174 <property name="can_focus">True</property>
175 <property name="receives_default">False</property>
176 <property name="use_action_appearance">False</property>
177 <property name="xalign">0</property>
178 <property name="image_position">top</property>
179 <property name="draw_indicator">True</property>
180 </object>
181 <packing>
182 <property name="expand">False</property>
183 <property name="fill">True</property>
184 <property name="position">0</property>
185 </packing>
186 </child>
187 </object>
188 </child>
189 </object>
190 <packing>
191 <property name="expand">False</property>
192 <property name="fill">True</property>
193 <property name="position">3</property>
194 </packing>
195 </child>
196 </object>157 </object>
197 <packing>158 <packing>
198 <property name="expand">False</property>159 <property name="expand">False</property>
199160
=== added file 'gui/gtk/stepPartCrypto.ui'
--- gui/gtk/stepPartCrypto.ui 1970-01-01 00:00:00 +0000
+++ gui/gtk/stepPartCrypto.ui 2012-08-01 15:23:23 +0000
@@ -0,0 +1,245 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<interface>
3 <!-- interface-requires gtk+ 3.0 -->
4 <object class="GtkEventBox" id="stepPartCrypto">
5 <property name="visible">True</property>
6 <property name="can_focus">False</property>
7 <child>
8 <object class="GtkGrid" id="userinfo_table">
9 <property name="visible">True</property>
10 <property name="can_focus">False</property>
11 <property name="border_width">20</property>
12 <property name="row_spacing">6</property>
13 <property name="column_spacing">6</property>
14 <child>
15 <object class="GtkLabel" id="verified_crypto_label">
16 <property name="visible">True</property>
17 <property name="can_focus">False</property>
18 <property name="halign">end</property>
19 <property name="xalign">0</property>
20 <property name="label" translatable="yes">Confirm the security key:</property>
21 <property name="justify">right</property>
22 <property name="single_line_mode">True</property>
23 </object>
24 <packing>
25 <property name="left_attach">0</property>
26 <property name="top_attach">3</property>
27 <property name="width">1</property>
28 <property name="height">1</property>
29 </packing>
30 </child>
31 <child>
32 <object class="GtkLabel" id="crypto_label">
33 <property name="visible">True</property>
34 <property name="can_focus">False</property>
35 <property name="halign">end</property>
36 <property name="xalign">0</property>
37 <property name="label" translatable="yes">Choose a security key:</property>
38 <property name="justify">right</property>
39 <property name="single_line_mode">True</property>
40 </object>
41 <packing>
42 <property name="left_attach">0</property>
43 <property name="top_attach">2</property>
44 <property name="width">1</property>
45 <property name="height">1</property>
46 </packing>
47 </child>
48 <child>
49 <object class="GtkLabel" id="crypto_description">
50 <property name="visible">True</property>
51 <property name="can_focus">False</property>
52 <property name="halign">start</property>
53 <property name="xalign">0</property>
54 <property name="label" translatable="yes">Disk encryption protects your files in case you lose your computer. It requires you to enter a security key each time the computer starts up.</property>
55 <property name="wrap">True</property>
56 </object>
57 <packing>
58 <property name="left_attach">0</property>
59 <property name="top_attach">0</property>
60 <property name="width">4</property>
61 <property name="height">1</property>
62 </packing>
63 </child>
64 <child>
65 <object class="GtkLabel" id="crypto_warning">
66 <property name="visible">True</property>
67 <property name="can_focus">False</property>
68 <property name="halign">start</property>
69 <property name="xalign">0</property>
70 <property name="label" translatable="yes">&lt;span foreground="darkred"&gt;Warning:&lt;/span&gt; If you lose this security key, all data will be lost. If you need to, write down your key and keep it in a safe place elsewhere.</property>
71 <property name="use_markup">True</property>
72 <property name="wrap">True</property>
73 </object>
74 <packing>
75 <property name="left_attach">0</property>
76 <property name="top_attach">4</property>
77 <property name="width">4</property>
78 <property name="height">1</property>
79 </packing>
80 </child>
81 <child>
82 <object class="GtkLabel" id="crypto_exta_label">
83 <property name="visible">True</property>
84 <property name="can_focus">False</property>
85 <property name="halign">end</property>
86 <property name="xalign">0</property>
87 <property name="label" translatable="yes">For more security:</property>
88 <property name="justify">right</property>
89 </object>
90 <packing>
91 <property name="left_attach">0</property>
92 <property name="top_attach">5</property>
93 <property name="width">1</property>
94 <property name="height">1</property>
95 </packing>
96 </child>
97 <child>
98 <object class="GtkCheckButton" id="fill_with_random_data">
99 <property name="label" translatable="yes">Overwrite empty disk space</property>
100 <property name="use_action_appearance">False</property>
101 <property name="visible">True</property>
102 <property name="can_focus">True</property>
103 <property name="receives_default">False</property>
104 <property name="halign">start</property>
105 <property name="use_action_appearance">False</property>
106 <property name="xalign">0</property>
107 <property name="draw_indicator">True</property>
108 </object>
109 <packing>
110 <property name="left_attach">1</property>
111 <property name="top_attach">5</property>
112 <property name="width">3</property>
113 <property name="height">1</property>
114 </packing>
115 </child>
116 <child>
117 <object class="GtkLabel" id="password_strength">
118 <property name="can_focus">False</property>
119 <property name="halign">start</property>
120 <property name="xalign">0</property>
121 <property name="label" translatable="yes">&lt;small&gt;&lt;span color="darkgreen"&gt;Strong password&lt;/span&gt;&lt;/small&gt;</property>
122 <property name="use_markup">True</property>
123 <property name="single_line_mode">True</property>
124 </object>
125 <packing>
126 <property name="left_attach">2</property>
127 <property name="top_attach">2</property>
128 <property name="width">2</property>
129 <property name="height">1</property>
130 </packing>
131 </child>
132 <child>
133 <object class="GtkEntry" id="auto_password">
134 <property name="visible">True</property>
135 <property name="can_focus">True</property>
136 <property name="has_focus">True</property>
137 <property name="visibility">False</property>
138 <property name="invisible_char">●</property>
139 <property name="activates_default">True</property>
140 <property name="width_chars">20</property>
141 <property name="invisible_char_set">True</property>
142 <accessibility>
143 <relation type="labelled-by" target="crypto_label"/>
144 </accessibility>
145 <signal name="changed" handler="info_loop" swapped="no"/>
146 </object>
147 <packing>
148 <property name="left_attach">1</property>
149 <property name="top_attach">2</property>
150 <property name="width">1</property>
151 <property name="height">1</property>
152 </packing>
153 </child>
154 <child>
155 <object class="GtkEntry" id="auto_verified_password">
156 <property name="visible">True</property>
157 <property name="can_focus">True</property>
158 <property name="visibility">False</property>
159 <property name="invisible_char">●</property>
160 <property name="activates_default">True</property>
161 <property name="width_chars">20</property>
162 <property name="invisible_char_set">True</property>
163 <accessibility>
164 <relation type="labelled-by" target="verified_crypto_label"/>
165 </accessibility>
166 <signal name="changed" handler="info_loop" swapped="no"/>
167 </object>
168 <packing>
169 <property name="left_attach">1</property>
170 <property name="top_attach">3</property>
171 <property name="width">1</property>
172 <property name="height">1</property>
173 </packing>
174 </child>
175 <child>
176 <object class="GtkLabel" id="crypto_extra_time">
177 <property name="visible">True</property>
178 <property name="can_focus">False</property>
179 <property name="halign">start</property>
180 <property name="margin_left">24</property>
181 <property name="xalign">0</property>
182 <property name="label" translatable="yes">&lt;span weight="light" size="small"&gt;The installation may take much longer.&lt;/span&gt;</property>
183 <property name="use_markup">True</property>
184 <property name="single_line_mode">True</property>
185 </object>
186 <packing>
187 <property name="left_attach">1</property>
188 <property name="top_attach">6</property>
189 <property name="width">3</property>
190 <property name="height">1</property>
191 </packing>
192 </child>
193 <child>
194 <object class="GtkLabel" id="crypto_description_2">
195 <property name="visible">True</property>
196 <property name="can_focus">False</property>
197 <property name="halign">start</property>
198 <property name="xalign">0</property>
199 <property name="label" translatable="yes">Any files outside of Ubuntu will not be encrypted.</property>
200 <property name="wrap">True</property>
201 </object>
202 <packing>
203 <property name="left_attach">0</property>
204 <property name="top_attach">1</property>
205 <property name="width">4</property>
206 <property name="height">1</property>
207 </packing>
208 </child>
209 <child>
210 <object class="GtkImage" id="password_ok">
211 <property name="can_focus">False</property>
212 <property name="halign">start</property>
213 <property name="xalign">0</property>
214 <property name="stock">gtk-yes</property>
215 </object>
216 <packing>
217 <property name="left_attach">2</property>
218 <property name="top_attach">3</property>
219 <property name="width">1</property>
220 <property name="height">1</property>
221 </packing>
222 </child>
223 <child>
224 <object class="GtkLabel" id="password_error_label">
225 <property name="can_focus">False</property>
226 <property name="halign">start</property>
227 <property name="xalign">0</property>
228 <property name="label" translatable="yes">&lt;small&gt;&lt;span color="darkred"&gt;Passwords do not match&lt;/span&gt;&lt;/small&gt;</property>
229 <property name="use_markup">True</property>
230 <property name="single_line_mode">True</property>
231 </object>
232 <packing>
233 <property name="left_attach">3</property>
234 <property name="top_attach">3</property>
235 <property name="width">1</property>
236 <property name="height">1</property>
237 </packing>
238 </child>
239 <child>
240 <placeholder/>
241 </child>
242 </object>
243 </child>
244 </object>
245</interface>
0246
=== modified file 'tests/test_gtkui.py'
--- tests/test_gtkui.py 2012-07-16 14:29:13 +0000
+++ tests/test_gtkui.py 2012-08-01 15:23:23 +0000
@@ -75,8 +75,8 @@
75 import time75 import time
76 time.sleep(3)76 time.sleep(3)
77 alloc = ui.live_installer.get_allocation()77 alloc = ui.live_installer.get_allocation()
78 self.assertLessEqual(alloc.width, 640)78 self.assertLessEqual(alloc.width, 640, page.module.NAME)
79 self.assertLessEqual(alloc.height, 500)79 self.assertLessEqual(alloc.height, 500, page.module.NAME)
80 if page.module.NAME == 'partman':80 if page.module.NAME == 'partman':
81 ui.allow_change_step(False)81 ui.allow_change_step(False)
8282
8383
=== modified file 'ubiquity/plugins/ubi-partman.py'
--- ubiquity/plugins/ubi-partman.py 2012-07-19 09:49:20 +0000
+++ ubiquity/plugins/ubi-partman.py 2012-08-01 15:23:23 +0000
@@ -29,6 +29,7 @@
29from ubiquity import parted_server29from ubiquity import parted_server
30from ubiquity import misc30from ubiquity import misc
31from ubiquity import osextras31from ubiquity import osextras
32from ubiquity import validation
32from ubiquity.install_misc import archdetect33from ubiquity.install_misc import archdetect
3334
34NAME = 'partman'35NAME = 'partman'
@@ -98,6 +99,9 @@
98 def get_grub_choice(self):99 def get_grub_choice(self):
99 return misc.grub_default()100 return misc.grub_default()
100101
102 def get_crypto_keys(self):
103 pass
104
101105
102class PageGtk(PageBase):106class PageGtk(PageBase):
103 plugin_title = 'ubiquity/text/part_auto_heading_label'107 plugin_title = 'ubiquity/text/part_auto_heading_label'
@@ -114,11 +118,14 @@
114 os.environ['UBIQUITY_GLADE'], 'stepPartAuto.ui'))118 os.environ['UBIQUITY_GLADE'], 'stepPartAuto.ui'))
115 builder.add_from_file(os.path.join(119 builder.add_from_file(os.path.join(
116 os.environ['UBIQUITY_GLADE'], 'stepPartAdvanced.ui'))120 os.environ['UBIQUITY_GLADE'], 'stepPartAdvanced.ui'))
121 builder.add_from_file(os.path.join(
122 os.environ['UBIQUITY_GLADE'], 'stepPartCrypto.ui'))
117 builder.connect_signals(self)123 builder.connect_signals(self)
118124
119 self.page_ask = builder.get_object('stepPartAsk')125 self.page_ask = builder.get_object('stepPartAsk')
120 self.page_auto = builder.get_object('stepPartAuto')126 self.page_auto = builder.get_object('stepPartAuto')
121 self.page_advanced = builder.get_object('stepPartAdvanced')127 self.page_advanced = builder.get_object('stepPartAdvanced')
128 self.page_crypto = builder.get_object('stepPartCrypto')
122129
123 # Grub options130 # Grub options
124 self.bootloader_vbox = builder.get_object('bootloader_vbox')131 self.bootloader_vbox = builder.get_object('bootloader_vbox')
@@ -139,10 +146,8 @@
139 self.part_auto_hidden_label = builder.get_object(146 self.part_auto_hidden_label = builder.get_object(
140 'part_auto_hidden_label')147 'part_auto_hidden_label')
141 self.part_advanced_vbox = builder.get_object('part_advanced_vbox')148 self.part_advanced_vbox = builder.get_object('part_advanced_vbox')
142 self.vbox_part_auto_recipes = builder.get_object(149 self.use_lvm = builder.get_object('use_lvm')
143 'vbox_part_auto_recipes')150 self.use_crypto = builder.get_object('use_crypto')
144 self.part_auto_use_lvm_checkbox = builder.get_object(
145 'part_auto_use_lvm_checkbox')
146151
147 # Ask page152 # Ask page
148 self.part_ask_heading = builder.get_object('part_ask_heading')153 self.part_ask_heading = builder.get_object('part_ask_heading')
@@ -163,6 +168,10 @@
163 'custom_partitioning_title')168 'custom_partitioning_title')
164 self.custom_partitioning_desc = builder.get_object(169 self.custom_partitioning_desc = builder.get_object(
165 'custom_partitioning_desc')170 'custom_partitioning_desc')
171 self.use_lvm_title = builder.get_object('use_lvm_title')
172 self.use_lvm_desc = builder.get_object('use_lvm_desc')
173 self.use_crypto_title = builder.get_object('use_crypto_title')
174 self.use_crypto_desc = builder.get_object('use_crypto_desc')
166175
167 # Advanced page176 # Advanced page
168 self.partition_create_mount_combo = builder.get_object(177 self.partition_create_mount_combo = builder.get_object(
@@ -219,6 +228,19 @@
219 self.part_advanced_recalculating_label = builder.get_object(228 self.part_advanced_recalculating_label = builder.get_object(
220 'part_advanced_recalculating_label')229 'part_advanced_recalculating_label')
221230
231 # Crypto page
232
233 self.auto_password = builder.get_object(
234 'auto_password')
235 self.password_error_label = builder.get_object(
236 'password_error_label')
237 self.auto_verified_password = builder.get_object(
238 'auto_verified_password')
239 self.password_strength = builder.get_object(
240 'password_strength')
241 self.password_ok = builder.get_object(
242 'password_ok')
243
222 self.partition_bars = {}244 self.partition_bars = {}
223 self.segmented_bar_vbox = None245 self.segmented_bar_vbox = None
224 self.resize_min_size = None246 self.resize_min_size = None
@@ -232,7 +254,8 @@
232 True)254 True)
233 self.partition_edit_mount_combo.get_child().set_activates_default(True)255 self.partition_edit_mount_combo.get_child().set_activates_default(True)
234256
235 self.plugin_optional_widgets = [self.page_auto, self.page_advanced]257 self.plugin_optional_widgets = [self.page_auto, self.page_advanced,
258 self.page_crypto]
236 self.current_page = self.page_ask259 self.current_page = self.page_ask
237260
238 # Set some parameters that do not change between runs of the plugin261 # Set some parameters that do not change between runs of the plugin
@@ -284,6 +307,10 @@
284 os.rmdir(mount_path)307 os.rmdir(mount_path)
285 self.controller._wizard.do_reboot()308 self.controller._wizard.do_reboot()
286309
310 def set_page_title(self, title):
311 self.controller._wizard.page_title.set_markup(
312 '<span size="xx-large">%s</span>' % title)
313
287 def plugin_on_next_clicked(self):314 def plugin_on_next_clicked(self):
288 reuse = self.reuse_partition.get_active()315 reuse = self.reuse_partition.get_active()
289 replace = self.replace_partition.get_active()316 replace = self.replace_partition.get_active()
@@ -291,29 +318,62 @@
291 custom = self.custom_partitioning.get_active()318 custom = self.custom_partitioning.get_active()
292 use_device = self.use_device.get_active()319 use_device = self.use_device.get_active()
293 biggest_free = 'biggest_free' in self.extra_options320 biggest_free = 'biggest_free' in self.extra_options
321 crypto = self.use_device.get_active()
322 one_disk = False
323
324 if custom:
325 self.set_page_title(self.custom_partitioning_title.get_text())
326 self.current_page = self.page_advanced
327 self.controller.go_to_page(self.current_page)
328 self.controller.toggle_next_button('install_button')
329 self.plugin_is_install = True
330 return False
331
332 # Setting the model early on, because if there is only one
333 # disk, we switch to install interface staight away and it
334 # queries the model to get the disk
335 m = self.part_auto_select_drive.get_model()
336 m.clear()
337 disks = self.extra_options['use_device'][1]
338 if len(disks) == 1:
339 one_disk = True
340 if use_device:
341 for disk in disks:
342 m.append([disk, ''])
343 self.part_auto_select_drive.set_active(0)
344
345 # Currently we support crypto only in use_disk
346 # TODO dmitrij.ledkov 2012-07-25 no way to go back and return
347 # to here? This needs to be addressed in the design document.
348 if crypto and use_device and self.current_page == self.page_ask:
349 self.set_page_title(
350 self.controller.get_string('ubiquity/text/crypto_label'))
351 self.current_page = self.page_crypto
352 self.controller.go_to_page(self.current_page)
353 self.controller.toggle_next_button('install_button')
354 self.plugin_is_install = True
355 self.info_loop(None)
356 return True
357
358 if (self.current_page == self.page_crypto and
359 not self.get_crypto_keys()):
360 self.controller.allow_go_forward(False)
361 return True
294362
295 # We already have all that we need from the user.363 # We already have all that we need from the user.
296 done_partitioning = (resize and biggest_free) or reuse or replace364 done_partitioning = \
365 (resize and biggest_free) or \
366 (use_device and one_disk) or \
367 reuse or replace
297368
298 if self.current_page == self.page_ask and not done_partitioning:369 if self.current_page == self.page_ask and not done_partitioning:
299 if custom:370 if resize:
300 title = self.custom_partitioning_title.get_text()371 self.set_page_title(self.resize_use_free_title.get_text())
301 elif resize:372 if 'wubi' in self.extra_options:
302 title = self.resize_use_free_title.get_text()373 self.configure_wubi_and_reboot()
303 elif use_device:374 return True
304 title = self.use_device_title.get_text()
305 self.controller._wizard.page_title.set_markup(
306 '<span size="xx-large">%s</span>' % title)
307
308 if resize and 'wubi' in self.extra_options:
309 self.configure_wubi_and_reboot()
310 return True
311 elif resize:
312 m = self.part_auto_select_drive.get_model()
313 m.clear()
314 extra_resize = self.extra_options['resize']375 extra_resize = self.extra_options['resize']
315 disk_ids = list(extra_resize.keys())376 disk_ids = list(extra_resize.keys())
316 disks = self.extra_options['use_device'][1]
317 # FIXME: perhaps it makes more sense to store the disk377 # FIXME: perhaps it makes more sense to store the disk
318 # description.378 # description.
319 for disk in disks:379 for disk in disks:
@@ -325,32 +385,21 @@
325 misc.format_size(part_size - min_size)])385 misc.format_size(part_size - min_size)])
326 self.part_auto_select_drive.set_active(0)386 self.part_auto_select_drive.set_active(0)
327 self.initialize_resize_mode()387 self.initialize_resize_mode()
328 elif use_device:388
329 m = self.part_auto_select_drive.get_model()389 if use_device:
330 m.clear()390 self.set_page_title(self.use_device_title.get_text())
331 for disk in self.extra_options['use_device'][1]:
332 m.append([disk, ''])
333 self.part_auto_select_drive.set_active(0)
334 self.initialize_use_disk_mode()391 self.initialize_use_disk_mode()
335392
336 if not custom:393 self.current_page = self.page_auto
337 self.current_page = self.page_auto394 self.controller.go_to_page(self.current_page)
338 self.controller.go_to_page(self.current_page)395 self.controller.toggle_next_button('install_button')
339 self.controller.toggle_next_button('install_button')396 self.plugin_is_install = True
340 self.plugin_is_install = True397 return True
341 return True398
342 else:399 # Return control to partman, which will call
343 self.current_page = self.page_advanced400 # get_autopartition_choice and start partitioninging the device.
344 self.controller.go_to_page(self.current_page)401 self.controller.switch_to_install_interface()
345 self.controller.toggle_next_button('install_button')402 return False
346 self.plugin_is_install = True
347 return False
348 else:
349 # Return control to partman, which will call
350 # get_autopartition_choice and start partitioninging the device.
351 if not custom:
352 self.controller.switch_to_install_interface()
353 return False
354403
355 def plugin_on_back_clicked(self):404 def plugin_on_back_clicked(self):
356 if self.current_page == self.page_auto:405 if self.current_page == self.page_auto:
@@ -405,15 +454,6 @@
405 hidden = self.controller.get_string('part_auto_hidden_label')454 hidden = self.controller.get_string('part_auto_hidden_label')
406 self.part_auto_hidden_label.set_markup(hidden % partition_count)455 self.part_auto_hidden_label.set_markup(hidden % partition_count)
407456
408 def set_part_auto_recipes(self):
409 '''Shows experimental LVM option. TODO actually
410 check the available options from partman. '''
411
412 if 'UBIQUITY_PARTAUTO_LVM' in os.environ:
413 self.vbox_part_auto_recipes.show_all()
414 else:
415 self.vbox_part_auto_recipes.hide()
416
417 def part_ask_option_is_install(self):457 def part_ask_option_is_install(self):
418 if (self.reuse_partition.get_active() or458 if (self.reuse_partition.get_active() or
419 self.replace_partition.get_active()):459 self.replace_partition.get_active()):
@@ -437,6 +477,11 @@
437 self.controller.toggle_next_button()477 self.controller.toggle_next_button()
438 self.plugin_is_install = about_to_install478 self.plugin_is_install = about_to_install
439479
480 # Supporting crypto and lvm in new installs only for now
481 use_device = self.use_device.get_active()
482 self.use_lvm.set_sensitive(use_device)
483 self.use_crypto.set_sensitive(use_device)
484
440 def initialize_resize_mode(self):485 def initialize_resize_mode(self):
441 disk_id = self.get_current_disk_partman_id()486 disk_id = self.get_current_disk_partman_id()
442 if not disk_id:487 if not disk_id:
@@ -532,7 +577,6 @@
532577
533 def part_auto_select_drive_changed(self, unused_widget):578 def part_auto_select_drive_changed(self, unused_widget):
534 self.set_part_auto_hidden_label()579 self.set_part_auto_hidden_label()
535 self.set_part_auto_recipes()
536 disk_id = self.get_current_disk_partman_id()580 disk_id = self.get_current_disk_partman_id()
537 if not disk_id:581 if not disk_id:
538 return582 return
@@ -581,46 +625,56 @@
581 def set_autopartition_options(self, options, extra_options):625 def set_autopartition_options(self, options, extra_options):
582 # TODO Need to select a radio button when resize isn't around.626 # TODO Need to select a radio button when resize isn't around.
583 self.extra_options = extra_options627 self.extra_options = extra_options
584
585 fmt = '<span size="small">%s</span>'628 fmt = '<span size="small">%s</span>'
586 self.use_device_title.set_label(options['use_device'].title)629 option_to_widget = OrderedDict({
587 self.use_device_desc.set_markup(fmt % options['use_device'].desc)630 "resize": "resize_use_free",
588 # To give a nice text effect.631 "reuse": "reuse_partition",
589 self.use_device_desc.set_sensitive(False)632 "replace": "replace_partition",
590 self.custom_partitioning_title.set_label(options['manual'].title)633 "use_device": "use_device",
591 self.custom_partitioning_desc.set_markup(fmt % options['manual'].desc)634 "manual": "custom_partitioning",
592 self.custom_partitioning_desc.set_sensitive(False)635 "some_device_crypto": "use_crypto",
593636 "some_device_lvm": "use_lvm",
594 if 'replace' in options:637 })
595 self.replace_partition.show()638
596 self.replace_partition_title.set_label(options['replace'].title)639 if 'some_device_crypto' in extra_options:
597 self.replace_partition_desc.set_markup(640 title = self.controller.get_string(
598 fmt % options['replace'].desc)641 'ubiquity/text/use_crypto_title')
599 self.replace_partition_desc.set_sensitive(False)642 desc = self.controller.get_string('ubiquity/text/use_crypto_desc')
600 else:643 options['some_device_crypto'] = PartitioningOption(title, desc)
601 self.replace_partition.hide()644
602645 if 'some_device_lvm' in extra_options:
603 if 'reuse' in options:646 title = self.controller.get_string('ubiquity/text/use_lvm_title')
604 self.reuse_partition.show()647 desc = self.controller.get_string('ubiquity/text/use_lvm_desc')
605 self.reuse_partition_title.set_markup(options['reuse'].title)648 options['some_device_lvm'] = PartitioningOption(title, desc)
606 self.reuse_partition_desc.set_markup(fmt % options['reuse'].desc)649
607 self.reuse_partition_desc.set_sensitive(False)650 for option in option_to_widget:
608 else:651 name = option_to_widget[option]
609 self.reuse_partition.hide()652 opt_widget = getattr(self, name)
610653 opt_title = getattr(self, name + '_title')
611 if 'resize' in options:654 opt_desc = getattr(self, name + '_desc')
612 self.resize_use_free.show()655
613 self.resize_use_free_title.set_label(options['resize'].title)656 if option in options:
614 self.resize_use_free_desc.set_markup(fmt % options['resize'].desc)657 opt_widget.show()
615 self.resize_use_free_desc.set_sensitive(False)658 opt_title.set_label(options[option].title)
616 else:659 opt_desc.set_markup(fmt % options[option].desc)
617 self.resize_use_free.hide()660 opt_desc.set_sensitive(False)
618661 else:
619 for opt in (self.resize_use_free, self.reuse_partition,662 opt_widget.hide()
620 self.replace_partition, self.use_device):663
621 if opt.get_property('visible'):664 # dmitrij.ledkov 2012-07-23: Hide LVM from the UI, until
622 opt.set_active(True)665 # we design user-friendly way of expressing this, or we
623 break666 # switch to lvm installs by default....
667 if option == 'some_device_lvm':
668 if 'UBIQUITY_PARTAUTO_LVM' in os.environ:
669 opt_widget.show()
670 else:
671 opt_widget.hide()
672
673 if option == 'some_device_crypto':
674 if 'UBIQUITY_PARTAUTO_CRYPTO' in os.environ:
675 opt_widget.show()
676 else:
677 opt_widget.hide()
624678
625 # Process the default selection679 # Process the default selection
626 self.part_ask_option_changed(None)680 self.part_ask_option_changed(None)
@@ -649,15 +703,20 @@
649703
650 elif self.use_device.get_active():704 elif self.use_device.get_active():
651 def choose_recipe():705 def choose_recipe():
652 # TODO dmitrij.ledkov 2012-07-10: To be extended with706 # TODO dmitrij.ledkov 2012-07-23: RAID recipe?
653 # other complex recipes, e.g. stacking crypt & raid.
654707
655 have_lvm = 'some_device_lvm' in self.extra_options708 have_lvm = 'some_device_lvm' in self.extra_options
656709 want_lvm = self.use_lvm.get_active()
657 if 'UBIQUITY_PARTAUTO_LVM' not in os.environ or not have_lvm:710
711 have_crypto = 'some_device_crypto' in self.extra_options
712 want_crypto = self.use_crypto.get_active()
713
714 if not ((want_crypto and have_crypto) or
715 (want_lvm and have_lvm)):
658 return self.extra_options['use_device'][0]716 return self.extra_options['use_device'][0]
659717
660 want_lvm = self.part_auto_use_lvm_checkbox.get_active()718 if want_crypto:
719 return self.extra_options['some_device_crypto']
661720
662 if want_lvm:721 if want_lvm:
663 return self.extra_options['some_device_lvm']722 return self.extra_options['some_device_lvm']
@@ -1379,6 +1438,25 @@
1379 self.part_advanced_warning_message.set_text(message)1438 self.part_advanced_warning_message.set_text(message)
1380 self.part_advanced_warning_hbox.show_all()1439 self.part_advanced_warning_hbox.show_all()
13811440
1441 # Crypto Page
1442 def info_loop(self, unused_widget):
1443 complete = validation.gtk_password_validate(
1444 self.controller,
1445 self.auto_password,
1446 self.auto_verified_password,
1447 self.password_ok,
1448 self.password_error_label,
1449 self.password_strength
1450 )
1451 self.controller.allow_go_forward(complete)
1452 return complete
1453
1454 def get_crypto_keys(self):
1455 if self.info_loop(None):
1456 return self.auto_password.get_text()
1457 else:
1458 return False
1459
13821460
1383class PageKde(PageBase):1461class PageKde(PageBase):
1384 plugin_breadcrumb = 'ubiquity/text/breadcrumb_partition'1462 plugin_breadcrumb = 'ubiquity/text/breadcrumb_partition'
@@ -1530,7 +1608,10 @@
1530 '^partman/confirm.*',1608 '^partman/confirm.*',
1531 '^partman/free_space$',1609 '^partman/free_space$',
1532 '^partman/active_partition$',1610 '^partman/active_partition$',
1611 '^partman-crypto/passphrase.*',
1612 '^partman-crypto/weak_passphrase$',
1533 '^partman-lvm/confirm.*',1613 '^partman-lvm/confirm.*',
1614 '^partman-lvm/device_remove_lvm',
1534 '^partman-partitioning/new_partition_(size|type|place)$',1615 '^partman-partitioning/new_partition_(size|type|place)$',
1535 '^partman-target/choose_method$',1616 '^partman-target/choose_method$',
1536 '^partman-basicfilesystems/'1617 '^partman-basicfilesystems/'
@@ -1996,6 +2077,7 @@
1996 resize_option = ('resize' in self.extra_options or2077 resize_option = ('resize' in self.extra_options or
1997 'biggest_free' in self.extra_options)2078 'biggest_free' in self.extra_options)
19982079
2080 # Irrespective of os_counts
1999 # We always have the manual partitioner, and it always has the same2081 # We always have the manual partitioner, and it always has the same
2000 # title and description.2082 # title and description.
2001 q = 'ubiquity/partitioner/advanced'2083 q = 'ubiquity/partitioner/advanced'
@@ -2129,6 +2211,10 @@
2129 self.description('partman-auto/text/resize_use_free')2211 self.description('partman-auto/text/resize_use_free')
2130 self.manual_desc = \2212 self.manual_desc = \
2131 self.description('partman-auto/text/custom_partitioning')2213 self.description('partman-auto/text/custom_partitioning')
2214 self.some_device_lvm_desc = \
2215 self.description('partman-auto-lvm/text/choice')
2216 self.some_device_crypto_desc = \
2217 self.description('partman-auto-crypto/text/choice')
2132 self.extra_options = {}2218 self.extra_options = {}
2133 if choices:2219 if choices:
2134 self.auto_state = [0, None]2220 self.auto_state = [0, None]
@@ -2249,6 +2335,18 @@
2249 for option in replace:2335 for option in replace:
2250 self.extra_options['replace'].append(option[2])2336 self.extra_options['replace'].append(option[2])
22512337
2338 some_device_lvm = self.find_script(menu_options,
2339 'some_device_lvm')
2340 if some_device_lvm:
2341 self.extra_options['some_device_lvm'] = \
2342 self.some_device_lvm_desc
2343
2344 some_device_crypto = self.find_script(menu_options,
2345 'some_device_crypto')
2346 if some_device_crypto:
2347 self.extra_options['some_device_crypto'] = \
2348 self.some_device_crypto_desc
2349
2252 # We always have the manual option.2350 # We always have the manual option.
2253 self.extra_options['manual'] = self.manual_desc2351 self.extra_options['manual'] = self.manual_desc
2254 self.ui.set_disk_layout(layout)2352 self.ui.set_disk_layout(layout)
@@ -2910,6 +3008,22 @@
2910 else:3008 else:
2911 raise AssertionError("Arrived at %s unexpectedly" % question)3009 raise AssertionError("Arrived at %s unexpectedly" % question)
29123010
3011 elif question.startswith('partman-lvm/confirm') or \
3012 question == 'partman-lvm/device_remove_lvm':
3013 self.preseed_bool(question, True, seen=False)
3014 self.succeeded = True
3015 return True
3016
3017 elif question == 'partman-crypto/weak_passphrase':
3018 self.preseed_bool(question, True, seen=False)
3019 return True
3020
3021 elif question.startswith('partman-crypto/passphrase'):
3022 if not self.ui.get_crypto_keys():
3023 return False
3024 self.preseed(question, self.ui.get_crypto_keys())
3025 return True
3026
2913 elif question.startswith('partman/confirm'):3027 elif question.startswith('partman/confirm'):
2914 self.db.set('ubiquity/partman-confirm', question[8:])3028 self.db.set('ubiquity/partman-confirm', question[8:])
2915 self.preseed(question, 'true', seen=False)3029 self.preseed(question, 'true', seen=False)
29163030
=== modified file 'ubiquity/plugins/ubi-usersetup.py'
--- ubiquity/plugins/ubi-usersetup.py 2012-07-16 14:29:13 +0000
+++ ubiquity/plugins/ubi-usersetup.py 2012-08-01 15:23:23 +0000
@@ -369,40 +369,17 @@
369 self.username_error_label.hide()369 self.username_error_label.hide()
370 complete = False370 complete = False
371371
372 passw = self.password.get_text()372 password_ok = validation.gtk_password_validate(
373 vpassw = self.verified_password.get_text()373 self.controller,
374 allow_empty = self.allow_password_empty374 self.password,
375 if passw != vpassw:375 self.verified_password,
376 complete = False376 self.password_ok,
377 self.password_ok.hide()377 self.password_error_label,
378 if passw and (len(vpassw) / float(len(passw)) > 0.8):378 self.password_strength,
379 # TODO Cache, use a custom string.379 self.allow_password_empty,
380 txt = self.controller.get_string(380 )
381 'ubiquity/text/password_mismatch')
382 txt = (
383 '<small>'
384 '<span foreground="darkred"><b>%s</b></span>'
385 '</small>' % txt)
386 self.password_error_label.set_markup(txt)
387 self.password_error_label.show()
388 else:
389 self.password_error_label.hide()
390381
391 if allow_empty:382 complete = complete and password_ok
392 self.password_strength.hide()
393 elif not passw:
394 self.password_strength.hide()
395 complete = False
396 else:
397 (txt, color) = validation.human_password_strength(passw)
398 # TODO Cache
399 txt = self.controller.get_string('ubiquity/text/password/' + txt)
400 txt = '<small><span foreground="%s"><b>%s</b></span></small>' \
401 % (color, txt)
402 self.password_strength.set_markup(txt)
403 self.password_strength.show()
404 if passw == vpassw:
405 self.password_ok.show()
406383
407 txt = self.hostname.get_text()384 txt = self.hostname.get_text()
408 self.hostname_ok.show()385 self.hostname_ok.show()
409386
=== modified file 'ubiquity/validation.py'
--- ubiquity/validation.py 2012-07-16 14:29:13 +0000
+++ ubiquity/validation.py 2012-08-01 15:23:23 +0000
@@ -140,3 +140,51 @@
140 hint = 'strong'140 hint = 'strong'
141 color = 'darkgreen'141 color = 'darkgreen'
142 return (hint, color)142 return (hint, color)
143
144
145# TODO dmitrij.ledkov 2012-07-23: factor-out further into generic
146# page/pagegtk/pagekde sub-widget
147def gtk_password_validate(controller,
148 password,
149 verified_password,
150 password_ok,
151 password_error_label,
152 password_strength,
153 allow_empty=False,
154 ):
155 complete = True
156 passw = password.get_text()
157 vpassw = verified_password.get_text()
158 if passw != vpassw:
159 complete = False
160 password_ok.hide()
161 if passw and (len(vpassw) / float(len(passw)) > 0.8):
162 # TODO Cache, use a custom string.
163 txt = controller.get_string(
164 'ubiquity/text/password_mismatch')
165 txt = (
166 '<small>'
167 '<span foreground="darkred"><b>%s</b></span>'
168 '</small>' % txt)
169 password_error_label.set_markup(txt)
170 password_error_label.show()
171 else:
172 password_error_label.hide()
173
174 if allow_empty:
175 password_strength.hide()
176 elif not passw:
177 password_strength.hide()
178 complete = False
179 else:
180 (txt, color) = human_password_strength(passw)
181 # TODO Cache
182 txt = controller.get_string('ubiquity/text/password/' + txt)
183 txt = '<small><span foreground="%s"><b>%s</b></span></small>' \
184 % (color, txt)
185 password_strength.set_markup(txt)
186 password_strength.show()
187 if passw == vpassw:
188 password_ok.show()
189
190 return complete

Subscribers

People subscribed via source and target branches

to status/vote changes: