Merge ~seb128/ubiquity:remove-zfs-option into ubiquity:master

Proposed by Sebastien Bacher
Status: Rejected
Rejected by: Sebastien Bacher
Proposed branch: ~seb128/ubiquity:remove-zfs-option
Merge into: ubiquity:master
Diff against target: 1376 lines (+97/-1055)
8 files modified
debian/ubiquity.templates (+0/-61)
dev/null (+0/-625)
gui/gtk/stepPartAsk.ui (+82/-208)
gui/gtk/ubiquity.ui (+0/-1)
scripts/plugininstall.py (+0/-9)
tests/test_gtkui.py (+0/-3)
ubiquity/frontend/gtk_ui.py (+0/-11)
ubiquity/plugins/ubi-partman.py (+15/-137)
Reviewer Review Type Date Requested Status
Jean-Baptiste Lallement Pending
Ubuntu Installer Team Pending
Review via email: mp+417752@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

closing for now, seems we want to consider the change a bit more before pushing forward

Unmerged commits

9f08a3f... by Sebastien Bacher

Remove the experimental zfs option

Due to priority changes zsys hasn't gotten much work over the recent cycles
and we that's not an option we want to advertise for the incoming LTS

And go back to the old layout listing directly the lvm and encryption
checkboxes on the mainpage instead of in a separate dialog.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/ubiquity.templates b/debian/ubiquity.templates
2index 16ee032..ec9423d 100644
3--- a/debian/ubiquity.templates
4+++ b/debian/ubiquity.templates
5@@ -1473,58 +1473,6 @@ Type: text
6 _Description:
7 This will set up Logical Volume Management. It allows taking snapshots and easier partition resizing.
8
9-Template: ubiquity/text/use_zfs
10-Type: text
11-_Description:
12- Erase disk and use ZFS
13-
14-Template: ubiquity/text/use_zfs_desc
15-Type: text
16-_Description:
17- <span foreground="darkred">Warning:</span> This will delete all your files on all operating systems.
18-
19-Template: ubiquity/use_zfs
20-Type: boolean
21-Default: false
22-Description: for internal use; can be preseeded
23- This will set up ZFS and configure it for zsys.
24-
25-Template: ubiquity/text/advanced_features_dialog
26-Type: text
27-_Description: Advanced Features
28-
29-Template: ubiquity/text/advanced_features_radio_none
30-Type: text
31-_Description: None
32-
33-Template: ubiquity/text/advanced_features_desc
34-Type: text
35-_Description: None selected
36-
37-Template: ubiquity/text/advanced_features_selected
38-Type: text
39-_Description: Advanced features...
40-
41-Template: ubiquity/text/advanced_features_none_selected
42-Type: text
43-_Description: None selected
44-
45-Template: ubiquity/text/advanced_features_lvm_selected
46-Type: text
47-_Description: LVM selected
48-
49-Template: ubiquity/text/advanced_features_lvm_crypto_selected
50-Type: text
51-_Description: LVM and encryption selected
52-
53-Template: ubiquity/text/advanced_features_zfs_selected
54-Type: text
55-_Description: ZFS selected
56-
57-Template: ubiquity/text/advanced_features_zfs_crypto_selected
58-Type: text
59-_Description: ZFS and encryption selected
60-
61 Template: ubiquity/text/verified_crypto_label
62 Type: text
63 _Description:
64@@ -1642,15 +1590,6 @@ Template: ubiquity/secureboot_key
65 Type: password
66 _Description: SecureBoot key for MokPW
67
68-Template: ubiquity/text/partman_confirm_zfs
69-Type: text
70-_Description:
71- partition #%(partid)s as %(parttype)s used for %(partusage)s
72-
73-Template: ubiquity/zfs_keystore_key
74-Type: password
75-_Description: Key to secure the keystore on ZFS installations
76-
77 Template: ubiquity/login_use_directory
78 Type: text
79 _Description: Authenticate against a directory
80diff --git a/gui/gtk/stepPartAsk.ui b/gui/gtk/stepPartAsk.ui
81index 8159d06..93a405e 100644
82--- a/gui/gtk/stepPartAsk.ui
83+++ b/gui/gtk/stepPartAsk.ui
84@@ -1,168 +1,6 @@
85 <?xml version="1.0" encoding="UTF-8"?>
86 <interface>
87 <!-- interface-requires gtk+ 3.0 -->
88- <object class="GtkDialog" id="advanced_features_dialog">
89- <property name="can_focus">False</property>
90- <property name="title" translatable="yes">Advanced Features</property>
91- <property name="resizable">False</property>
92- <property name="modal">True</property>
93- <property name="window_position">center-on-parent</property>
94- <property name="type_hint">dialog</property>
95- <child internal-child="vbox">
96- <object class="GtkBox" id="advanced_features_box1">
97- <property name="can_focus">False</property>
98- <property name="orientation">vertical</property>
99- <property name="spacing">24</property>
100- <child internal-child="action_area">
101- <object class="GtkButtonBox" id="advanced_features_buttonbox">
102- <property name="can_focus">False</property>
103- <property name="layout_style">end</property>
104- <child>
105- <object class="GtkButton" id="advanced_features_cancelbutton">
106- <property name="label">_Cancel</property>
107- <property name="use_action_appearance">False</property>
108- <property name="visible">True</property>
109- <property name="can_focus">True</property>
110- <property name="can_default">True</property>
111- <property name="receives_default">True</property>
112- <property name="use_underline">True</property>
113- </object>
114- <packing>
115- <property name="expand">False</property>
116- <property name="fill">False</property>
117- <property name="position">0</property>
118- </packing>
119- </child>
120- <child>
121- <object class="GtkButton" id="advanced_features_okbutton">
122- <property name="label">_OK</property>
123- <property name="use_action_appearance">False</property>
124- <property name="visible">True</property>
125- <property name="can_focus">True</property>
126- <property name="can_default">True</property>
127- <property name="has_default">True</property>
128- <property name="receives_default">True</property>
129- <property name="use_underline">True</property>
130- </object>
131- <packing>
132- <property name="expand">False</property>
133- <property name="fill">False</property>
134- <property name="position">1</property>
135- </packing>
136- </child>
137- </object>
138- <packing>
139- <property name="expand">False</property>
140- <property name="fill">False</property>
141- <property name="position">0</property>
142- </packing>
143- </child>
144- <child>
145- <object class="GtkBox" id="advanced_features_box2">
146- <property name="visible">True</property>
147- <property name="can_focus">False</property>
148- <property name="orientation">vertical</property>
149- <child>
150- <object class="GtkRadioButton" id="advanced_features_radio_none">
151- <property name="label" translatable="yes">None</property>
152- <property name="visible">True</property>
153- <property name="can_focus">True</property>
154- <property name="receives_default">True</property>
155- <property name="active">True</property>
156- <property name="draw_indicator">True</property>
157- <property name="margin_top">9</property>
158- <signal name="clicked" handler="advanced_features_option_changed" swapped="no"/>
159- </object>
160- <packing>
161- <property name="expand">False</property>
162- <property name="fill">True</property>
163- <property name="position">0</property>
164- </packing>
165- </child>
166- <child>
167- <object class="GtkRadioButton" id="use_lvm">
168- <property name="label" translatable="yes">Set up the system as an LVM volume group</property>
169- <property name="visible">True</property>
170- <property name="can_focus">True</property>
171- <property name="receives_default">False</property>
172- <property name="active">True</property>
173- <property name="draw_indicator">True</property>
174- <property name="margin_top">9</property>
175- <property name="group">advanced_features_radio_none</property>
176- <signal name="clicked" handler="advanced_features_option_changed" swapped="no"/>
177- </object>
178- <packing>
179- <property name="expand">False</property>
180- <property name="fill">True</property>
181- <property name="position">1</property>
182- </packing>
183- </child>
184- <child>
185- <object class="GtkRadioButton" id="use_zfs">
186- <property name="label" translatable="yes">Use ZFS</property>
187- <property name="visible">True</property>
188- <property name="can_focus">True</property>
189- <property name="receives_default">False</property>
190- <property name="active">True</property>
191- <property name="draw_indicator">True</property>
192- <property name="margin_top">9</property>
193- <property name="group">advanced_features_radio_none</property>
194- <signal name="clicked" handler="advanced_features_option_changed" swapped="no"/>
195- </object>
196- <packing>
197- <property name="expand">False</property>
198- <property name="fill">True</property>
199- <property name="position">2</property>
200- </packing>
201- </child>
202- <child>
203- <object class="GtkCheckButton" id="use_crypto">
204- <property name="label" translatable="yes">Encrypt the volume group for security</property>
205- <property name="visible">True</property>
206- <property name="sensitive">False</property>
207- <property name="can_focus">True</property>
208- <property name="receives_default">False</property>
209- <property name="margin_top">9</property>
210- <property name="draw_indicator">True</property>
211- </object>
212- <packing>
213- <property name="expand">False</property>
214- <property name="fill">True</property>
215- <property name="position">3</property>
216- </packing>
217- </child>
218- <child>
219- <object class="GtkLabel" id="use_crypto_desc">
220- <property name="visible">True</property>
221- <property name="sensitive">False</property>
222- <property name="can_focus">False</property>
223- <property name="xalign">0</property>
224- <property name="yalign">0</property>
225- <property name="use_markup">True</property>
226- <property name="wrap">True</property>
227- <property name="label" translatable="yes">&lt;span size="small"&gt;You'll choose a security key in the next step&lt;/span&gt;</property>
228- </object>
229- <packing>
230- <property name="expand">False</property>
231- <property name="fill">True</property>
232- <property name="position">4</property>
233- </packing>
234- </child>
235- </object>
236- <packing>
237- <property name="expand">False</property>
238- <property name="fill">True</property>
239- <property name="position">1</property>
240- </packing>
241- </child>
242- </object>
243- </child>
244- <action-widgets>
245- <action-widget response="-6">advanced_features_cancelbutton</action-widget>
246- <action-widget response="-5">advanced_features_okbutton</action-widget>
247- </action-widgets>
248- </object>
249-
250 <object class="GtkAlignment" id="stepPartAsk">
251 <property name="visible">True</property>
252 <property name="can_focus">False</property>
253@@ -347,63 +185,99 @@
254 <property name="height">1</property>
255 </packing>
256 </child>
257-
258 <child>
259- <object class="GtkBox" id="gtkbox1">
260+ <object class="GtkLabel" id="use_crypto_desc">
261 <property name="visible">True</property>
262 <property name="can_focus">False</property>
263+ <property name="margin_left">24</property>
264+ <property name="xalign">0</property>
265+ <property name="yalign">0</property>
266+ <property name="label" translatable="yes">&lt;span size="small"&gt;You’ll choose a security key in the next step.&lt;/span&gt;</property>
267+ <property name="use_markup">True</property>
268+ <property name="wrap">True</property>
269+ </object>
270+ <packing>
271+ <property name="left_attach">0</property>
272+ <property name="top_attach">9</property>
273+ <property name="width">1</property>
274+ <property name="height">1</property>
275+ </packing>
276+ </child>
277+ <child>
278+ <object class="GtkCheckButton" id="use_crypto">
279+ <property name="label" translatable="yes">Encrypt the new Ubuntu installation for security</property>
280+ <property name="visible">True</property>
281+ <property name="can_focus">True</property>
282+ <property name="receives_default">False</property>
283+ <property name="margin_top">21</property>
284+ <property name="xalign">0</property>
285+ <property name="draw_indicator">True</property>
286+ <signal name="clicked" handler="on_crypto_lvm_toggled" swapped="no"/>
287+ </object>
288+ <packing>
289+ <property name="left_attach">0</property>
290+ <property name="top_attach">8</property>
291+ <property name="width">1</property>
292+ <property name="height">1</property>
293+ </packing>
294+ </child>
295+ <child>
296+ <object class="GtkLabel" id="use_lvm_desc">
297+ <property name="visible">True</property>
298+ <property name="can_focus">False</property>
299+ <property name="margin_left">24</property>
300+ <property name="xalign">0</property>
301+ <property name="yalign">0</property>
302+ <property name="label" translatable="yes">&lt;span size="small"&gt;This will set up Logical Volume Management. It allows taking snapshots and easier partition resizing.&lt;/span&gt;</property>
303+ <property name="use_markup">True</property>
304+ <property name="wrap">True</property>
305+ </object>
306+ <packing>
307+ <property name="left_attach">0</property>
308+ <property name="top_attach">11</property>
309+ <property name="width">1</property>
310+ <property name="height">1</property>
311+ </packing>
312+ </child>
313+ <child>
314+ <object class="GtkCheckButton" id="use_lvm">
315+ <property name="label" translatable="yes">Use LVM with the new Ubuntu installation</property>
316+ <property name="visible">True</property>
317+ <property name="can_focus">True</property>
318+ <property name="receives_default">False</property>
319+ <property name="margin_top">9</property>
320+ <property name="xalign">0</property>
321+ <property name="draw_indicator">True</property>
322+ <signal name="clicked" handler="on_crypto_lvm_toggled" swapped="no"/>
323+ </object>
324+ <packing>
325+ <property name="left_attach">0</property>
326+ <property name="top_attach">10</property>
327+ <property name="width">1</property>
328+ <property name="height">1</property>
329+ </packing>
330+ </child>
331+ <child>
332+ <object class="GtkAlignment" id="alignment2">
333+ <property name="visible">True</property>
334+ <property name="can_focus">False</property>
335+ <property name="margin_top">15</property>
336+ <property name="left_padding">25</property>
337+ <property name="right_padding">25</property>
338 <child>
339- <object class="GtkButton" id="advanced_features_button">
340- <property name="visible">True</property>
341- <property name="can_focus">True</property>
342- <property name="margin_left">24</property>
343- <property name="receives_default">False</property>
344- <property name="xalign">0</property>
345- <signal name="clicked" handler="on_advanced_features_clicked" swapped="no"/>
346- <child>
347- <object class="GtkLabel" id="advanced_features_selected">
348- <property name="visible">True</property>
349- <property name="can_focus">False</property>
350- <property name="label" translatable="yes">Advanced features...</property>
351- <property name="use_markup">True</property>
352- </object>
353- </child>
354- </object>
355- <packing>
356- <property name="expand">False</property>
357- <property name="fill">True</property>
358- <property name="position">1</property>
359- <property name="left_attach">0</property>
360- <property name="width">1</property>
361- <property name="height">1</property>
362- </packing>
363- </child>
364- <child>
365- <object class="GtkLabel" id="advanced_features_desc">
366+ <object class="GtkHSeparator" id="hseparator1">
367 <property name="visible">True</property>
368 <property name="can_focus">False</property>
369- <property name="label" translatable="yes">None selected</property>
370- <property name="margin_left">9</property>
371 </object>
372- <packing>
373- <property name="expand">False</property>
374- <property name="fill">True</property>
375- <property name="position">1</property>
376- <property name="width">1</property>
377- <property name="height">1</property>
378- </packing>
379 </child>
380 </object>
381 <packing>
382- <property name="expand">False</property>
383- <property name="fill">True</property>
384- <property name="position">2</property>
385 <property name="left_attach">0</property>
386- <property name="top_attach">8</property>
387-
388+ <property name="top_attach">12</property>
389+ <property name="width">1</property>
390+ <property name="height">1</property>
391 </packing>
392 </child>
393-
394 <child>
395 <object class="GtkLabel" id="custom_partitioning_desc">
396 <property name="visible">True</property>
397@@ -417,7 +291,7 @@
398 </object>
399 <packing>
400 <property name="left_attach">0</property>
401- <property name="top_attach">10</property>
402+ <property name="top_attach">14</property>
403 <property name="width">1</property>
404 <property name="height">1</property>
405 </packing>
406@@ -437,7 +311,7 @@
407 </object>
408 <packing>
409 <property name="left_attach">0</property>
410- <property name="top_attach">9</property>
411+ <property name="top_attach">13</property>
412 <property name="width">1</property>
413 <property name="height">1</property>
414 </packing>
415diff --git a/gui/gtk/ubiquity.ui b/gui/gtk/ubiquity.ui
416index 552a1e9..bbdbae8 100644
417--- a/gui/gtk/ubiquity.ui
418+++ b/gui/gtk/ubiquity.ui
419@@ -591,7 +591,6 @@
420 <property name="ypad">6</property>
421 <property name="label" translatable="yes">Installation is complete. You need to restart the computer in order to use the new installation. You can continue to use this live CD, although any changes you make or documents you save will not be preserved.</property>
422 <property name="wrap">True</property>
423- <property name="max-width-chars">50</property>
424 </object>
425 </child>
426 </object>
427diff --git a/scripts/plugininstall.py b/scripts/plugininstall.py
428index d4452a1..17f44fc 100755
429--- a/scripts/plugininstall.py
430+++ b/scripts/plugininstall.py
431@@ -223,9 +223,6 @@ class Install(install_misc.InstallBase):
432 else:
433 self.install_extras()
434
435- # Configure zsys
436- self.configure_zsys()
437-
438 self.next_region()
439 self.db.progress('INFO', 'ubiquity/install/activedirectory')
440 self.configure_active_directory()
441@@ -1004,12 +1001,6 @@ class Install(install_misc.InstallBase):
442 for bind in binds:
443 misc.execute('umount', '-f', self.target + bind)
444
445- def configure_zsys(self):
446- """ Configure zsys """
447- use_zfs = self.db.get('ubiquity/use_zfs')
448- if use_zfs:
449- misc.execute_root('/usr/share/ubiquity/zsys-setup', 'finalize')
450-
451 def configure_active_directory(self):
452 """ Join Active Directory domain and enable pam_mkhomedir """
453 use_directory = self.db.get('ubiquity/login_use_directory')
454diff --git a/scripts/zsys-setup b/scripts/zsys-setup
455deleted file mode 100755
456index e10cf94..0000000
457--- a/scripts/zsys-setup
458+++ /dev/null
459@@ -1,625 +0,0 @@
460-#!/bin/sh
461-
462-#
463-# This script creates ZFS pools and dataset compatible with zsys
464-#
465-
466-# Layout:
467-# bpool/BOOT/ubuntu_${UUID}
468-# rpool/ROOT/ubuntu_${UUID}
469-# rpool/ROOT/ubuntu_${UUID}/var -o canmount=off
470-# rpool/ROOT/ubuntu_${UUID}/var/games
471-# rpool/ROOT/ubuntu_${UUID}/var/lib
472-# rpool/ROOT/ubuntu_${UUID}/var/lib/AccountsService
473-# rpool/ROOT/ubuntu_${UUID}/var/lib/apt
474-# rpool/ROOT/ubuntu_${UUID}/var/lib/dpkg
475-# rpool/ROOT/ubuntu_${UUID}/var/log
476-# rpool/ROOT/ubuntu_${UUID}/var/mail
477-# rpool/ROOT/ubuntu_${UUID}/var/snap
478-# rpool/ROOT/ubuntu_${UUID}/var/spool
479-# rpool/ROOT/ubuntu_${UUID}/var/www
480-# rpool/ROOT/ubuntu_${UUID}/var/lib/NetworkManager
481-# rpool/ROOT/ubuntu_${UUID}/srv
482-# rpool/ROOT/ubuntu_${UUID}/usr -o canmount=off
483-# rpool/ROOT/ubuntu_${UUID}/usr/local
484-# rpool/USERDATA/$user_$UUID2
485-# rpool/USERDATA/root_$UUID2
486-# rpool/keystore
487-#
488-# Steps:
489-# - Verify that /target is mounted
490-# - Retrieve fstab
491-# - unmount /target
492-# - delete all the partitions but the ESP
493-# - Create p1 ext4 size 100MB
494-# - Create p2 zfs bpool 1GB
495-# - Create p3 zfs rbool 100% remaining
496-# - Create datasets
497-# - Create /swapfile on /target
498-#
499-# After setup is done leave it mounted to let Ubiquity proceed with installation
500-
501-set -eu
502-
503-REQUIREDPKGS="zfsutils-linux"
504-TARGET="/target"
505-ESP="${TARGET}/boot/efi"
506-ZSYSTMP="/tmp/$(basename $0)"
507-INIT_FLAG="${ZSYSTMP}/init.done"
508-FSTAB_PARTMAN="${ZSYSTMP}/fstab.partman"
509-PARTITION_LAYOUT="${ZSYSTMP}/layout"
510-KEYSTORE_ROOT="/run/keystore/rpool"
511-KEYSTORE_SIZE="500M"
512-
513-mkdir -p "${ZSYSTMP}"
514-
515-usage() {
516- # Display script usage
517- cat<<EOF
518-Usage: $(basename "$0") [COMMAND] [OPTIONS...]
519- Prepares a zsys compatible ZFS system.
520-
521-Commands:
522- layout Get layout to display before formatting to ubiquity. Give the chosen disk as argument
523- init Initialize the pools and datasets
524- finalize Finalize the installation after the system has been installed
525-Options:
526- -h, --help This help
527- -d, --debug Enable debug mode
528-EOF
529- exit
530-}
531-
532-SHORTOPTS="hd"
533-LONGOPTS="help,debug"
534-
535-TEMP=$(getopt -o $SHORTOPTS --long $LONGOPTS -- "$@")
536-eval set -- "$TEMP"
537-
538-while true ; do
539- case "$1" in
540- -h|--help)
541- usage;;
542- -d|--debug)
543- set -x
544- shift;;
545- --)
546- shift;
547- break;;
548- *)
549- usage;;
550- esac
551-done
552-
553-COMMAND=$( echo $1 | tr '[:upper:]' '[:lower:]' )
554-EXTRAARG=""
555-if [ $# -gt 1 ]; then
556- EXTRAARG="${2}"
557-fi
558-
559-ENCRYPTION=0
560-ZFS_KS_KEY=${ZFS_KS_KEY:-}
561-if [ -n "${ZFS_KS_KEY}" ]; then
562- ENCRYPTION=1
563-fi
564-
565-check_prerequisites() {
566- # Check and set requirements to run this script
567- #
568- # Check and set the requirements to run this test. If any of the
569- # requirement is missing the programs exit with error
570- #
571- # Args:
572- # $@: List of required packages
573- #
574- # Returns
575- # Exit program is a requirement is not met
576- echo "I: Checking system requirements"
577-
578- if [ $(id -u) -ne 0 ]; then
579- echo "E: Script must be executed as root. Exiting!"
580- exit 1
581- fi
582-
583- for pkg in $@; do
584- if ! dpkg-query -W -f'${Status}' "${pkg}"|grep -q "install ok installed" 2>/dev/null; then
585- echo "E: $pkg is required and not installed on this system. Exiting!"
586- exit 1
587- fi
588- done
589-
590-}
591-
592-prepare_target() {
593- target="$1"
594-
595- if ! grep -qE "\s${target}\s" /proc/mounts; then
596- echo "E: $target is not mounted. Exiting!"
597- exit 1
598- fi
599-
600- # Save fstab generated by partman
601- if [ -f "${target}/etc/fstab" ]; then
602- echo "I: Saving existing fstab"
603- cp "${target}/etc/fstab" "${FSTAB_PARTMAN}"
604- else
605- echo "W: ${target}/etc/fstab doesn't exist"
606- fi
607-
608- # umount /target
609- # It may fail to umount because the swap is being created by partman and not finished when we reach this point.
610- # Give it some time and retry with a sleep between tries.
611- iter=0
612- maxiter=10
613-
614- for mountpoint in "${ESP}" "${target}"; do
615- if [ ! -d "${mountpoint}" ]; then
616- continue
617- fi
618-
619- echo "I: umounting ${mountpoint}"
620- while :; do
621- # Do not make it quiet. We want to know why it failed.
622- if ! sudo umount "${mountpoint}"; then
623- iter=$(( iter + 1 ))
624- echo "W: Try ${iter}. Failed to umount ${mountpoint}."
625- if [ ${iter} -eq ${maxiter} ]; then
626- echo "E: Failed to umount ${mountpoint}. Exiting!"
627- exit 1
628- fi
629- sleep 3
630- else
631- break
632- fi
633- done
634- done
635-}
636-
637-get_layout() {
638- # Returns disk, base name of the partition and partition numbers to create
639- target="$1"
640- disk="$2"
641-
642- if [ -z "${disk}" ]; then
643- # The entire disk has been formatted with use_device
644- # There is either one ext4 partition or one ext4 and one ESP
645- part="$(grep -E "\s${target}\s" /proc/mounts | awk '{print $1}')"
646- partbase=""
647-
648- if [ -n "${part}" ]; then
649- disk="$(lsblk -lns -o TYPE,PATH ${part}| grep disk| awk '{print $2}')"
650- if [ -z "${disk}" ]; then
651- echo "E: Couldn't identify disk for partition ${part}. Exiting!"
652- exit 1
653- fi
654- # Some disks have letters in the partition number like /dev/nvme0n1p1
655- # In this case we want to retrieve 'p' so we deal only with partition number
656- # in the rest of the script and prepend the base.
657- partbase="$(echo ${part} | sed -e 's/[0-9]*$//' | sed -e "s#${disk}##")"
658- fi
659- else
660- # The only purpose of this code is to display a friendly message in ubiquity to show the user
661- # what partitioning will be performed. However, on first call, the disk is not yet partitioned
662- # and collecting the information about disk partitioning would require to query partman. But we
663- # don't want to add this extra complexity just to display a message. Instead we hardcode the
664- # extension of the partition name depending on the type of disk, basically it's 'p' for anything
665- # else than standard drives (eg nvme01pX)
666- case "${disk}" in
667- /dev/sd*|/dev/hd*|/dev/vd*)
668- partbase=""
669- ;;
670- *)
671- partbase="p"
672- esac
673- fi
674-
675- if [ -d /sys/firmware/efi/efivars ]; then
676- # No extended partition on EFI + GPT
677- # The layout is
678- # 1: ESP
679- # 2: swap
680- # 3: bpool
681- # 4: rpool
682- partesp=1
683- partswap=2
684- partbpool=3
685- partrpool=4
686-
687- # As partman forces now gpt for any installation, we consider that not having efivar equals gpt with BiosBoot (LP: #1796260)
688- else
689- # The layout is:
690- # 1: BiosBoot
691- # 2: ESP
692- # 3: swap
693- # 4: bpool
694- # 5: rpool
695- partesp=2
696- partswap=3
697- partbpool=4
698- partrpool=5
699- fi
700-
701- echo "OK|${disk}|${partbase}|${partesp}|${partswap}|${partbpool}|${partrpool}"
702-}
703-
704-format_disk() {
705- disk="$1"
706- partbase="$2"
707- partesp="$3"
708- partbpool="$4"
709- partrpool="$5"
710- ss="$6"
711- partswap=$(( partbpool - 1 ))
712- partprefix="${disk}${partbase}"
713-
714- sfdisktmp="${ZSYSTMP}/sfdisk.cfg"
715- rm -f "${sfdisktmp}"
716-
717- echo "I: Formatting disk $disk with partitions swap:${partswap} bpool:${partbpool} rpool:${partrpool}"
718-
719- # bpool size: 500M < 5% of ZFS allocated space < 2G
720- # srcpath is the system partition on initial layout.
721- srcpath=$(lsblk -ln -o PATH ${disk}|tail -1)
722- partsrc=${srcpath##*${partprefix}}
723- size_percent=$(expr \( $(blockdev --getsize64 ${srcpath}) / 1024 / 1024 \) \* 5 / 100)
724- bpool_size=500
725- [ ${size_percent} -gt ${bpool_size} ] && bpool_size=${size_percent}
726- [ ${bpool_size} -gt 2048 ] && bpool_size=2048
727-
728- # Improvement: Delete all the partitions but the ESP
729- # There should be only 1 or 2 partitions but it can be made generic
730- if ! esp_exists "${disk}"; then
731- start=$(sfdisk -l "${disk}"|grep "^${partprefix}${partesp}"|awk '{print $2}')
732- cat > "${sfdisktmp}" <<EOF
733-${partprefix}${partesp} : start= ${start}, size= 512M, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, bootable
734-EOF
735- else
736- sfdisk --delete "${disk}" ${partsrc}
737- fi
738-
739- cat >> "${sfdisktmp}" <<EOF
740-${partprefix}${partswap} : size= ${ss}M, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F
741-${partprefix}${partbpool} : size= ${bpool_size}M, type=6A82CB45-1DD2-11B2-99A6-080020736631
742-${partprefix}${partrpool} : type=6A85CF4D-1DD2-11B2-99A6-080020736631
743-EOF
744-
745- cat "${sfdisktmp}" | sfdisk --append --no-reread "${disk}"
746-
747- # Force a re-read of the partition table
748- echo "I: Re-reading partition table"
749- partx --add "${disk}" 2>/dev/null || true
750- partx --show "${disk}"
751-}
752-
753-init_keystore() {
754- keystore_dev="$1"
755- echo "I: Initializing Key Store"
756-
757- if [ ${ENCRYPTION} -eq 1 ]; then
758- mkdir -p "${KEYSTORE_ROOT}"
759- printf "%s" "${ZFS_KS_KEY}" | cryptsetup luksFormat /dev/zvol/${keystore_dev} -
760- printf "%s" "${ZFS_KS_KEY}" | cryptsetup luksOpen /dev/zvol/${keystore_dev} keystore-rpool -
761- mke2fs -t ext4 /dev/mapper/keystore-rpool -L keystore-rpool
762- mount /dev/mapper/keystore-rpool "${KEYSTORE_ROOT}"
763- fi
764-}
765-
766-init_zfs() {
767- target="$1"
768- partbpool="$2"
769- partrpool="$3"
770-
771- echo "I: Initializing ZFS"
772- # Now we can create the pools and dataset
773- UUID_ORIG=$(head -100 /dev/urandom | tr -dc 'a-z0-9' |head -c6)
774-
775- # Use stable uuid for partition when available as device name can change
776- # Let udev finish its job before proceeding with zpool creation
777- udevadm settle
778- bpooluuid=$(blkid -s PARTUUID -o value $partbpool)
779- [ -n "$bpooluuid" -a -e "/dev/disk/by-partuuid/$bpooluuid" ] && partbpool=/dev/disk/by-partuuid/$bpooluuid
780- rpooluuid=$(blkid -s PARTUUID -o value $partrpool)
781- [ -n "$rpooluuid" -a -e "/dev/disk/by-partuuid/$rpooluuid" ] && partrpool=/dev/disk/by-partuuid/$rpooluuid
782-
783- # Pools
784- encrypt_args=""
785- if [ ${ENCRYPTION} -eq 1 ]; then
786- # Creation of the encryption key
787- local ks_system_key="${KEYSTORE_ROOT}/system.key"
788- local ks_system_key_tmp="${ZSYSTMP}/$(basename "${ks_system_key}")"
789- head -c 32 /dev/urandom > "${ks_system_key_tmp}"
790- encrypt_args="-O encryption=on -O keylocation=file://${ks_system_key_tmp} -O keyformat=raw"
791- fi
792-
793- # rpool
794- zpool create -f \
795- -o ashift=12 \
796- -o autotrim=on \
797- -O compression=lz4 \
798- -O acltype=posixacl \
799- -O xattr=sa \
800- -O relatime=on \
801- -O normalization=formD \
802- -O mountpoint=/ \
803- -O canmount=off \
804- -O dnodesize=auto \
805- -O sync=disabled \
806- ${encrypt_args} \
807- -O mountpoint=/ -R "${target}" rpool "${partrpool}"
808-
809- # bpool
810- # The version of bpool is set to the default version to prevent users from upgrading
811- # Then only features supported by grub are enabled.
812- zpool create -f \
813- -o ashift=12 \
814- -o autotrim=on \
815- -d \
816- -o feature@async_destroy=enabled \
817- -o feature@bookmarks=enabled \
818- -o feature@embedded_data=enabled \
819- -o feature@empty_bpobj=enabled \
820- -o feature@enabled_txg=enabled \
821- -o feature@extensible_dataset=enabled \
822- -o feature@filesystem_limits=enabled \
823- -o feature@hole_birth=enabled \
824- -o feature@large_blocks=enabled \
825- -o feature@lz4_compress=enabled \
826- -o feature@spacemap_histogram=enabled \
827- -O compression=lz4 \
828- -O acltype=posixacl \
829- -O xattr=sa \
830- -O relatime=on \
831- -O normalization=formD \
832- -O canmount=off \
833- -O devices=off \
834- -O mountpoint=/boot -R "${target}" bpool "${partbpool}"
835-
836- if [ ${ENCRYPTION} -eq 1 ]; then
837- # Creation of the encryption keystore on the pool directly
838- # and point to the system ZFS decryption key path
839- local keystore_dev="rpool/keystore"
840- zfs create -o encryption=off -V ${KEYSTORE_SIZE} "${keystore_dev}"
841- init_keystore "${keystore_dev}"
842- mv "${ks_system_key_tmp}" "${ks_system_key}"
843- chmod 600 "${ks_system_key}"
844- zfs set keylocation=file://"${ks_system_key}" rpool
845- fi
846-
847- # Root and boot dataset
848- zfs create rpool/ROOT -o canmount=off -o mountpoint=none
849- zfs create "rpool/ROOT/ubuntu_${UUID_ORIG}" -o mountpoint=/
850- zfs create bpool/BOOT -o canmount=off -o mountpoint=none
851- zfs create "bpool/BOOT/ubuntu_${UUID_ORIG}" -o mountpoint=/boot
852-
853- # System dataset
854- zfs create "rpool/ROOT/ubuntu_${UUID_ORIG}/var" -o canmount=off
855- zfs create "rpool/ROOT/ubuntu_${UUID_ORIG}/var/lib"
856- zfs create "rpool/ROOT/ubuntu_${UUID_ORIG}/var/lib/AccountsService"
857- zfs create "rpool/ROOT/ubuntu_${UUID_ORIG}/var/lib/apt"
858- zfs create "rpool/ROOT/ubuntu_${UUID_ORIG}/var/lib/dpkg"
859- zfs create "rpool/ROOT/ubuntu_${UUID_ORIG}/var/lib/NetworkManager"
860-
861- # Desktop specific system dataset
862- zfs create "rpool/ROOT/ubuntu_${UUID_ORIG}/srv"
863- zfs create "rpool/ROOT/ubuntu_${UUID_ORIG}/usr" -o canmount=off
864- zfs create "rpool/ROOT/ubuntu_${UUID_ORIG}/usr/local"
865- zfs create "rpool/ROOT/ubuntu_${UUID_ORIG}/var/games"
866- zfs create "rpool/ROOT/ubuntu_${UUID_ORIG}/var/log"
867- zfs create "rpool/ROOT/ubuntu_${UUID_ORIG}/var/mail"
868- zfs create "rpool/ROOT/ubuntu_${UUID_ORIG}/var/snap"
869- zfs create "rpool/ROOT/ubuntu_${UUID_ORIG}/var/spool"
870- zfs create "rpool/ROOT/ubuntu_${UUID_ORIG}/var/www"
871-
872- # USERDATA datasets
873- # Dataset associated to the user are created by the installer.
874- zfs create rpool/USERDATA -o canmount=off -o mountpoint=/
875-
876- # Set zsys properties
877- zfs set com.ubuntu.zsys:bootfs='yes' "rpool/ROOT/ubuntu_${UUID_ORIG}"
878- zfs set com.ubuntu.zsys:last-used=$(date +%s) "rpool/ROOT/ubuntu_${UUID_ORIG}"
879- zfs set com.ubuntu.zsys:bootfs='no' "rpool/ROOT/ubuntu_${UUID_ORIG}/srv"
880- zfs set com.ubuntu.zsys:bootfs='no' "rpool/ROOT/ubuntu_${UUID_ORIG}/usr"
881- zfs set com.ubuntu.zsys:bootfs='no' "rpool/ROOT/ubuntu_${UUID_ORIG}/var"
882-}
883-
884-move_user () {
885- target="$1"
886- user="$2"
887- userhome="$3"
888- uuid="$4"
889-
890- echo "I: Creating user $user with home $userhome"
891- mv "${target}/${userhome}" "${target}/tmp/home/${user}"
892- zfs create "rpool/USERDATA/${user}_${uuid}" -o canmount=on -o mountpoint=${userhome}
893- chown $(chroot "${target}" id -u ${user}):$(chroot ${target} id -g ${user}) "${target}/${userhome}"
894- rsync -a "${target}/tmp/home/${user}/" "${target}/${userhome}"
895- bootfsdataset=$(grep "\s${target}\s" /proc/mounts | awk '{ print $1 }')
896- zfs set com.ubuntu.zsys:bootfs-datasets="${bootfsdataset}" rpool/USERDATA/${user}_${UUID_ORIG}
897-}
898-
899-init_system_partitions() {
900- target="$1"
901- partefi="$2"
902-
903- # ESP
904- mkdir -p "${target}/boot/efi"
905- mount -t vfat "${partefi}" "${target}/boot/efi"
906- mkdir -p "${target}/boot/efi/grub"
907-
908- echo "I: Mount grub directory"
909- # Finalize grub directory
910- mkdir -p "${target}/boot/grub"
911- mount -o bind "${target}/boot/efi/grub" "${target}/boot/grub"
912-}
913-
914-esp_exists() {
915- parttype="C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
916- sfdisk -d "${1}" | grep -q "type=${parttype}"
917-}
918-
919-check_prerequisites ${REQUIREDPKGS}
920-
921-echo "I: Running $(basename "$0") ${COMMAND}"
922-
923-if [ -z "${COMMAND}" ]; then
924- echo "E: ${COMMAND} is mandatory. Exiting!"
925- exit 1
926-elif [ "${COMMAND}" = "layout" ]; then
927- # Just displays de layout that will be created without any change to the disk.
928- # At this stage we don't know yet the size of the partition that will be created.
929- IFS="|" read ERR DISK PARTBASE PARTESP PARTSWAP PARTBPOOL PARTRPOOL<<EOF
930-$(get_layout ${TARGET} "${EXTRAARG}")
931-EOF
932-
933- if [ "${ERR}" != "OK" ]; then
934- echo "${ERR}"
935- exit 1
936- fi
937-
938- cat > "${PARTITION_LAYOUT}" <<EOF
939-disk:${DISK}
940-EOF
941- if ! esp_exists "${DISK}"; then
942- cat >> "${PARTITION_LAYOUT}" <<EOF
943-part:vfat:ESP:${DISK}${PARTBASE}${PARTESP}
944-EOF
945- fi
946-
947- cat >> "${PARTITION_LAYOUT}" <<EOF
948-part:swap:swap:${DISK}${PARTBASE}${PARTSWAP}
949-part:zfs:bpool:${DISK}${PARTBASE}${PARTBPOOL}
950-part:zfs:rpool:${DISK}${PARTBASE}${PARTRPOOL}
951-EOF
952-
953-elif [ "${COMMAND}" = "init" ]; then
954- rm -f "${INIT_FLAG}"
955-
956- IFS="|" read ERR DISK PARTBASE PARTESP PARTSWAP PARTBPOOL PARTRPOOL<<EOF
957-$(get_layout ${TARGET} "")
958-EOF
959-
960- if [ "${ERR}" != "OK" ]; then
961- echo "${ERR}"
962- exit 1
963- fi
964-
965- echo "I: Partition table before init of ZFS"
966- partx --show "${DISK}"
967-
968- # Swap files are not supported on ZFS, we use a swap partition instead:
969- SWAPFILE="$(grep "^${TARGET}" /proc/swaps | awk '{print $1}')"
970- # Give us a minimum swap partition size of 4MB in case we decide on
971- # no swap, just to keep the partition layout stable:
972- SWAPSIZE=4194304
973-
974- # Disable swap and get the swap volume size:
975- if [ -n "${SWAPFILE}" ]; then
976- SWAPSIZE=$(stat -c%s "${SWAPFILE}")
977- echo "I: Found swapfile with size ${SWAPSIZE}. Disabling"
978- swapoff "${SWAPFILE}"
979- fi
980- # Convert to MiB to align the size on the size of a block
981- SWAPVOLSIZE=$(( SWAPSIZE / 1024 / 1024 ))
982-
983- prepare_target "${TARGET}"
984- format_disk "${DISK}" "${PARTBASE}" "${PARTESP}" "${PARTBPOOL}" "${PARTRPOOL}" "${SWAPVOLSIZE}"
985- init_zfs "${TARGET}" "${DISK}${PARTBASE}${PARTBPOOL}" "${DISK}${PARTBASE}${PARTRPOOL}"
986- init_system_partitions "${TARGET}" "${DISK}${PARTBASE}${PARTESP}"
987-
988- # Generate fstab
989- # $TARGET/etc has been destroyed by the creation of the zfs partitition
990- # Recreate it
991- mkdir -p "${TARGET}/etc"
992- if [ -f "${FSTAB_PARTMAN}" ]; then
993- echo "I: Creating fstab"
994- grep -Ev '\s/\s|/swapfile' "${FSTAB_PARTMAN}" > "${TARGET}/etc/fstab"
995- fi
996-
997- if ! grep -q "boot/efi" "${TARGET}/etc/fstab"; then
998- espuuid=$(blkid -s UUID -o value "${DISK}${PARTBASE}${PARTESP}")
999- echo "UUID=${espuuid}\t/boot/efi\tvfat\tumask=0022,fmask=0022,dmask=0022\t0\t1" >> "${TARGET}/etc/fstab"
1000- fi
1001-
1002- # Bind mount grub from ESP to the expected location
1003- echo "/boot/efi/grub\t/boot/grub\tnone\tdefaults,bind\t0\t0" >> "${TARGET}/etc/fstab"
1004-
1005- if [ -n "${SWAPFILE}" ]; then
1006- swap_device="${DISK}${PARTBASE}${PARTSWAP}"
1007- if [ ${ENCRYPTION} -eq 1 ]; then
1008- # Format swap as Luks
1009- swap_name="cryptoswap"
1010- touch ${ZSYSTMP}/swap.keyfile
1011- cryptsetup -q --key-file=${ZSYSTMP}/swap.keyfile luksFormat "${swap_device}"
1012- cryptsetup -q --key-file=${ZSYSTMP}/swap.keyfile luksOpen "${swap_device}" "${swap_name}"
1013- udevadm settle
1014- orig_swap_device="${swap_device}"
1015- swap_device="/dev/mapper/${swap_name}"
1016-
1017- # Update crypttab
1018- printf "${swap_name}\t${orig_swap_device}\t/dev/urandom\tswap,initramfs" >> "${TARGET}/etc/crypttab"
1019- swap_dev_fstab="${swap_device}"
1020- fi
1021- mkswap -f "${swap_device}"
1022- if [ ${ENCRYPTION} -eq 0 ]; then
1023- # for unencrypted swap, this has to be after mkswap to read the right device id
1024- swap_dev_fstab="UUID=$(blkid -s UUID -o value "${swap_device}")"
1025- fi
1026- printf "${swap_dev_fstab}\tnone\tswap\tsw\t0\t0\n" >> "${TARGET}/etc/fstab"
1027- swapon -v "${swap_device}"
1028- fi
1029- # Make /boot/{grub,efi} world readable
1030- sed -i 's#\(.*boot/efi.*\)umask=0077\(.*\)#\1umask=0022,fmask=0022,dmask=0022\2#' "${TARGET}/etc/fstab"
1031-
1032- echo "I: Marking ZFS utilities to be kept in the target system"
1033- apt-install zfsutils-linux 2>/dev/null
1034- apt-install zfs-initramfs 2>/dev/null
1035- apt-install zsys 2>/dev/null
1036- apt-install cryptsetup 2>/dev/null
1037- apt-install cryptsetup-initramfs 2>/dev/null
1038-
1039- touch "$INIT_FLAG"
1040-elif [ "${COMMAND}" = "finalize" ]; then
1041- if [ ! -f "$INIT_FLAG" ]; then
1042- echo "W: zsys init didn't succeed. Not proceeding with command: ${COMMAND}. Aborting!"
1043- exit 1
1044- fi
1045-
1046- # Activate zfs generator.
1047- # After enabling the generator we should run zfs set canmount=on DATASET
1048- # in the chroot for one dataset of each pool to refresh the zfs cache.
1049- echo "I: Activating zfs generator"
1050-
1051- # Create zpool cache
1052- zpool set cachefile= bpool
1053- zpool set cachefile= rpool
1054- cp /etc/zfs/zpool.cache "${TARGET}/etc/zfs/"
1055- mkdir -p "${TARGET}/etc/zfs/zfs-list.cache"
1056- touch "${TARGET}/etc/zfs/zfs-list.cache/bpool" "${TARGET}/etc/zfs/zfs-list.cache/rpool"
1057-
1058- # Handle userdata
1059- UUID_ORIG=$(head -100 /dev/urandom | tr -dc 'a-z0-9' |head -c6)
1060- mkdir -p "${TARGET}/tmp/home"
1061- for user in ${TARGET}/home/*; do
1062- if [ -d "${user}" ]; then
1063- user="$(basename $user)"
1064- move_user "${TARGET}" "${user}" "/home/${user}" "${UUID_ORIG}"
1065- fi
1066- done
1067-
1068- move_user "${TARGET}" root /root "${UUID_ORIG}"
1069-
1070- echo "I: Changing sync mode of rpool to standard"
1071- zfs set sync=standard rpool
1072-
1073- # Disable resumable device
1074- if [ -b /dev/mapper/cryptoswap ]; then
1075- mkdir -p "${TARGET}/etc/initramfs-tools/conf.d"
1076- echo "RESUME=none" > "${TARGET}/etc/initramfs-tools/conf.d/resume"
1077- chroot "${TARGET}" update-initramfs -u
1078- fi
1079-
1080- echo "I: ZFS setup complete"
1081-else
1082- echo "E: Unknown command: $COMMAND"
1083- exit 1
1084-fi
1085diff --git a/tests/test_gtkui.py b/tests/test_gtkui.py
1086index a33829d..9516746 100644
1087--- a/tests/test_gtkui.py
1088+++ b/tests/test_gtkui.py
1089@@ -104,8 +104,6 @@ class TestFrontend(unittest.TestCase):
1090 'cancelbutton2', 'okbutton2', 'okbutton3',
1091 'partition_dialog_okbutton', 'cancelbutton3',
1092 'grub_fail_okbutton',
1093- 'advanced_features_cancelbutton',
1094- 'advanced_features_okbutton',
1095 # These are calculated and set as the partitioning options are
1096 # being calculated.
1097 'reuse_partition_desc', 'reuse_partition',
1098@@ -113,7 +111,6 @@ class TestFrontend(unittest.TestCase):
1099 'resize_use_free_desc', 'resize_use_free',
1100 'use_device_desc', 'use_device', 'part_ask_heading',
1101 'custom_partitioning_desc', 'custom_partitioning',
1102- 'advanced_features_selected',
1103 # Pulled straight from debconf when the installation medium is
1104 # already mounted.
1105 'part_advanced_warning_message',
1106diff --git a/ubiquity/frontend/gtk_ui.py b/ubiquity/frontend/gtk_ui.py
1107index 77e0cde..7695f04 100644
1108--- a/ubiquity/frontend/gtk_ui.py
1109+++ b/ubiquity/frontend/gtk_ui.py
1110@@ -1752,17 +1752,6 @@ class Wizard(BaseFrontend):
1111 (self.partitioned, self.timezone_set))
1112 return
1113
1114- # Setup zfs layout
1115- use_zfs = self.db.get('ubiquity/use_zfs')
1116- if use_zfs == 'true':
1117- env = os.environ.copy()
1118- zfs_keystore_key = self.db.get('ubiquity/zfs_keystore_key')
1119- if zfs_keystore_key:
1120- os.environ['ZFS_KS_KEY'] = zfs_keystore_key
1121- misc.execute_root('/usr/share/ubiquity/zsys-setup', 'init')
1122- os.environ.clear()
1123- os.environ.update(env)
1124-
1125 syslog.syslog('Starting the installation')
1126
1127 from ubiquity.debconfcommunicator import DebconfCommunicator
1128diff --git a/ubiquity/plugins/ubi-partman.py b/ubiquity/plugins/ubi-partman.py
1129index b9f3d9e..10b783a 100644
1130--- a/ubiquity/plugins/ubi-partman.py
1131+++ b/ubiquity/plugins/ubi-partman.py
1132@@ -324,46 +324,6 @@ class PageGtk(PageBase):
1133 self.recovery_key.set_text(key)
1134 self.verified_recovery_key.set_text(key)
1135
1136- def on_advanced_features_clicked(self, widget):
1137- from gi.repository import Gtk
1138-
1139- # Save current state of advanced features
1140- selected = None
1141- crypto_selected = self.use_crypto.get_active()
1142- for w in (self.advanced_features_radio_none,
1143- self.use_lvm, self.use_zfs):
1144- if w.get_active():
1145- selected = w
1146- break
1147-
1148- # Only show zfs when available
1149- zpool_exists = os.path.exists('/sbin/zpool')
1150- self.use_zfs.set_visible(zpool_exists)
1151-
1152- dlg = self.advanced_features_dialog
1153- dlg.show()
1154- response = dlg.run()
1155- dlg.hide()
1156-
1157- if response == Gtk.ResponseType.OK:
1158- label = ""
1159- if self.advanced_features_radio_none.get_active():
1160- label = self.controller.get_string('advanced_features_none_selected')
1161- elif self.use_lvm.get_active():
1162- label = self.controller.get_string('advanced_features_lvm_selected')
1163- if self.use_crypto.get_active():
1164- label = self.controller.get_string('advanced_features_lvm_crypto_selected')
1165- elif self.use_zfs.get_active():
1166- label = self.controller.get_string('advanced_features_zfs_selected')
1167- if self.use_crypto.get_active():
1168- label = self.controller.get_string('advanced_features_zfs_crypto_selected')
1169- self.advanced_features_desc.set_text(label)
1170- else:
1171- # Restore previous selection
1172- if selected:
1173- selected.set_active(True)
1174- self.use_crypto.set_active(crypto_selected)
1175-
1176 def on_recovery_key_button_clicked(self, widget):
1177 from gi.repository import Gtk
1178 label = self.controller.get_string('recovery_key_filename')
1179@@ -444,9 +404,7 @@ class PageGtk(PageBase):
1180 replace = self.replace_partition.get_active()
1181 resize = self.resize_use_free.get_active()
1182 custom = self.custom_partitioning.get_active()
1183- use_zfs = self.use_zfs.get_active()
1184- # ZFS is installed on entire drive.
1185- use_device = self.use_device.get_active() or use_zfs
1186+ use_device = self.use_device.get_active()
1187 biggest_free = 'biggest_free' in self.extra_options
1188 crypto = self.use_crypto.get_active()
1189 disks = self.extra_options.get('use_device', [])
1190@@ -640,7 +598,7 @@ class PageGtk(PageBase):
1191 elif (self.resize_use_free.get_active() and
1192 'biggest_free' in self.extra_options):
1193 return True
1194- elif ((self.use_device.get_active() or self.use_zfs.get_active()) and
1195+ elif (self.use_device.get_active() and
1196 len(self.extra_options['use_device'][1]) == 1):
1197 return True
1198 else:
1199@@ -659,20 +617,12 @@ class PageGtk(PageBase):
1200 self.controller.toggle_next_button()
1201 self.plugin_is_install = about_to_install
1202
1203- # Advanced features in new installs only for now
1204+ # Supporting crypto and lvm in new installs only for now
1205 use_device = self.use_device.get_active()
1206- self.advanced_features_button.set_sensitive(use_device)
1207- self.advanced_features_selected.set_sensitive(use_device)
1208-
1209- def advanced_features_option_changed(self, widget):
1210- if not widget.get_active():
1211- return
1212-
1213- use_volume_manager = self.use_lvm.get_active() or self.use_zfs.get_active()
1214- if not use_volume_manager:
1215- self.use_crypto.set_active(False)
1216- self.use_crypto.set_sensitive(use_volume_manager)
1217- self.use_crypto_desc.set_sensitive(use_volume_manager)
1218+ self.use_lvm.set_sensitive(use_device)
1219+ self.use_crypto.set_sensitive(use_device)
1220+ self.use_lvm_desc.set_sensitive(use_device)
1221+ self.use_crypto_desc.set_sensitive(use_device)
1222
1223 def initialize_resize_mode(self):
1224 disk_id = self.get_current_disk_partman_id()
1225@@ -854,23 +804,19 @@ class PageGtk(PageBase):
1226 ticked = False
1227 for option, name in option_to_widget:
1228 opt_widget = getattr(self, name)
1229- opt_desc = getattr(self, name + '_desc', None)
1230+ opt_desc = getattr(self, name + '_desc')
1231
1232 if option in options:
1233 opt_widget.show()
1234+ opt_desc.show()
1235 opt_widget.set_label(options[option].title)
1236-
1237- if opt_desc:
1238- opt_desc.show()
1239- opt_desc.set_markup(fmt % options[option].desc)
1240-
1241+ opt_desc.set_markup(fmt % options[option].desc)
1242 if not ticked and opt_widget.get_sensitive():
1243 opt_widget.set_active(True)
1244 ticked = True
1245 else:
1246 opt_widget.hide()
1247- if opt_desc:
1248- opt_desc.hide()
1249+ opt_desc.hide()
1250
1251 # Process the default selection
1252 self.part_ask_option_changed(None)
1253@@ -899,17 +845,15 @@ class PageGtk(PageBase):
1254 return (choice, '%s B' % self.resizewidget.get_size(),
1255 'resize_use_free')
1256
1257- elif self.use_device.get_active() or self.use_zfs.get_active():
1258+ elif self.use_device.get_active():
1259 def choose_recipe():
1260 # TODO dmitrij.ledkov 2012-07-23: RAID recipe?
1261
1262 have_lvm = 'some_device_lvm' in self.extra_options
1263- want_lvm = (self.use_lvm.get_active() and
1264- not self.use_zfs.get_active())
1265+ want_lvm = self.use_lvm.get_active()
1266
1267 have_crypto = 'some_device_crypto' in self.extra_options
1268- want_crypto = (self.use_crypto.get_active() and
1269- not self.use_zfs.get_active())
1270+ want_crypto = self.use_crypto.get_active()
1271
1272 if not ((want_crypto and have_crypto) or
1273 (want_lvm and have_lvm)):
1274@@ -1150,16 +1094,6 @@ class PageGtk(PageBase):
1275 is_removable = misc.is_removable_device(self.recovery_key_location.get_text())
1276 self.recovery_key_location_warning.set_visible(not is_removable)
1277
1278- def show_overwrite_space(self, show_hide):
1279- if show_hide:
1280- action = 'show'
1281- else:
1282- action = 'hide'
1283-
1284- for widget in ['crypto_extra_label',
1285- 'crypto_overwrite_space', 'crypto_extra_time']:
1286- getattr(getattr(self, widget), action)()
1287-
1288 @plugin.only_this_page
1289 def partman_dialog(self, devpart, partition, create=True):
1290 from gi.repository import Gtk, GObject
1291@@ -1728,7 +1662,6 @@ class PageGtk(PageBase):
1292 self.move_crypto_widgets()
1293 self.show_encryption_passphrase(True)
1294 self.generate_recovery_key()
1295- self.show_overwrite_space(not(self.use_crypto.get_active() and self.use_zfs.get_active()))
1296 self.controller.go_to_page(self.current_page)
1297 self.controller.toggle_next_button('install_button')
1298 self.info_loop(None)
1299@@ -3421,10 +3354,6 @@ class Page(plugin.Plugin):
1300 elif question.startswith('partman/confirm'):
1301 description = self.extended_description(question)
1302
1303- if hasattr(self.ui, "use_zfs"):
1304- if (self.ui.use_zfs.get_active() and self.ui.use_device.get_active()):
1305- description = self.update_zfs_description(self.extended_description(question))
1306-
1307 response = self.frontend.question_dialog(
1308 self.description(question),
1309 description,
1310@@ -3503,45 +3432,6 @@ class Page(plugin.Plugin):
1311
1312 return plugin.Plugin.run(self, priority, question)
1313
1314- def update_zfs_description(self, description):
1315- """Update the description in the partman dialog to display custom
1316- messages"""
1317-
1318- disks = re.findall(r"\(([^)]+)\)", description)
1319- device = ""
1320- if disks:
1321- device = "/dev/" + disks[0]
1322-
1323- misc.execute_root('/usr/share/ubiquity/zsys-setup', 'layout', device)
1324-
1325- zsys_layout = '/tmp/zsys-setup/layout'
1326- lines = description.splitlines()
1327- # Remove the last line of the output from partman which corresponds to
1328- # the ext4 partition
1329- del(lines[-1])
1330-
1331- if not os.path.exists(zsys_layout):
1332- return description
1333-
1334- with open(zsys_layout, 'r') as f:
1335- layout = f.readlines()
1336-
1337- partlabel = misc.utf8(self.db.metaget('ubiquity/text/partman_confirm_zfs', 'extended_description'),
1338- errors='replace')
1339- for line in layout:
1340- if not line.startswith("part:"):
1341- continue
1342-
1343- line = line.strip()
1344- (t, f, u, p) = line.split(':')
1345-
1346- lines.append(" " + partlabel % {
1347- 'partid': os.path.basename(p),
1348- 'parttype': f,
1349- 'partusage': u})
1350-
1351- return "\n".join(lines)
1352-
1353 def ok_handler(self):
1354 if self.install_bootloader and not self.is_bootdev_preseeded():
1355 self.preseed('grub-installer/bootdev', self.ui.get_grub_choice())
1356@@ -3551,19 +3441,7 @@ class Page(plugin.Plugin):
1357 self.ui.get_autopartition_choice()
1358 self.preseed_as_c(self.current_question, autopartition_choice,
1359 seen=False)
1360- telemetry_method = method
1361- try:
1362- if self.ui.use_zfs.get_active() and method == 'use_device':
1363- telemetry_method = "use_zfs"
1364- except AttributeError: # zfs not implemented on this frontend
1365- pass
1366-
1367- self.db.set('ubiquity/use_zfs',
1368- 'true' if telemetry_method == 'use_zfs' else 'false')
1369- telemetry.get().set_partition_method(telemetry_method)
1370- keystore_key = self.ui.get_crypto_keys()
1371- if keystore_key:
1372- self.db.set('ubiquity/zfs_keystore_key', keystore_key)
1373+ telemetry.get().set_partition_method(method)
1374 # Don't exit partman yet.
1375 else:
1376 self.finish_partitioning = True

Subscribers

People subscribed via source and target branches