Merge lp:~xnox/ubiquity/crypto-done into lp:ubiquity
- crypto-done
- Merge into trunk
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 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Review via email: mp+117664@code.launchpad.net |
Commit message
Description of the change
This branch adds support for automatic crypt recipe.
Dimitri John Ledkov (xnox) wrote : | # |
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=
Capital letter at the start of sentences ("If you need to, ..."). Same
in the .ui file.
> - self.assertLess
> - self.assertLess
> + self.assertLess
> + self.assertLess
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_
Use grouping with parentheses in preference to backslash-
(similarly elsewhere). So:
if (self.current_page == self.page_crypto and
not self.get_
No doubt we're not entirely consistent about this in existing code, but
let's do this in new code.
> + '^partman-
> + elif question == 'partman-
> + self.preseed_
> + return True
> +
> + elif question.
> + if not self.ui.
> + return False
> + self.preseed(
> + 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-
'^partman-
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=
>
> Capital letter at the start of sentences ("If you need to, ..."). Same
> in the .ui file.
>
ok.
>> - self.assertLess
>> - self.assertLess
>> + self.assertLess
>> + self.assertLess
>
> 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_
-------
Traceback (most recent call last):
File "/home/
79, in test_pages_
self.
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_
>
> Use grouping with parentheses in preference to backslash-
> (similarly elsewhere). So:
>
> if (self.current_page == self.page_crypto and
> not self.get_
>
> No doubt we're not entirely consistent about this in existing code, but
> let's do this in new code.
>
ok.
>> + '^partman-
>
>> + elif question == 'partman-
>> + self.preseed_
>> + return True
>> +
>> + elif question.
>> + if not self.ui.
>> + return False
>> + self.preseed(
>> + 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-
> '^partman-
>
ok.
--
Regards,
Dmitrijs.
- 5588. By Dimitri John Ledkov
-
Review comments
Colin Watson (cjwatson) : | # |
Preview Diff
1 | === modified file 'bin/ubiquity' |
2 | --- bin/ubiquity 2012-07-16 14:29:13 +0000 |
3 | +++ bin/ubiquity 2012-08-01 15:23:23 +0000 |
4 | @@ -495,6 +495,10 @@ |
5 | parser.add_option('--enable-partauto-lvm', dest='partauto_lvm', |
6 | action='store_true', |
7 | help='Enable LVM in the automatic partitioner.') |
8 | + parser.add_option('--enable-partauto-crypto', dest='partauto_crypto', |
9 | + action='store_true', |
10 | + help='Enable Full Disk encryption in the automatic' |
11 | + 'partitioner.') |
12 | parser.add_option('--no-webcam', dest='webcam', |
13 | default=True, action='store_false', |
14 | help='Disable the webcam page.') |
15 | @@ -537,6 +541,9 @@ |
16 | if options.partauto_lvm: |
17 | os.environ['UBIQUITY_PARTAUTO_LVM'] = '1' |
18 | |
19 | + if options.partauto_crypto: |
20 | + os.environ['UBIQUITY_PARTAUTO_CRYPTO'] = '1' |
21 | + |
22 | if not options.webcam: |
23 | os.environ['UBIQUITY_NO_WEBCAM'] = '1' |
24 | |
25 | |
26 | === modified file 'd-i/lists/any' |
27 | --- d-i/lists/any 2012-07-10 00:16:28 +0000 |
28 | +++ d-i/lists/any 2012-08-01 15:23:23 +0000 |
29 | @@ -10,12 +10,14 @@ |
30 | netcfg |
31 | partconf |
32 | partman-auto |
33 | +partman-auto-crypto |
34 | partman-auto-loop |
35 | partman-auto-lvm |
36 | partman-base |
37 | partman-basicfilesystems |
38 | partman-basicmethods |
39 | partman-btrfs |
40 | +partman-crypto |
41 | partman-ext3 |
42 | partman-jfs |
43 | partman-lvm |
44 | |
45 | === modified file 'debian/changelog' |
46 | --- debian/changelog 2012-07-31 12:29:30 +0000 |
47 | +++ debian/changelog 2012-08-01 15:23:23 +0000 |
48 | @@ -1,9 +1,23 @@ |
49 | ubiquity (2.11.19) UNRELEASED; urgency=low |
50 | |
51 | + [ Colin Watson ] |
52 | * Simplify DebconfFilter.process_line slightly. |
53 | * Simplify KeyboardNames._load_file using collections.defaultdict. |
54 | |
55 | - -- Colin Watson <cjwatson@ubuntu.com> Tue, 31 Jul 2012 13:26:31 +0100 |
56 | + [ Dmitrijs Ledkovs ] |
57 | + * Make the UI layout test print the failed page/step name. |
58 | + * Add crypt security key setup page and move crypt/lvm checkboxes to the |
59 | + ask page. |
60 | + * Refactor password validation from ubi-usersetup into a reusable |
61 | + component (for ubi-partman). |
62 | + * Refactor set_autopartition_options method in ubi-partman.py. |
63 | + * Add crypto option to ubi-partman. |
64 | + * Add command line flag to enable crypt checkbox on the ask page. |
65 | + * Add partman-crypto to the dependencies. |
66 | + * Add translation strings for crypto. |
67 | + * Add graphviz diagram of available ask page options. |
68 | + |
69 | + -- Dmitrijs Ledkovs <dmitrij.ledkov@ubuntu.com> Wed, 01 Aug 2012 15:02:14 +0100 |
70 | |
71 | ubiquity (2.11.18) quantal; urgency=low |
72 | |
73 | |
74 | === modified file 'debian/ubiquity.templates' |
75 | --- debian/ubiquity.templates 2012-07-16 10:10:04 +0000 |
76 | +++ debian/ubiquity.templates 2012-08-01 15:23:23 +0000 |
77 | @@ -1368,6 +1368,64 @@ |
78 | This computer currently has no detected operating systems. What would you |
79 | like to do? |
80 | |
81 | -Template: ubiquity/text/part_auto_use_lvm_checkbox |
82 | -Type: text |
83 | -_Description: Set up LVM |
84 | +Template: ubiquity/text/use_crypto_title |
85 | +Type: text |
86 | +_Description: |
87 | + Encrypt the new Ubuntu installation for security |
88 | + |
89 | +Template: ubiquity/text/use_crypto_desc |
90 | +Type: text |
91 | +_Description: |
92 | + You will choose a security key in the next step. |
93 | + |
94 | +Template: ubiquity/text/use_lvm_title |
95 | +Type: text |
96 | +_Description: |
97 | + Use LVM with the new Ubuntu installation |
98 | + |
99 | +Template: ubiquity/text/use_lvm_desc |
100 | +Type: text |
101 | +_Description: |
102 | + This will set up Logical Volume Management. It allows taking snapshots and easier partition resizing. |
103 | + |
104 | +Template: ubiquity/text/verified_crypto_label |
105 | +Type: text |
106 | +_Description: |
107 | + Confirm the security key: |
108 | + |
109 | +Template:ubiquity/text/crypto_label |
110 | +Type: text |
111 | +_Description: |
112 | + Choose a security key: |
113 | + |
114 | +Template:ubiquity/text/crypto_description |
115 | +Type: text |
116 | +_Description: |
117 | + 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. |
118 | + |
119 | +Template:ubiquity/text/crypto_description_2 |
120 | +Type: text |
121 | +_Description: |
122 | + Any files outside of Ubuntu will not be encrypted. |
123 | + |
124 | +Template:ubiquity/text/crypto_warning |
125 | +Type: text |
126 | +_Description: |
127 | + <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. |
128 | + |
129 | +Template:ubiquity/text/crypto_exta_label |
130 | +Type: text |
131 | +_Description: |
132 | + For more security: |
133 | + |
134 | +Template:ubiquity/text/fill_with_random_data |
135 | +Type: text |
136 | +_Description: |
137 | + Overwrite empty disk space |
138 | + |
139 | +Template:ubiquity/text/crypto_extra_time |
140 | +Type: text |
141 | +_Description: |
142 | + The installation may take much longer. |
143 | + |
144 | + |
145 | |
146 | === added file 'doc/ubi-partman-page-ask-statemachine.dot' |
147 | --- doc/ubi-partman-page-ask-statemachine.dot 1970-01-01 00:00:00 +0000 |
148 | +++ doc/ubi-partman-page-ask-statemachine.dot 2012-08-01 15:23:23 +0000 |
149 | @@ -0,0 +1,36 @@ |
150 | +digraph { |
151 | + { rank = same; |
152 | + use_device; |
153 | + resize; |
154 | + custom; |
155 | + wubi; |
156 | + reuse; |
157 | + replace; |
158 | + }; |
159 | + { rank = same; |
160 | + switch_to_install; |
161 | + go_to_manual; |
162 | + go_to_wubi; |
163 | + }; |
164 | + { node [shape = diamond]; |
165 | + biggest_free; |
166 | + one_disk; |
167 | + have_crypto; |
168 | + }; |
169 | + use_device -> one_disk; |
170 | + one_disk -> go_to_auto [label="no"]; |
171 | + one_disk -> have_crypto [label="yes"]; |
172 | + go_to_auto -> have_crypto [label="if use_device"]; |
173 | + have_crypto -> switch_to_install [label="no"]; |
174 | + have_crypto -> go_to_crypto [label="yes"]; |
175 | + go_to_crypto -> switch_to_install; |
176 | + resize -> biggest_free; |
177 | + biggest_free -> switch_to_install [label="yes"]; |
178 | + biggest_free -> go_to_auto [label="no"]; |
179 | + go_to_auto -> switch_to_install; |
180 | + custom -> go_to_manual; |
181 | + reuse -> switch_to_install; |
182 | + replace -> switch_to_install; |
183 | + wubi -> go_to_wubi; |
184 | + go_to_crypto; |
185 | +}; |
186 | |
187 | === modified file 'gui/gtk/stepPartAsk.ui' |
188 | --- gui/gtk/stepPartAsk.ui 2012-06-07 19:38:33 +0000 |
189 | +++ gui/gtk/stepPartAsk.ui 2012-08-01 15:23:23 +0000 |
190 | @@ -1,7 +1,6 @@ |
191 | <?xml version="1.0" encoding="UTF-8"?> |
192 | <interface> |
193 | - <requires lib="gtk+" version="2.24"/> |
194 | - <!-- interface-naming-policy project-wide --> |
195 | + <!-- interface-requires gtk+ 3.0 --> |
196 | <!-- interface-local-resource-path /home/evan/bzr/ubiquity.partitioner-redesign/pixmaps/partitioner --> |
197 | <object class="GtkAlignment" id="stepPartAsk"> |
198 | <property name="visible">True</property> |
199 | @@ -39,6 +38,7 @@ |
200 | <property name="spacing">12</property> |
201 | <child> |
202 | <object class="GtkRadioButton" id="resize_use_free"> |
203 | + <property name="use_action_appearance">False</property> |
204 | <property name="visible">True</property> |
205 | <property name="can_focus">True</property> |
206 | <property name="receives_default">False</property> |
207 | @@ -46,10 +46,10 @@ |
208 | <property name="xalign">0</property> |
209 | <property name="active">True</property> |
210 | <property name="draw_indicator">True</property> |
211 | - <signal name="clicked" handler="part_ask_option_changed" swapped="no"/> |
212 | <accessibility> |
213 | <relation type="labelled-by" target="resize_use_free_title"/> |
214 | </accessibility> |
215 | + <signal name="clicked" handler="part_ask_option_changed" swapped="no"/> |
216 | <child> |
217 | <object class="GtkBox" id="hbox1"> |
218 | <property name="visible">True</property> |
219 | @@ -122,6 +122,7 @@ |
220 | </child> |
221 | <child> |
222 | <object class="GtkRadioButton" id="replace_partition"> |
223 | + <property name="use_action_appearance">False</property> |
224 | <property name="visible">True</property> |
225 | <property name="can_focus">True</property> |
226 | <property name="receives_default">False</property> |
227 | @@ -129,10 +130,10 @@ |
228 | <property name="xalign">0</property> |
229 | <property name="draw_indicator">True</property> |
230 | <property name="group">resize_use_free</property> |
231 | - <signal name="clicked" handler="part_ask_option_changed" swapped="no"/> |
232 | <accessibility> |
233 | <relation type="labelled-by" target="replace_partition_title"/> |
234 | </accessibility> |
235 | + <signal name="clicked" handler="part_ask_option_changed" swapped="no"/> |
236 | <child> |
237 | <object class="GtkBox" id="hbox5"> |
238 | <property name="visible">True</property> |
239 | @@ -205,16 +206,18 @@ |
240 | </child> |
241 | <child> |
242 | <object class="GtkRadioButton" id="reuse_partition"> |
243 | + <property name="use_action_appearance">False</property> |
244 | <property name="visible">True</property> |
245 | <property name="can_focus">True</property> |
246 | <property name="receives_default">False</property> |
247 | <property name="use_action_appearance">False</property> |
248 | + <property name="xalign">0.5</property> |
249 | <property name="draw_indicator">True</property> |
250 | <property name="group">resize_use_free</property> |
251 | - <signal name="clicked" handler="part_ask_option_changed" swapped="no"/> |
252 | <accessibility> |
253 | <relation type="labelled-by" target="reuse_partition_title"/> |
254 | </accessibility> |
255 | + <signal name="clicked" handler="part_ask_option_changed" swapped="no"/> |
256 | <child> |
257 | <object class="GtkBox" id="hbox2"> |
258 | <property name="visible">True</property> |
259 | @@ -287,6 +290,7 @@ |
260 | </child> |
261 | <child> |
262 | <object class="GtkRadioButton" id="use_device"> |
263 | + <property name="use_action_appearance">False</property> |
264 | <property name="visible">True</property> |
265 | <property name="can_focus">True</property> |
266 | <property name="receives_default">False</property> |
267 | @@ -294,10 +298,10 @@ |
268 | <property name="xalign">0</property> |
269 | <property name="draw_indicator">True</property> |
270 | <property name="group">resize_use_free</property> |
271 | - <signal name="clicked" handler="part_ask_option_changed" swapped="no"/> |
272 | <accessibility> |
273 | <relation type="labelled-by" target="use_device_title"/> |
274 | </accessibility> |
275 | + <signal name="clicked" handler="part_ask_option_changed" swapped="no"/> |
276 | <child> |
277 | <object class="GtkBox" id="hbox3"> |
278 | <property name="visible">True</property> |
279 | @@ -369,6 +373,116 @@ |
280 | </packing> |
281 | </child> |
282 | <child> |
283 | + <object class="GtkCheckButton" id="use_crypto"> |
284 | + <property name="use_action_appearance">False</property> |
285 | + <property name="visible">True</property> |
286 | + <property name="can_focus">True</property> |
287 | + <property name="receives_default">False</property> |
288 | + <property name="use_action_appearance">False</property> |
289 | + <property name="xalign">0</property> |
290 | + <property name="draw_indicator">True</property> |
291 | + <child> |
292 | + <object class="GtkBox" id="vbox7"> |
293 | + <property name="visible">True</property> |
294 | + <property name="can_focus">False</property> |
295 | + <property name="orientation">vertical</property> |
296 | + <property name="spacing">3</property> |
297 | + <child> |
298 | + <object class="GtkLabel" id="use_crypto_title"> |
299 | + <property name="visible">True</property> |
300 | + <property name="can_focus">False</property> |
301 | + <property name="xalign">0</property> |
302 | + <property name="yalign">0</property> |
303 | + <property name="label" translatable="yes">Encrypt the new Ubuntu installation for security</property> |
304 | + <property name="wrap">True</property> |
305 | + </object> |
306 | + <packing> |
307 | + <property name="expand">False</property> |
308 | + <property name="fill">True</property> |
309 | + <property name="position">0</property> |
310 | + </packing> |
311 | + </child> |
312 | + <child> |
313 | + <object class="GtkLabel" id="use_crypto_desc"> |
314 | + <property name="visible">True</property> |
315 | + <property name="can_focus">False</property> |
316 | + <property name="xalign">0</property> |
317 | + <property name="yalign">0</property> |
318 | + <property name="label" translatable="yes"><span weight="light" size="small">You’ll choose a security key in the next step.</span></property> |
319 | + <property name="use_markup">True</property> |
320 | + <property name="wrap">True</property> |
321 | + </object> |
322 | + <packing> |
323 | + <property name="expand">False</property> |
324 | + <property name="fill">True</property> |
325 | + <property name="position">1</property> |
326 | + </packing> |
327 | + </child> |
328 | + </object> |
329 | + </child> |
330 | + </object> |
331 | + <packing> |
332 | + <property name="expand">False</property> |
333 | + <property name="fill">True</property> |
334 | + <property name="position">4</property> |
335 | + </packing> |
336 | + </child> |
337 | + <child> |
338 | + <object class="GtkCheckButton" id="use_lvm"> |
339 | + <property name="use_action_appearance">False</property> |
340 | + <property name="visible">True</property> |
341 | + <property name="can_focus">True</property> |
342 | + <property name="receives_default">False</property> |
343 | + <property name="use_action_appearance">False</property> |
344 | + <property name="xalign">0</property> |
345 | + <property name="draw_indicator">True</property> |
346 | + <child> |
347 | + <object class="GtkBox" id="vbox8"> |
348 | + <property name="visible">True</property> |
349 | + <property name="can_focus">False</property> |
350 | + <property name="orientation">vertical</property> |
351 | + <property name="spacing">3</property> |
352 | + <child> |
353 | + <object class="GtkLabel" id="use_lvm_title"> |
354 | + <property name="visible">True</property> |
355 | + <property name="can_focus">False</property> |
356 | + <property name="xalign">0</property> |
357 | + <property name="yalign">0</property> |
358 | + <property name="label" translatable="yes">Use LVM with the new Ubuntu installation</property> |
359 | + <property name="wrap">True</property> |
360 | + </object> |
361 | + <packing> |
362 | + <property name="expand">False</property> |
363 | + <property name="fill">True</property> |
364 | + <property name="position">0</property> |
365 | + </packing> |
366 | + </child> |
367 | + <child> |
368 | + <object class="GtkLabel" id="use_lvm_desc"> |
369 | + <property name="visible">True</property> |
370 | + <property name="can_focus">False</property> |
371 | + <property name="xalign">0</property> |
372 | + <property name="yalign">0</property> |
373 | + <property name="label" translatable="yes"><span weight="light" size="small">This will set up Logical Volume Management. It allows taking snapshots and easier partition resizing.</span></property> |
374 | + <property name="use_markup">True</property> |
375 | + <property name="wrap">True</property> |
376 | + </object> |
377 | + <packing> |
378 | + <property name="expand">False</property> |
379 | + <property name="fill">True</property> |
380 | + <property name="position">1</property> |
381 | + </packing> |
382 | + </child> |
383 | + </object> |
384 | + </child> |
385 | + </object> |
386 | + <packing> |
387 | + <property name="expand">False</property> |
388 | + <property name="fill">True</property> |
389 | + <property name="position">5</property> |
390 | + </packing> |
391 | + </child> |
392 | + <child> |
393 | <object class="GtkAlignment" id="alignment1"> |
394 | <property name="visible">True</property> |
395 | <property name="can_focus">False</property> |
396 | @@ -384,11 +498,12 @@ |
397 | <packing> |
398 | <property name="expand">False</property> |
399 | <property name="fill">True</property> |
400 | - <property name="position">4</property> |
401 | + <property name="position">6</property> |
402 | </packing> |
403 | </child> |
404 | <child> |
405 | <object class="GtkRadioButton" id="custom_partitioning"> |
406 | + <property name="use_action_appearance">False</property> |
407 | <property name="visible">True</property> |
408 | <property name="can_focus">True</property> |
409 | <property name="receives_default">False</property> |
410 | @@ -396,10 +511,10 @@ |
411 | <property name="xalign">0</property> |
412 | <property name="draw_indicator">True</property> |
413 | <property name="group">resize_use_free</property> |
414 | - <signal name="clicked" handler="part_ask_option_changed" swapped="no"/> |
415 | <accessibility> |
416 | <relation type="labelled-by" target="custom_partitioning_title"/> |
417 | </accessibility> |
418 | + <signal name="clicked" handler="part_ask_option_changed" swapped="no"/> |
419 | <child> |
420 | <object class="GtkBox" id="hbox4"> |
421 | <property name="visible">True</property> |
422 | @@ -467,7 +582,7 @@ |
423 | <packing> |
424 | <property name="expand">False</property> |
425 | <property name="fill">True</property> |
426 | - <property name="position">5</property> |
427 | + <property name="position">7</property> |
428 | </packing> |
429 | </child> |
430 | </object> |
431 | |
432 | === modified file 'gui/gtk/stepPartAuto.ui' |
433 | --- gui/gtk/stepPartAuto.ui 2012-07-16 10:10:04 +0000 |
434 | +++ gui/gtk/stepPartAuto.ui 2012-08-01 15:23:23 +0000 |
435 | @@ -1,8 +1,6 @@ |
436 | <?xml version="1.0" encoding="UTF-8"?> |
437 | <interface> |
438 | - <requires lib="gtk+" version="2.24"/> |
439 | - <!-- interface-requires gtkwidgets 0.0 --> |
440 | - <!-- interface-naming-policy toplevel-contextual --> |
441 | + <!-- interface-requires gtk+ 3.0 --> |
442 | <object class="GtkListStore" id="liststore1"> |
443 | <columns> |
444 | <!-- column-name gchararray1 --> |
445 | @@ -156,43 +154,6 @@ |
446 | <property name="position">2</property> |
447 | </packing> |
448 | </child> |
449 | - <child> |
450 | - <object class="GtkAlignment" id="alignment1"> |
451 | - <property name="visible">True</property> |
452 | - <property name="can_focus">False</property> |
453 | - <property name="top_padding">16</property> |
454 | - <child> |
455 | - <object class="GtkBox" id="vbox_part_auto_recipes"> |
456 | - <property name="visible">True</property> |
457 | - <property name="can_focus">False</property> |
458 | - <property name="orientation">vertical</property> |
459 | - <child> |
460 | - <object class="GtkCheckButton" id="part_auto_use_lvm_checkbox"> |
461 | - <property name="label" translatable="yes">Set up LVM</property> |
462 | - <property name="use_action_appearance">False</property> |
463 | - <property name="visible">True</property> |
464 | - <property name="can_focus">True</property> |
465 | - <property name="receives_default">False</property> |
466 | - <property name="use_action_appearance">False</property> |
467 | - <property name="xalign">0</property> |
468 | - <property name="image_position">top</property> |
469 | - <property name="draw_indicator">True</property> |
470 | - </object> |
471 | - <packing> |
472 | - <property name="expand">False</property> |
473 | - <property name="fill">True</property> |
474 | - <property name="position">0</property> |
475 | - </packing> |
476 | - </child> |
477 | - </object> |
478 | - </child> |
479 | - </object> |
480 | - <packing> |
481 | - <property name="expand">False</property> |
482 | - <property name="fill">True</property> |
483 | - <property name="position">3</property> |
484 | - </packing> |
485 | - </child> |
486 | </object> |
487 | <packing> |
488 | <property name="expand">False</property> |
489 | |
490 | === added file 'gui/gtk/stepPartCrypto.ui' |
491 | --- gui/gtk/stepPartCrypto.ui 1970-01-01 00:00:00 +0000 |
492 | +++ gui/gtk/stepPartCrypto.ui 2012-08-01 15:23:23 +0000 |
493 | @@ -0,0 +1,245 @@ |
494 | +<?xml version="1.0" encoding="UTF-8"?> |
495 | +<interface> |
496 | + <!-- interface-requires gtk+ 3.0 --> |
497 | + <object class="GtkEventBox" id="stepPartCrypto"> |
498 | + <property name="visible">True</property> |
499 | + <property name="can_focus">False</property> |
500 | + <child> |
501 | + <object class="GtkGrid" id="userinfo_table"> |
502 | + <property name="visible">True</property> |
503 | + <property name="can_focus">False</property> |
504 | + <property name="border_width">20</property> |
505 | + <property name="row_spacing">6</property> |
506 | + <property name="column_spacing">6</property> |
507 | + <child> |
508 | + <object class="GtkLabel" id="verified_crypto_label"> |
509 | + <property name="visible">True</property> |
510 | + <property name="can_focus">False</property> |
511 | + <property name="halign">end</property> |
512 | + <property name="xalign">0</property> |
513 | + <property name="label" translatable="yes">Confirm the security key:</property> |
514 | + <property name="justify">right</property> |
515 | + <property name="single_line_mode">True</property> |
516 | + </object> |
517 | + <packing> |
518 | + <property name="left_attach">0</property> |
519 | + <property name="top_attach">3</property> |
520 | + <property name="width">1</property> |
521 | + <property name="height">1</property> |
522 | + </packing> |
523 | + </child> |
524 | + <child> |
525 | + <object class="GtkLabel" id="crypto_label"> |
526 | + <property name="visible">True</property> |
527 | + <property name="can_focus">False</property> |
528 | + <property name="halign">end</property> |
529 | + <property name="xalign">0</property> |
530 | + <property name="label" translatable="yes">Choose a security key:</property> |
531 | + <property name="justify">right</property> |
532 | + <property name="single_line_mode">True</property> |
533 | + </object> |
534 | + <packing> |
535 | + <property name="left_attach">0</property> |
536 | + <property name="top_attach">2</property> |
537 | + <property name="width">1</property> |
538 | + <property name="height">1</property> |
539 | + </packing> |
540 | + </child> |
541 | + <child> |
542 | + <object class="GtkLabel" id="crypto_description"> |
543 | + <property name="visible">True</property> |
544 | + <property name="can_focus">False</property> |
545 | + <property name="halign">start</property> |
546 | + <property name="xalign">0</property> |
547 | + <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> |
548 | + <property name="wrap">True</property> |
549 | + </object> |
550 | + <packing> |
551 | + <property name="left_attach">0</property> |
552 | + <property name="top_attach">0</property> |
553 | + <property name="width">4</property> |
554 | + <property name="height">1</property> |
555 | + </packing> |
556 | + </child> |
557 | + <child> |
558 | + <object class="GtkLabel" id="crypto_warning"> |
559 | + <property name="visible">True</property> |
560 | + <property name="can_focus">False</property> |
561 | + <property name="halign">start</property> |
562 | + <property name="xalign">0</property> |
563 | + <property name="label" translatable="yes"><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.</property> |
564 | + <property name="use_markup">True</property> |
565 | + <property name="wrap">True</property> |
566 | + </object> |
567 | + <packing> |
568 | + <property name="left_attach">0</property> |
569 | + <property name="top_attach">4</property> |
570 | + <property name="width">4</property> |
571 | + <property name="height">1</property> |
572 | + </packing> |
573 | + </child> |
574 | + <child> |
575 | + <object class="GtkLabel" id="crypto_exta_label"> |
576 | + <property name="visible">True</property> |
577 | + <property name="can_focus">False</property> |
578 | + <property name="halign">end</property> |
579 | + <property name="xalign">0</property> |
580 | + <property name="label" translatable="yes">For more security:</property> |
581 | + <property name="justify">right</property> |
582 | + </object> |
583 | + <packing> |
584 | + <property name="left_attach">0</property> |
585 | + <property name="top_attach">5</property> |
586 | + <property name="width">1</property> |
587 | + <property name="height">1</property> |
588 | + </packing> |
589 | + </child> |
590 | + <child> |
591 | + <object class="GtkCheckButton" id="fill_with_random_data"> |
592 | + <property name="label" translatable="yes">Overwrite empty disk space</property> |
593 | + <property name="use_action_appearance">False</property> |
594 | + <property name="visible">True</property> |
595 | + <property name="can_focus">True</property> |
596 | + <property name="receives_default">False</property> |
597 | + <property name="halign">start</property> |
598 | + <property name="use_action_appearance">False</property> |
599 | + <property name="xalign">0</property> |
600 | + <property name="draw_indicator">True</property> |
601 | + </object> |
602 | + <packing> |
603 | + <property name="left_attach">1</property> |
604 | + <property name="top_attach">5</property> |
605 | + <property name="width">3</property> |
606 | + <property name="height">1</property> |
607 | + </packing> |
608 | + </child> |
609 | + <child> |
610 | + <object class="GtkLabel" id="password_strength"> |
611 | + <property name="can_focus">False</property> |
612 | + <property name="halign">start</property> |
613 | + <property name="xalign">0</property> |
614 | + <property name="label" translatable="yes"><small><span color="darkgreen">Strong password</span></small></property> |
615 | + <property name="use_markup">True</property> |
616 | + <property name="single_line_mode">True</property> |
617 | + </object> |
618 | + <packing> |
619 | + <property name="left_attach">2</property> |
620 | + <property name="top_attach">2</property> |
621 | + <property name="width">2</property> |
622 | + <property name="height">1</property> |
623 | + </packing> |
624 | + </child> |
625 | + <child> |
626 | + <object class="GtkEntry" id="auto_password"> |
627 | + <property name="visible">True</property> |
628 | + <property name="can_focus">True</property> |
629 | + <property name="has_focus">True</property> |
630 | + <property name="visibility">False</property> |
631 | + <property name="invisible_char">●</property> |
632 | + <property name="activates_default">True</property> |
633 | + <property name="width_chars">20</property> |
634 | + <property name="invisible_char_set">True</property> |
635 | + <accessibility> |
636 | + <relation type="labelled-by" target="crypto_label"/> |
637 | + </accessibility> |
638 | + <signal name="changed" handler="info_loop" swapped="no"/> |
639 | + </object> |
640 | + <packing> |
641 | + <property name="left_attach">1</property> |
642 | + <property name="top_attach">2</property> |
643 | + <property name="width">1</property> |
644 | + <property name="height">1</property> |
645 | + </packing> |
646 | + </child> |
647 | + <child> |
648 | + <object class="GtkEntry" id="auto_verified_password"> |
649 | + <property name="visible">True</property> |
650 | + <property name="can_focus">True</property> |
651 | + <property name="visibility">False</property> |
652 | + <property name="invisible_char">●</property> |
653 | + <property name="activates_default">True</property> |
654 | + <property name="width_chars">20</property> |
655 | + <property name="invisible_char_set">True</property> |
656 | + <accessibility> |
657 | + <relation type="labelled-by" target="verified_crypto_label"/> |
658 | + </accessibility> |
659 | + <signal name="changed" handler="info_loop" swapped="no"/> |
660 | + </object> |
661 | + <packing> |
662 | + <property name="left_attach">1</property> |
663 | + <property name="top_attach">3</property> |
664 | + <property name="width">1</property> |
665 | + <property name="height">1</property> |
666 | + </packing> |
667 | + </child> |
668 | + <child> |
669 | + <object class="GtkLabel" id="crypto_extra_time"> |
670 | + <property name="visible">True</property> |
671 | + <property name="can_focus">False</property> |
672 | + <property name="halign">start</property> |
673 | + <property name="margin_left">24</property> |
674 | + <property name="xalign">0</property> |
675 | + <property name="label" translatable="yes"><span weight="light" size="small">The installation may take much longer.</span></property> |
676 | + <property name="use_markup">True</property> |
677 | + <property name="single_line_mode">True</property> |
678 | + </object> |
679 | + <packing> |
680 | + <property name="left_attach">1</property> |
681 | + <property name="top_attach">6</property> |
682 | + <property name="width">3</property> |
683 | + <property name="height">1</property> |
684 | + </packing> |
685 | + </child> |
686 | + <child> |
687 | + <object class="GtkLabel" id="crypto_description_2"> |
688 | + <property name="visible">True</property> |
689 | + <property name="can_focus">False</property> |
690 | + <property name="halign">start</property> |
691 | + <property name="xalign">0</property> |
692 | + <property name="label" translatable="yes">Any files outside of Ubuntu will not be encrypted.</property> |
693 | + <property name="wrap">True</property> |
694 | + </object> |
695 | + <packing> |
696 | + <property name="left_attach">0</property> |
697 | + <property name="top_attach">1</property> |
698 | + <property name="width">4</property> |
699 | + <property name="height">1</property> |
700 | + </packing> |
701 | + </child> |
702 | + <child> |
703 | + <object class="GtkImage" id="password_ok"> |
704 | + <property name="can_focus">False</property> |
705 | + <property name="halign">start</property> |
706 | + <property name="xalign">0</property> |
707 | + <property name="stock">gtk-yes</property> |
708 | + </object> |
709 | + <packing> |
710 | + <property name="left_attach">2</property> |
711 | + <property name="top_attach">3</property> |
712 | + <property name="width">1</property> |
713 | + <property name="height">1</property> |
714 | + </packing> |
715 | + </child> |
716 | + <child> |
717 | + <object class="GtkLabel" id="password_error_label"> |
718 | + <property name="can_focus">False</property> |
719 | + <property name="halign">start</property> |
720 | + <property name="xalign">0</property> |
721 | + <property name="label" translatable="yes"><small><span color="darkred">Passwords do not match</span></small></property> |
722 | + <property name="use_markup">True</property> |
723 | + <property name="single_line_mode">True</property> |
724 | + </object> |
725 | + <packing> |
726 | + <property name="left_attach">3</property> |
727 | + <property name="top_attach">3</property> |
728 | + <property name="width">1</property> |
729 | + <property name="height">1</property> |
730 | + </packing> |
731 | + </child> |
732 | + <child> |
733 | + <placeholder/> |
734 | + </child> |
735 | + </object> |
736 | + </child> |
737 | + </object> |
738 | +</interface> |
739 | |
740 | === modified file 'tests/test_gtkui.py' |
741 | --- tests/test_gtkui.py 2012-07-16 14:29:13 +0000 |
742 | +++ tests/test_gtkui.py 2012-08-01 15:23:23 +0000 |
743 | @@ -75,8 +75,8 @@ |
744 | import time |
745 | time.sleep(3) |
746 | alloc = ui.live_installer.get_allocation() |
747 | - self.assertLessEqual(alloc.width, 640) |
748 | - self.assertLessEqual(alloc.height, 500) |
749 | + self.assertLessEqual(alloc.width, 640, page.module.NAME) |
750 | + self.assertLessEqual(alloc.height, 500, page.module.NAME) |
751 | if page.module.NAME == 'partman': |
752 | ui.allow_change_step(False) |
753 | |
754 | |
755 | === modified file 'ubiquity/plugins/ubi-partman.py' |
756 | --- ubiquity/plugins/ubi-partman.py 2012-07-19 09:49:20 +0000 |
757 | +++ ubiquity/plugins/ubi-partman.py 2012-08-01 15:23:23 +0000 |
758 | @@ -29,6 +29,7 @@ |
759 | from ubiquity import parted_server |
760 | from ubiquity import misc |
761 | from ubiquity import osextras |
762 | +from ubiquity import validation |
763 | from ubiquity.install_misc import archdetect |
764 | |
765 | NAME = 'partman' |
766 | @@ -98,6 +99,9 @@ |
767 | def get_grub_choice(self): |
768 | return misc.grub_default() |
769 | |
770 | + def get_crypto_keys(self): |
771 | + pass |
772 | + |
773 | |
774 | class PageGtk(PageBase): |
775 | plugin_title = 'ubiquity/text/part_auto_heading_label' |
776 | @@ -114,11 +118,14 @@ |
777 | os.environ['UBIQUITY_GLADE'], 'stepPartAuto.ui')) |
778 | builder.add_from_file(os.path.join( |
779 | os.environ['UBIQUITY_GLADE'], 'stepPartAdvanced.ui')) |
780 | + builder.add_from_file(os.path.join( |
781 | + os.environ['UBIQUITY_GLADE'], 'stepPartCrypto.ui')) |
782 | builder.connect_signals(self) |
783 | |
784 | self.page_ask = builder.get_object('stepPartAsk') |
785 | self.page_auto = builder.get_object('stepPartAuto') |
786 | self.page_advanced = builder.get_object('stepPartAdvanced') |
787 | + self.page_crypto = builder.get_object('stepPartCrypto') |
788 | |
789 | # Grub options |
790 | self.bootloader_vbox = builder.get_object('bootloader_vbox') |
791 | @@ -139,10 +146,8 @@ |
792 | self.part_auto_hidden_label = builder.get_object( |
793 | 'part_auto_hidden_label') |
794 | self.part_advanced_vbox = builder.get_object('part_advanced_vbox') |
795 | - self.vbox_part_auto_recipes = builder.get_object( |
796 | - 'vbox_part_auto_recipes') |
797 | - self.part_auto_use_lvm_checkbox = builder.get_object( |
798 | - 'part_auto_use_lvm_checkbox') |
799 | + self.use_lvm = builder.get_object('use_lvm') |
800 | + self.use_crypto = builder.get_object('use_crypto') |
801 | |
802 | # Ask page |
803 | self.part_ask_heading = builder.get_object('part_ask_heading') |
804 | @@ -163,6 +168,10 @@ |
805 | 'custom_partitioning_title') |
806 | self.custom_partitioning_desc = builder.get_object( |
807 | 'custom_partitioning_desc') |
808 | + self.use_lvm_title = builder.get_object('use_lvm_title') |
809 | + self.use_lvm_desc = builder.get_object('use_lvm_desc') |
810 | + self.use_crypto_title = builder.get_object('use_crypto_title') |
811 | + self.use_crypto_desc = builder.get_object('use_crypto_desc') |
812 | |
813 | # Advanced page |
814 | self.partition_create_mount_combo = builder.get_object( |
815 | @@ -219,6 +228,19 @@ |
816 | self.part_advanced_recalculating_label = builder.get_object( |
817 | 'part_advanced_recalculating_label') |
818 | |
819 | + # Crypto page |
820 | + |
821 | + self.auto_password = builder.get_object( |
822 | + 'auto_password') |
823 | + self.password_error_label = builder.get_object( |
824 | + 'password_error_label') |
825 | + self.auto_verified_password = builder.get_object( |
826 | + 'auto_verified_password') |
827 | + self.password_strength = builder.get_object( |
828 | + 'password_strength') |
829 | + self.password_ok = builder.get_object( |
830 | + 'password_ok') |
831 | + |
832 | self.partition_bars = {} |
833 | self.segmented_bar_vbox = None |
834 | self.resize_min_size = None |
835 | @@ -232,7 +254,8 @@ |
836 | True) |
837 | self.partition_edit_mount_combo.get_child().set_activates_default(True) |
838 | |
839 | - self.plugin_optional_widgets = [self.page_auto, self.page_advanced] |
840 | + self.plugin_optional_widgets = [self.page_auto, self.page_advanced, |
841 | + self.page_crypto] |
842 | self.current_page = self.page_ask |
843 | |
844 | # Set some parameters that do not change between runs of the plugin |
845 | @@ -284,6 +307,10 @@ |
846 | os.rmdir(mount_path) |
847 | self.controller._wizard.do_reboot() |
848 | |
849 | + def set_page_title(self, title): |
850 | + self.controller._wizard.page_title.set_markup( |
851 | + '<span size="xx-large">%s</span>' % title) |
852 | + |
853 | def plugin_on_next_clicked(self): |
854 | reuse = self.reuse_partition.get_active() |
855 | replace = self.replace_partition.get_active() |
856 | @@ -291,29 +318,62 @@ |
857 | custom = self.custom_partitioning.get_active() |
858 | use_device = self.use_device.get_active() |
859 | biggest_free = 'biggest_free' in self.extra_options |
860 | + crypto = self.use_device.get_active() |
861 | + one_disk = False |
862 | + |
863 | + if custom: |
864 | + self.set_page_title(self.custom_partitioning_title.get_text()) |
865 | + self.current_page = self.page_advanced |
866 | + self.controller.go_to_page(self.current_page) |
867 | + self.controller.toggle_next_button('install_button') |
868 | + self.plugin_is_install = True |
869 | + return False |
870 | + |
871 | + # Setting the model early on, because if there is only one |
872 | + # disk, we switch to install interface staight away and it |
873 | + # queries the model to get the disk |
874 | + m = self.part_auto_select_drive.get_model() |
875 | + m.clear() |
876 | + disks = self.extra_options['use_device'][1] |
877 | + if len(disks) == 1: |
878 | + one_disk = True |
879 | + if use_device: |
880 | + for disk in disks: |
881 | + m.append([disk, '']) |
882 | + self.part_auto_select_drive.set_active(0) |
883 | + |
884 | + # Currently we support crypto only in use_disk |
885 | + # TODO dmitrij.ledkov 2012-07-25 no way to go back and return |
886 | + # to here? This needs to be addressed in the design document. |
887 | + if crypto and use_device and self.current_page == self.page_ask: |
888 | + self.set_page_title( |
889 | + self.controller.get_string('ubiquity/text/crypto_label')) |
890 | + self.current_page = self.page_crypto |
891 | + self.controller.go_to_page(self.current_page) |
892 | + self.controller.toggle_next_button('install_button') |
893 | + self.plugin_is_install = True |
894 | + self.info_loop(None) |
895 | + return True |
896 | + |
897 | + if (self.current_page == self.page_crypto and |
898 | + not self.get_crypto_keys()): |
899 | + self.controller.allow_go_forward(False) |
900 | + return True |
901 | |
902 | # We already have all that we need from the user. |
903 | - done_partitioning = (resize and biggest_free) or reuse or replace |
904 | + done_partitioning = \ |
905 | + (resize and biggest_free) or \ |
906 | + (use_device and one_disk) or \ |
907 | + reuse or replace |
908 | |
909 | if self.current_page == self.page_ask and not done_partitioning: |
910 | - if custom: |
911 | - title = self.custom_partitioning_title.get_text() |
912 | - elif resize: |
913 | - title = self.resize_use_free_title.get_text() |
914 | - elif use_device: |
915 | - title = self.use_device_title.get_text() |
916 | - self.controller._wizard.page_title.set_markup( |
917 | - '<span size="xx-large">%s</span>' % title) |
918 | - |
919 | - if resize and 'wubi' in self.extra_options: |
920 | - self.configure_wubi_and_reboot() |
921 | - return True |
922 | - elif resize: |
923 | - m = self.part_auto_select_drive.get_model() |
924 | - m.clear() |
925 | + if resize: |
926 | + self.set_page_title(self.resize_use_free_title.get_text()) |
927 | + if 'wubi' in self.extra_options: |
928 | + self.configure_wubi_and_reboot() |
929 | + return True |
930 | extra_resize = self.extra_options['resize'] |
931 | disk_ids = list(extra_resize.keys()) |
932 | - disks = self.extra_options['use_device'][1] |
933 | # FIXME: perhaps it makes more sense to store the disk |
934 | # description. |
935 | for disk in disks: |
936 | @@ -325,32 +385,21 @@ |
937 | misc.format_size(part_size - min_size)]) |
938 | self.part_auto_select_drive.set_active(0) |
939 | self.initialize_resize_mode() |
940 | - elif use_device: |
941 | - m = self.part_auto_select_drive.get_model() |
942 | - m.clear() |
943 | - for disk in self.extra_options['use_device'][1]: |
944 | - m.append([disk, '']) |
945 | - self.part_auto_select_drive.set_active(0) |
946 | + |
947 | + if use_device: |
948 | + self.set_page_title(self.use_device_title.get_text()) |
949 | self.initialize_use_disk_mode() |
950 | |
951 | - if not custom: |
952 | - self.current_page = self.page_auto |
953 | - self.controller.go_to_page(self.current_page) |
954 | - self.controller.toggle_next_button('install_button') |
955 | - self.plugin_is_install = True |
956 | - return True |
957 | - else: |
958 | - self.current_page = self.page_advanced |
959 | - self.controller.go_to_page(self.current_page) |
960 | - self.controller.toggle_next_button('install_button') |
961 | - self.plugin_is_install = True |
962 | - return False |
963 | - else: |
964 | - # Return control to partman, which will call |
965 | - # get_autopartition_choice and start partitioninging the device. |
966 | - if not custom: |
967 | - self.controller.switch_to_install_interface() |
968 | - return False |
969 | + self.current_page = self.page_auto |
970 | + self.controller.go_to_page(self.current_page) |
971 | + self.controller.toggle_next_button('install_button') |
972 | + self.plugin_is_install = True |
973 | + return True |
974 | + |
975 | + # Return control to partman, which will call |
976 | + # get_autopartition_choice and start partitioninging the device. |
977 | + self.controller.switch_to_install_interface() |
978 | + return False |
979 | |
980 | def plugin_on_back_clicked(self): |
981 | if self.current_page == self.page_auto: |
982 | @@ -405,15 +454,6 @@ |
983 | hidden = self.controller.get_string('part_auto_hidden_label') |
984 | self.part_auto_hidden_label.set_markup(hidden % partition_count) |
985 | |
986 | - def set_part_auto_recipes(self): |
987 | - '''Shows experimental LVM option. TODO actually |
988 | - check the available options from partman. ''' |
989 | - |
990 | - if 'UBIQUITY_PARTAUTO_LVM' in os.environ: |
991 | - self.vbox_part_auto_recipes.show_all() |
992 | - else: |
993 | - self.vbox_part_auto_recipes.hide() |
994 | - |
995 | def part_ask_option_is_install(self): |
996 | if (self.reuse_partition.get_active() or |
997 | self.replace_partition.get_active()): |
998 | @@ -437,6 +477,11 @@ |
999 | self.controller.toggle_next_button() |
1000 | self.plugin_is_install = about_to_install |
1001 | |
1002 | + # Supporting crypto and lvm in new installs only for now |
1003 | + use_device = self.use_device.get_active() |
1004 | + self.use_lvm.set_sensitive(use_device) |
1005 | + self.use_crypto.set_sensitive(use_device) |
1006 | + |
1007 | def initialize_resize_mode(self): |
1008 | disk_id = self.get_current_disk_partman_id() |
1009 | if not disk_id: |
1010 | @@ -532,7 +577,6 @@ |
1011 | |
1012 | def part_auto_select_drive_changed(self, unused_widget): |
1013 | self.set_part_auto_hidden_label() |
1014 | - self.set_part_auto_recipes() |
1015 | disk_id = self.get_current_disk_partman_id() |
1016 | if not disk_id: |
1017 | return |
1018 | @@ -581,46 +625,56 @@ |
1019 | def set_autopartition_options(self, options, extra_options): |
1020 | # TODO Need to select a radio button when resize isn't around. |
1021 | self.extra_options = extra_options |
1022 | - |
1023 | fmt = '<span size="small">%s</span>' |
1024 | - self.use_device_title.set_label(options['use_device'].title) |
1025 | - self.use_device_desc.set_markup(fmt % options['use_device'].desc) |
1026 | - # To give a nice text effect. |
1027 | - self.use_device_desc.set_sensitive(False) |
1028 | - self.custom_partitioning_title.set_label(options['manual'].title) |
1029 | - self.custom_partitioning_desc.set_markup(fmt % options['manual'].desc) |
1030 | - self.custom_partitioning_desc.set_sensitive(False) |
1031 | - |
1032 | - if 'replace' in options: |
1033 | - self.replace_partition.show() |
1034 | - self.replace_partition_title.set_label(options['replace'].title) |
1035 | - self.replace_partition_desc.set_markup( |
1036 | - fmt % options['replace'].desc) |
1037 | - self.replace_partition_desc.set_sensitive(False) |
1038 | - else: |
1039 | - self.replace_partition.hide() |
1040 | - |
1041 | - if 'reuse' in options: |
1042 | - self.reuse_partition.show() |
1043 | - self.reuse_partition_title.set_markup(options['reuse'].title) |
1044 | - self.reuse_partition_desc.set_markup(fmt % options['reuse'].desc) |
1045 | - self.reuse_partition_desc.set_sensitive(False) |
1046 | - else: |
1047 | - self.reuse_partition.hide() |
1048 | - |
1049 | - if 'resize' in options: |
1050 | - self.resize_use_free.show() |
1051 | - self.resize_use_free_title.set_label(options['resize'].title) |
1052 | - self.resize_use_free_desc.set_markup(fmt % options['resize'].desc) |
1053 | - self.resize_use_free_desc.set_sensitive(False) |
1054 | - else: |
1055 | - self.resize_use_free.hide() |
1056 | - |
1057 | - for opt in (self.resize_use_free, self.reuse_partition, |
1058 | - self.replace_partition, self.use_device): |
1059 | - if opt.get_property('visible'): |
1060 | - opt.set_active(True) |
1061 | - break |
1062 | + option_to_widget = OrderedDict({ |
1063 | + "resize": "resize_use_free", |
1064 | + "reuse": "reuse_partition", |
1065 | + "replace": "replace_partition", |
1066 | + "use_device": "use_device", |
1067 | + "manual": "custom_partitioning", |
1068 | + "some_device_crypto": "use_crypto", |
1069 | + "some_device_lvm": "use_lvm", |
1070 | + }) |
1071 | + |
1072 | + if 'some_device_crypto' in extra_options: |
1073 | + title = self.controller.get_string( |
1074 | + 'ubiquity/text/use_crypto_title') |
1075 | + desc = self.controller.get_string('ubiquity/text/use_crypto_desc') |
1076 | + options['some_device_crypto'] = PartitioningOption(title, desc) |
1077 | + |
1078 | + if 'some_device_lvm' in extra_options: |
1079 | + title = self.controller.get_string('ubiquity/text/use_lvm_title') |
1080 | + desc = self.controller.get_string('ubiquity/text/use_lvm_desc') |
1081 | + options['some_device_lvm'] = PartitioningOption(title, desc) |
1082 | + |
1083 | + for option in option_to_widget: |
1084 | + name = option_to_widget[option] |
1085 | + opt_widget = getattr(self, name) |
1086 | + opt_title = getattr(self, name + '_title') |
1087 | + opt_desc = getattr(self, name + '_desc') |
1088 | + |
1089 | + if option in options: |
1090 | + opt_widget.show() |
1091 | + opt_title.set_label(options[option].title) |
1092 | + opt_desc.set_markup(fmt % options[option].desc) |
1093 | + opt_desc.set_sensitive(False) |
1094 | + else: |
1095 | + opt_widget.hide() |
1096 | + |
1097 | + # dmitrij.ledkov 2012-07-23: Hide LVM from the UI, until |
1098 | + # we design user-friendly way of expressing this, or we |
1099 | + # switch to lvm installs by default.... |
1100 | + if option == 'some_device_lvm': |
1101 | + if 'UBIQUITY_PARTAUTO_LVM' in os.environ: |
1102 | + opt_widget.show() |
1103 | + else: |
1104 | + opt_widget.hide() |
1105 | + |
1106 | + if option == 'some_device_crypto': |
1107 | + if 'UBIQUITY_PARTAUTO_CRYPTO' in os.environ: |
1108 | + opt_widget.show() |
1109 | + else: |
1110 | + opt_widget.hide() |
1111 | |
1112 | # Process the default selection |
1113 | self.part_ask_option_changed(None) |
1114 | @@ -649,15 +703,20 @@ |
1115 | |
1116 | elif self.use_device.get_active(): |
1117 | def choose_recipe(): |
1118 | - # TODO dmitrij.ledkov 2012-07-10: To be extended with |
1119 | - # other complex recipes, e.g. stacking crypt & raid. |
1120 | + # TODO dmitrij.ledkov 2012-07-23: RAID recipe? |
1121 | |
1122 | have_lvm = 'some_device_lvm' in self.extra_options |
1123 | - |
1124 | - if 'UBIQUITY_PARTAUTO_LVM' not in os.environ or not have_lvm: |
1125 | + want_lvm = self.use_lvm.get_active() |
1126 | + |
1127 | + have_crypto = 'some_device_crypto' in self.extra_options |
1128 | + want_crypto = self.use_crypto.get_active() |
1129 | + |
1130 | + if not ((want_crypto and have_crypto) or |
1131 | + (want_lvm and have_lvm)): |
1132 | return self.extra_options['use_device'][0] |
1133 | |
1134 | - want_lvm = self.part_auto_use_lvm_checkbox.get_active() |
1135 | + if want_crypto: |
1136 | + return self.extra_options['some_device_crypto'] |
1137 | |
1138 | if want_lvm: |
1139 | return self.extra_options['some_device_lvm'] |
1140 | @@ -1379,6 +1438,25 @@ |
1141 | self.part_advanced_warning_message.set_text(message) |
1142 | self.part_advanced_warning_hbox.show_all() |
1143 | |
1144 | + # Crypto Page |
1145 | + def info_loop(self, unused_widget): |
1146 | + complete = validation.gtk_password_validate( |
1147 | + self.controller, |
1148 | + self.auto_password, |
1149 | + self.auto_verified_password, |
1150 | + self.password_ok, |
1151 | + self.password_error_label, |
1152 | + self.password_strength |
1153 | + ) |
1154 | + self.controller.allow_go_forward(complete) |
1155 | + return complete |
1156 | + |
1157 | + def get_crypto_keys(self): |
1158 | + if self.info_loop(None): |
1159 | + return self.auto_password.get_text() |
1160 | + else: |
1161 | + return False |
1162 | + |
1163 | |
1164 | class PageKde(PageBase): |
1165 | plugin_breadcrumb = 'ubiquity/text/breadcrumb_partition' |
1166 | @@ -1530,7 +1608,10 @@ |
1167 | '^partman/confirm.*', |
1168 | '^partman/free_space$', |
1169 | '^partman/active_partition$', |
1170 | + '^partman-crypto/passphrase.*', |
1171 | + '^partman-crypto/weak_passphrase$', |
1172 | '^partman-lvm/confirm.*', |
1173 | + '^partman-lvm/device_remove_lvm', |
1174 | '^partman-partitioning/new_partition_(size|type|place)$', |
1175 | '^partman-target/choose_method$', |
1176 | '^partman-basicfilesystems/' |
1177 | @@ -1996,6 +2077,7 @@ |
1178 | resize_option = ('resize' in self.extra_options or |
1179 | 'biggest_free' in self.extra_options) |
1180 | |
1181 | + # Irrespective of os_counts |
1182 | # We always have the manual partitioner, and it always has the same |
1183 | # title and description. |
1184 | q = 'ubiquity/partitioner/advanced' |
1185 | @@ -2129,6 +2211,10 @@ |
1186 | self.description('partman-auto/text/resize_use_free') |
1187 | self.manual_desc = \ |
1188 | self.description('partman-auto/text/custom_partitioning') |
1189 | + self.some_device_lvm_desc = \ |
1190 | + self.description('partman-auto-lvm/text/choice') |
1191 | + self.some_device_crypto_desc = \ |
1192 | + self.description('partman-auto-crypto/text/choice') |
1193 | self.extra_options = {} |
1194 | if choices: |
1195 | self.auto_state = [0, None] |
1196 | @@ -2249,6 +2335,18 @@ |
1197 | for option in replace: |
1198 | self.extra_options['replace'].append(option[2]) |
1199 | |
1200 | + some_device_lvm = self.find_script(menu_options, |
1201 | + 'some_device_lvm') |
1202 | + if some_device_lvm: |
1203 | + self.extra_options['some_device_lvm'] = \ |
1204 | + self.some_device_lvm_desc |
1205 | + |
1206 | + some_device_crypto = self.find_script(menu_options, |
1207 | + 'some_device_crypto') |
1208 | + if some_device_crypto: |
1209 | + self.extra_options['some_device_crypto'] = \ |
1210 | + self.some_device_crypto_desc |
1211 | + |
1212 | # We always have the manual option. |
1213 | self.extra_options['manual'] = self.manual_desc |
1214 | self.ui.set_disk_layout(layout) |
1215 | @@ -2910,6 +3008,22 @@ |
1216 | else: |
1217 | raise AssertionError("Arrived at %s unexpectedly" % question) |
1218 | |
1219 | + elif question.startswith('partman-lvm/confirm') or \ |
1220 | + question == 'partman-lvm/device_remove_lvm': |
1221 | + self.preseed_bool(question, True, seen=False) |
1222 | + self.succeeded = True |
1223 | + return True |
1224 | + |
1225 | + elif question == 'partman-crypto/weak_passphrase': |
1226 | + self.preseed_bool(question, True, seen=False) |
1227 | + return True |
1228 | + |
1229 | + elif question.startswith('partman-crypto/passphrase'): |
1230 | + if not self.ui.get_crypto_keys(): |
1231 | + return False |
1232 | + self.preseed(question, self.ui.get_crypto_keys()) |
1233 | + return True |
1234 | + |
1235 | elif question.startswith('partman/confirm'): |
1236 | self.db.set('ubiquity/partman-confirm', question[8:]) |
1237 | self.preseed(question, 'true', seen=False) |
1238 | |
1239 | === modified file 'ubiquity/plugins/ubi-usersetup.py' |
1240 | --- ubiquity/plugins/ubi-usersetup.py 2012-07-16 14:29:13 +0000 |
1241 | +++ ubiquity/plugins/ubi-usersetup.py 2012-08-01 15:23:23 +0000 |
1242 | @@ -369,40 +369,17 @@ |
1243 | self.username_error_label.hide() |
1244 | complete = False |
1245 | |
1246 | - passw = self.password.get_text() |
1247 | - vpassw = self.verified_password.get_text() |
1248 | - allow_empty = self.allow_password_empty |
1249 | - if passw != vpassw: |
1250 | - complete = False |
1251 | - self.password_ok.hide() |
1252 | - if passw and (len(vpassw) / float(len(passw)) > 0.8): |
1253 | - # TODO Cache, use a custom string. |
1254 | - txt = self.controller.get_string( |
1255 | - 'ubiquity/text/password_mismatch') |
1256 | - txt = ( |
1257 | - '<small>' |
1258 | - '<span foreground="darkred"><b>%s</b></span>' |
1259 | - '</small>' % txt) |
1260 | - self.password_error_label.set_markup(txt) |
1261 | - self.password_error_label.show() |
1262 | - else: |
1263 | - self.password_error_label.hide() |
1264 | + password_ok = validation.gtk_password_validate( |
1265 | + self.controller, |
1266 | + self.password, |
1267 | + self.verified_password, |
1268 | + self.password_ok, |
1269 | + self.password_error_label, |
1270 | + self.password_strength, |
1271 | + self.allow_password_empty, |
1272 | + ) |
1273 | |
1274 | - if allow_empty: |
1275 | - self.password_strength.hide() |
1276 | - elif not passw: |
1277 | - self.password_strength.hide() |
1278 | - complete = False |
1279 | - else: |
1280 | - (txt, color) = validation.human_password_strength(passw) |
1281 | - # TODO Cache |
1282 | - txt = self.controller.get_string('ubiquity/text/password/' + txt) |
1283 | - txt = '<small><span foreground="%s"><b>%s</b></span></small>' \ |
1284 | - % (color, txt) |
1285 | - self.password_strength.set_markup(txt) |
1286 | - self.password_strength.show() |
1287 | - if passw == vpassw: |
1288 | - self.password_ok.show() |
1289 | + complete = complete and password_ok |
1290 | |
1291 | txt = self.hostname.get_text() |
1292 | self.hostname_ok.show() |
1293 | |
1294 | === modified file 'ubiquity/validation.py' |
1295 | --- ubiquity/validation.py 2012-07-16 14:29:13 +0000 |
1296 | +++ ubiquity/validation.py 2012-08-01 15:23:23 +0000 |
1297 | @@ -140,3 +140,51 @@ |
1298 | hint = 'strong' |
1299 | color = 'darkgreen' |
1300 | return (hint, color) |
1301 | + |
1302 | + |
1303 | +# TODO dmitrij.ledkov 2012-07-23: factor-out further into generic |
1304 | +# page/pagegtk/pagekde sub-widget |
1305 | +def gtk_password_validate(controller, |
1306 | + password, |
1307 | + verified_password, |
1308 | + password_ok, |
1309 | + password_error_label, |
1310 | + password_strength, |
1311 | + allow_empty=False, |
1312 | + ): |
1313 | + complete = True |
1314 | + passw = password.get_text() |
1315 | + vpassw = verified_password.get_text() |
1316 | + if passw != vpassw: |
1317 | + complete = False |
1318 | + password_ok.hide() |
1319 | + if passw and (len(vpassw) / float(len(passw)) > 0.8): |
1320 | + # TODO Cache, use a custom string. |
1321 | + txt = controller.get_string( |
1322 | + 'ubiquity/text/password_mismatch') |
1323 | + txt = ( |
1324 | + '<small>' |
1325 | + '<span foreground="darkred"><b>%s</b></span>' |
1326 | + '</small>' % txt) |
1327 | + password_error_label.set_markup(txt) |
1328 | + password_error_label.show() |
1329 | + else: |
1330 | + password_error_label.hide() |
1331 | + |
1332 | + if allow_empty: |
1333 | + password_strength.hide() |
1334 | + elif not passw: |
1335 | + password_strength.hide() |
1336 | + complete = False |
1337 | + else: |
1338 | + (txt, color) = human_password_strength(passw) |
1339 | + # TODO Cache |
1340 | + txt = controller.get_string('ubiquity/text/password/' + txt) |
1341 | + txt = '<small><span foreground="%s"><b>%s</b></span></small>' \ |
1342 | + % (color, txt) |
1343 | + password_strength.set_markup(txt) |
1344 | + password_strength.show() |
1345 | + if passw == vpassw: |
1346 | + password_ok.show() |
1347 | + |
1348 | + return complete |
This merge proposal depends on: /code.launchpad .net/~dmitrij. ledkov/ partman- crypto/ finish. d/+merge/ 117657
https:/
The resulting installation:
- boots in KVM using the recovery option
- fails to boot 'normally' in KVM
- untested on bare metal