Merge ~jibel/ubiquity:zfs_fixes into ubiquity:master

Proposed by Jean-Baptiste Lallement
Status: Merged
Merged at revision: 3d62cb23e755f1afbb5f8027edf441b23799eb8c
Proposed branch: ~jibel/ubiquity:zfs_fixes
Merge into: ubiquity:master
Diff against target: 461 lines (+240/-90)
4 files modified
debian/changelog (+13/-3)
debian/ubiquity.templates (+5/-0)
scripts/zsys-setup (+181/-86)
ubiquity/plugins/ubi-partman.py (+41/-1)
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli (community) Approve
Review via email: mp+375238@code.launchpad.net

Commit message

Various fixes from experiment:
  - Use version 5000 for bpool with some features disabled to stay compatible with grub and prevent users from upgrading and breaking their systems.
  - The partman confirmation dialog now displays the final layout of the partition that will be created instead of the true but confusing message from partman telling that an ext4 partition will be created (LP: #1847719)
  - Calculate the size of bpool to be 500M < 5% partition size < 2G
  - Always create an ESP and moved grub to the ESP.

To post a comment you must log in.
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

I didn't test yet as we are going to have some iterations. Here are mostly nitpick, good work :)

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Thanks fir the review. Comments addressed.

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

- one more comment on the new changes
- still 2 pending on previous diff

Revision history for this message
Jean-Baptiste Lallement (jibel) :
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

LGTM! I didn't give it a try yet, but I didn't spot anything more. Just 2 notes:
- Is having predictable names in /tmp is a security issue? I remember we removed from flag filenames in the past due to this.
- Did you have a look at our latest exchanges with Richard (the ones before the 19.10 release) to ensure we address all of his remarks?

Ack (pending testing)

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Did a test-run without UEFI enabled, and working well for me.

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

I reviewed the comments from Richard in the spec and latest email exchanges and apparently they've all been addressed.

About the temporary directory in /tmp we could pass an additional argument to the script, but it's called from completely different scopes: from ubiquity itself (ubi-partman and gtk_ui) and from a subprocess, it would add lot of complexity for share the name of the temporary directory between these scopes. Passing it in the environment wouldn't improve the security either. At best we could umask the directory so it can only be accessed by root.

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

+1 for me then :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 8a152ab..9ba61ce 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,18 @@
1ubiquity (20.04.1) UNRELEASED; urgency=medium1ubiquity (20.04.1) UNRELEASED; urgency=medium
22
3 * script/zsys-setup: fix tag name from org.zsys to com.ubuntu.zsys.3 * zfs:
4 * Added an advanced features dialog to the partitioning page. LVM, LVM with4 - Added an advanced features dialog to the partitioning page. LVM, LVM
5 encryption and experimental ZFS support have been moved to this dialog.5 with encryption and experimental ZFS support have been moved to this
6 dialog.
7 - Fix tag name from org.zsys to com.ubuntu.zsys.
8 - Use version 5000 for bpool with some features disabled to stay
9 compatible with grub and prevent users from upgrading and breaking their
10 systems.
11 - The partman confirmation dialog now displays the final layout of the
12 partition that will be created instead of the true but confusing message
13 from partman telling that an ext4 partition will be created (LP: #1847719)
14 - Calculate the size of bpool to be 500M < 5% partition size < 2G
15 - Always create an ESP and moved grub to the ESP.
616
7 -- Jean-Baptiste Lallement <jean-baptiste.lallement@ubuntu.com> Mon, 28 Oct 2019 09:07:57 +010017 -- Jean-Baptiste Lallement <jean-baptiste.lallement@ubuntu.com> Mon, 28 Oct 2019 09:07:57 +0100
818
diff --git a/debian/ubiquity.templates b/debian/ubiquity.templates
index f56ac69..4342a2a 100644
--- a/debian/ubiquity.templates
+++ b/debian/ubiquity.templates
@@ -1597,3 +1597,8 @@ _Description:
1597Template: ubiquity/secureboot_key1597Template: ubiquity/secureboot_key
1598Type: password1598Type: password
1599_Description: SecureBoot key for MokPW1599_Description: SecureBoot key for MokPW
1600
1601Template: ubiquity/text/partman_confirm_zfs
1602Type: text
1603_Description:
1604 partition #%(partid)s as %(parttype)s used for %(partusage)s
1600\ No newline at end of file1605\ No newline at end of file
diff --git a/scripts/zsys-setup b/scripts/zsys-setup
index 439a9d7..554adb2 100755
--- a/scripts/zsys-setup
+++ b/scripts/zsys-setup
@@ -43,7 +43,12 @@ set -eu
43REQUIREDPKGS="zfsutils-linux"43REQUIREDPKGS="zfsutils-linux"
44TARGET="/target"44TARGET="/target"
45ESP="${TARGET}/boot/efi"45ESP="${TARGET}/boot/efi"
46INIT_FLAG="/tmp/.zsys-init.done"46ZSYSTMP="/tmp/$(basename $0)"
47INIT_FLAG="${ZSYSTMP}/init.done"
48FSTAB_PARTMAN="${ZSYSTMP}/fstab.partman"
49PARTITION_LAYOUT="${ZSYSTMP}/layout"
50
51mkdir -p "${ZSYSTMP}"
4752
48usage() {53usage() {
49 # Display script usage54 # Display script usage
@@ -122,7 +127,7 @@ prepare_target() {
122 # Save fstab generated by partman127 # Save fstab generated by partman
123 if [ -f "${target}/etc/fstab" ]; then128 if [ -f "${target}/etc/fstab" ]; then
124 echo "I: Saving existing fstab"129 echo "I: Saving existing fstab"
125 cp "${target}/etc/fstab" /tmp/fstab.partman130 cp "${target}/etc/fstab" "${FSTAB_PARTMAN}"
126 else131 else
127 echo "W: ${target}/etc/fstab doesn't exist"132 echo "W: ${target}/etc/fstab doesn't exist"
128 fi133 fi
@@ -156,46 +161,116 @@ prepare_target() {
156 done161 done
157}162}
158163
164get_layout() {
165 # Returns disk, base name of the partition and partition numbers to create
166 target="$1"
167
168 # The entire disk has been formatted with use_device
169 # There is either one ext4 partition or one ext4 and one ESP
170 part="$(grep -E "\s${target}\s" /proc/mounts | awk '{print $1}')"
171 disk=""
172 partbase=""
173
174 if [ -n "${part}" ]; then
175 disk="$(lsblk -lns -o TYPE,PATH ${part}| grep disk| awk '{print $2}')"
176 if [ -z "${disk}" ]; then
177 echo "E: Couldn't identify disk for partition ${part}. Exiting!"
178 exit 1
179 fi
180 # Some disks have letters in the partition number like /dev/nvme0n1p1
181 # In this case we want to retrieve 'p' so we deal only with partition number
182 # in the rest of the script and prepend the base.
183 partbase="$(echo ${part} | sed -e 's/[0-9]*$//' | sed -e "s#${disk}##")"
184 fi
185
186 partesp=1
187 if in_efi_mode; then
188 # No extended partition on EFI + GPT
189 # The layout is
190 # 1: ESP
191 # 2: swap
192 # 3: bpool
193 # 4: rpool
194 partswap=2
195 partbpool=3
196 partrpool=4
197 else
198 # MBR pools are on extended partition
199 # The layout is:
200 # 1: ESP
201 # 2: Extended
202 # 5: swap
203 # 6: bpool
204 # 7: rpool
205 partswap=5
206 partbpool=6
207 partrpool=7
208 fi
209
210 echo "OK|${disk}|${partbase}|${partesp}|${partswap}|${partbpool}|${partrpool}"
211}
212
159format_disk() {213format_disk() {
160 disk="$1"214 disk="$1"
161 partgrub="$2"215 partbase="$2"
162 partbpool="$3"216 partesp="$3"
163 partrpool="$4"217 partbpool="$4"
164 ss="$5"218 partrpool="$5"
219 ss="$6"
165 partswap=$(( partbpool - 1 ))220 partswap=$(( partbpool - 1 ))
166 partext=$(( partgrub + 1 ))221 partext=$(( partesp + 1 ))
167 sfdiskopts=""222 sfdiskopts=""
168 partprefix="${disk}${PARTBASE}"223 partprefix="${disk}${partbase}"
169224
170 echo "I: Formatting disk $disk with partitions grub:${partgrub} ext:${partext} bpool:${partbpool} rpool:${partrpool}"225 sfdisktmp="${ZSYSTMP}/sfdisk.cfg"
226 rm -f "${sfdisktmp}"
171227
172 if [ "${IS_EFI}" = "true" ]; then228 echo "I: Formatting disk $disk with partitions ESP:${partesp} ext:${partext} swap:${partswap} bpool:${partbpool} rpool:${partrpool}"
173229
230 # bpool size: 500M < 5% of ZFS allocated space < 2G
231 # partext4 is the ext4 partition created by partman.
232 # Its id is 2 or 1 depending on being on and EFI system of not.
233 partext4=1
234 if in_efi_mode; then
235 partext4=$(( partesp + 1 ))
236 fi
237
238 size_percent=$(expr \( $(blockdev --getsize64 ${disk}${partext4}) / 1024 / 1024 \) \* 5 / 100)
239 bpool_size=500
240 [ ${size_percent} -gt ${bpool_size} ] && bpool_size=${size_percent}
241 [ ${bpool_size} -gt 2048 ] && bpool_size=2048
242
243 if in_efi_mode; then
174 # Improvement: Delete all the partitions but the ESP244 # Improvement: Delete all the partitions but the ESP
175 # We should be only 1 or 2 partittion but well it can be made generic245 # There should be only 1 or 2 partitions but it can be made generic
176 sfdisk --delete "${disk}" ${partgrub}246 sfdisk --delete "${disk}" ${partswap}
177247
178 cat > /tmp/sfdisk.cfg <<EOF248 cat > "${sfdisktmp}" <<EOF
179${partprefix}${partgrub} : size= 50M, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4249${partprefix}${partswap} : size= ${ss}M, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F
180${partprefix}${partswap} : size= ${ss}M, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F250${partprefix}${partbpool} : size= ${bpool_size}M, type=6A82CB45-1DD2-11B2-99A6-080020736631
181${partprefix}${partbpool} : size= 2G, type=6A82CB45-1DD2-11B2-99A6-080020736631251${partprefix}${partrpool} : type=6A85CF4D-1DD2-11B2-99A6-080020736631
182${partprefix}${partrpool} : type=6A85CF4D-1DD2-11B2-99A6-080020736631
183EOF252EOF
184 sfdiskopts="--append"253 sfdiskopts="--append"
185 else254 else
186 start=$(sfdisk -l "${disk}"|grep "^${partprefix}${partgrub}"|awk '{print $2}')255 if ! esp_exists; then
187256 start=$(sfdisk -l "${disk}"|grep "^${partprefix}${partesp}"|awk '{print $2}')
188 cat > /tmp/sfdisk.cfg <<EOF257 cat > "${sfdisktmp}" <<EOF
189${partprefix}${partgrub} : start= $start, size= 50M, type=83, bootable258${partprefix}${partesp} : start= $start, size= 512M, type=ef, bootable
190${partprefix}${partext} : type=5259EOF
191${partprefix}${partswap} : size= ${ss}M, type=82260 else
192${partprefix}${partbpool} : size= 2G, type=a5261 sfdisk --delete "${disk}" ${partswap}
193${partprefix}${partrpool} : type=a5262 fi
263
264 cat >> "${sfdisktmp}" <<EOF
265${partprefix}${partext} : type=5
266${partprefix}${partswap} : size= ${ss}M, type=82
267${partprefix}${partbpool} : size= ${bpool_size}M, type=a5
268${partprefix}${partrpool} : type=a5
194EOF269EOF
195270
196 fi271 fi
197272
198 cat /tmp/sfdisk.cfg | sfdisk ${sfdiskopts} "${disk}"273 cat "${sfdisktmp}" | sfdisk ${sfdiskopts} "${disk}"
199274
200 # Force a re-read of the partition table275 # Force a re-read of the partition table
201 echo "I: Re-reading partition table"276 echo "I: Re-reading partition table"
@@ -228,12 +303,26 @@ init_zfs() {
228 -O mountpoint=/ -R "${target}" rpool "${partrpool}"303 -O mountpoint=/ -R "${target}" rpool "${partrpool}"
229304
230 # bpool305 # bpool
306 # The version of bpool is set to the default version to prevent users from upgrading
307 # Then only features supported by grub are enabled.
231 zpool create -f \308 zpool create -f \
232 -o version=28 \
233 -o ashift=12 \309 -o ashift=12 \
234 -d \310 -d \
235 -O xattr=sa \311 -o feature@async_destroy=enabled \
312 -o feature@bookmarks=enabled \
313 -o feature@embedded_data=enabled \
314 -o feature@empty_bpobj=enabled \
315 -o feature@enabled_txg=enabled \
316 -o feature@extensible_dataset=enabled \
317 -o feature@filesystem_limits=enabled \
318 -o feature@hole_birth=enabled \
319 -o feature@large_blocks=enabled \
320 -o feature@lz4_compress=enabled \
321 -o feature@spacemap_histogram=enabled \
322 -o feature@userobj_accounting=enabled \
323 -O compression=lz4 \
236 -O acltype=posixacl \324 -O acltype=posixacl \
325 -O xattr=sa \
237 -O relatime=on \326 -O relatime=on \
238 -O normalization=formD \327 -O normalization=formD \
239 -O canmount=off \328 -O canmount=off \
@@ -297,18 +386,27 @@ init_system_partitions() {
297 partefi="$2"386 partefi="$2"
298 partgrub="$3"387 partgrub="$3"
299388
300 echo "I: Creating grub partition $partgrub"389 # ESP
390 mkdir -p "${target}/boot/efi"
391 if ! in_efi_mode; then
392 echo "I: Creating ESP"
393 mkfs.vfat "${partefi}"
394 fi
395 mount -t vfat "${partefi}" "${target}/boot/efi"
396 mkdir -p "${target}/boot/efi/grub"
397
398 echo "I: Mount grub directory"
301 # Finalize grub directory399 # Finalize grub directory
302 mkdir -p "${target}/boot/grub"400 mkdir -p "${target}/boot/grub"
303 mke2fs -F -t ext4 "${partgrub}"401 mount -o bind "${target}/boot/efi/grub" "${target}/boot/grub"
304 mount -t ext4 "${partgrub}" "${target}/boot/grub"402}
305403
306 if [ "${IS_EFI}" = "true" ]; then404in_efi_mode() {
307 # ESP405 [ -d /proc/efi ] || [ -d /sys/firmware/efi ]
308 mkdir -p "${target}/boot/efi"406}
309 # No need to reformat the partition has been prepared by partman-efi407
310 mount -t vfat "${partefi}" "${target}/boot/efi"408esp_exists() {
311 fi409 grep -q "\s${ESP}\s" /proc/mounts
312}410}
313411
314check_prerequisites ${REQUIREDPKGS}412check_prerequisites ${REQUIREDPKGS}
@@ -318,57 +416,48 @@ echo "I: Running $(basename "$0") ${COMMAND}"
318if [ -z "${COMMAND}" ]; then416if [ -z "${COMMAND}" ]; then
319 echo "E: ${COMMAND} is mandatory. Exiting!"417 echo "E: ${COMMAND} is mandatory. Exiting!"
320 exit 1418 exit 1
321elif [ "${COMMAND}" = "init" ]; then419elif [ "${COMMAND}" = "layout" ]; then
322 # The entire disk has been formatted with use_device420 # Just displays de layout that will be created without any change to the disk.
323 # There is either one ext4 partition or one ext4 and one ESP421 # At this stage we don't now yet the size of the partition that will be created.
324 PART=$(grep -E "\s${TARGET}\s" /proc/mounts | awk '{print $1}')422 IFS="|" read ERR DISK PARTBASE PARTESP PARTSWAP PARTBPOOL PARTRPOOL<<EOF
423$(get_layout ${TARGET})
424EOF
325425
326 if [ -z "${PART}" ]; then426 if [ "${ERR}" != "OK" ]; then
327 echo "E: Couldn't identify partition matching ${TARGET}. Exiting!"427 echo "${ERR}"
328 exit 1428 exit 1
329 fi429 fi
330430
331 DISK="$(lsblk -lns -o TYPE,PATH ${PART}| grep disk| awk '{print $2}')"431 cat > "${PARTITION_LAYOUT}" <<EOF
432disk:${DISK}
433EOF
434 if ! in_efi_mode || ! esp_exists; then
435 cat >> "${PARTITION_LAYOUT}" <<EOF
436part:vfat:ESP:${DISK}${PARTBASE}${PARTESP}
437EOF
438 fi
332439
333 echo "I: Partition table before init of ZFS"440 cat >> "${PARTITION_LAYOUT}" <<EOF
334 partx --show "${DISK}"441part:swap:swap:${DISK}${PARTBASE}${PARTSWAP}
442part:zfs:bpool:${DISK}${PARTBASE}${PARTBPOOL}
443part:zfs:rpool:${DISK}${PARTBASE}${PARTRPOOL}
444EOF
335445
336 # Some disks have letters in the partion number like /dev/nvme0n1p1446elif [ "${COMMAND}" = "init" ]; then
337 # In this case we want to retrieve 'p' so we deal only with partition number447 rm -f "${INIT_FLAG}"
338 # in the rest of the script and prepend the base.
339 PARTBASE="$(echo ${PART} | sed -e 's/[0-9]*$//' | sed -e "s#${DISK}##")"
340448
341 # Better check if the ESP has been created than if it's a EFI system449 IFS="|" read ERR DISK PARTBASE PARTESP PARTSWAP PARTBPOOL PARTRPOOL<<EOF
342 IS_EFI="false"450$(get_layout ${TARGET})
343 if grep -q "\s${ESP}\s" /proc/mounts; then451EOF
344 IS_EFI="true"
345 fi
346452
347 PARTGRUB=$(lsblk -n -o TYPE ${DISK}|grep ^part| wc -l)453 if [ "${ERR}" != "OK" ]; then
348 if [ "$IS_EFI" = "true" ]; then454 echo "${ERR}"
349 # No extended partition on EFI + GPT455 exit 1
350 # The layout is
351 # 1: ESP
352 # 2: grub
353 # 3: swap
354 # 4: bpool
355 # 5: rpool
356 PARTSWAP=3
357 PARTBPOOL=4
358 PARTRPOOL=5
359 else
360 # MBR pools are on extended partition
361 # The layout is:
362 # 1: grub
363 # 2: Extended
364 # 5: swap
365 # 6: bpool
366 # 7: rpool
367 PARTSWAP=5
368 PARTBPOOL=6
369 PARTRPOOL=7
370 fi456 fi
371457
458 echo "I: Partition table before init of ZFS"
459 partx --show "${DISK}"
460
372 # Swap files are not supported on ZFS, we use a swap partition instead:461 # Swap files are not supported on ZFS, we use a swap partition instead:
373 SWAPFILE="$(grep "^${TARGET}" /proc/swaps |awk '{print $1}')"462 SWAPFILE="$(grep "^${TARGET}" /proc/swaps |awk '{print $1}')"
374 # Give us a minimum swap partition size of 4MB in case we decide on463 # Give us a minimum swap partition size of 4MB in case we decide on
@@ -385,20 +474,26 @@ elif [ "${COMMAND}" = "init" ]; then
385 SWAPVOLSIZE=$(( SWAPSIZE / 1024 / 1024 ))474 SWAPVOLSIZE=$(( SWAPSIZE / 1024 / 1024 ))
386475
387 prepare_target "${TARGET}"476 prepare_target "${TARGET}"
388 format_disk "${DISK}" "${PARTGRUB}" "${PARTBPOOL}" "${PARTRPOOL}" "${SWAPVOLSIZE}"477 format_disk "${DISK}" "${PARTBASE}" "${PARTESP}" "${PARTBPOOL}" "${PARTRPOOL}" "${SWAPVOLSIZE}"
389 init_zfs "${TARGET}" "${DISK}${PARTBASE}${PARTBPOOL}" "${DISK}${PARTBASE}${PARTRPOOL}"478 init_zfs "${TARGET}" "${DISK}${PARTBASE}${PARTBPOOL}" "${DISK}${PARTBASE}${PARTRPOOL}"
390 init_system_partitions "${TARGET}" "${DISK}${PARTBASE}1" "${DISK}${PARTBASE}${PARTGRUB}"479 init_system_partitions "${TARGET}" "${DISK}${PARTBASE}1" "${DISK}${PARTBASE}${PARTESP}"
391480
392 # Generate fstab481 # Generate fstab
393 # $TARGET/etc has been destroyed by the creation of the zfs partitition482 # $TARGET/etc has been destroyed by the creation of the zfs partitition
394 # Recreate it483 # Recreate it
395 mkdir -p "${TARGET}/etc"484 mkdir -p "${TARGET}/etc"
396 if [ -f /tmp/fstab.partman ]; then485 if [ -f "${FSTAB_PARTMAN}" ]; then
397 echo "I: Creating fstab"486 echo "I: Creating fstab"
398 grep -Ev '\s/\s|/swapfile' /tmp/fstab.partman > "${TARGET}/etc/fstab"487 grep -Ev '\s/\s|/swapfile' "${FSTAB_PARTMAN}" > "${TARGET}/etc/fstab"
488 fi
489
490 if ! grep -q "boot/efi" "${TARGET}/etc/fstab"; then
491 espuuid=$(blkid -s UUID -o value "${DISK}${PARTBASE}${PARTESP}")
492 echo "UUID=${espuuid}\t/boot/efi\tvfat\tumask=0077\t0\t1" >> "${TARGET}/etc/fstab"
399 fi493 fi
400 grubuuid=$(blkid -s UUID -o value "${DISK}${PARTBASE}${PARTGRUB}")494
401 echo "UUID=${grubuuid}\t/boot/grub\text4\terrors=remount-ro\t0\t1" >> "${TARGET}/etc/fstab"495 # Bind mount grub from ESP to the expected location
496 echo "/boot/efi/grub\t/boot/grub\tnone\tdefaults,bind\t0\t0" >> "${TARGET}/etc/fstab"
402497
403 if [ -n "${SWAPFILE}" ]; then498 if [ -n "${SWAPFILE}" ]; then
404 SWAPDEVICE="${DISK}${PARTBASE}${PARTSWAP}"499 SWAPDEVICE="${DISK}${PARTBASE}${PARTSWAP}"
diff --git a/ubiquity/plugins/ubi-partman.py b/ubiquity/plugins/ubi-partman.py
index 5601d7d..086ac2b 100644
--- a/ubiquity/plugins/ubi-partman.py
+++ b/ubiquity/plugins/ubi-partman.py
@@ -3215,9 +3215,15 @@ class Page(plugin.Plugin):
3215 raise AssertionError("Arrived at %s unexpectedly" % question)3215 raise AssertionError("Arrived at %s unexpectedly" % question)
32163216
3217 elif question.startswith('partman/confirm'):3217 elif question.startswith('partman/confirm'):
3218 description = self.extended_description(question)
3219
3220 if hasattr(self.ui, "use_zfs"):
3221 if (self.ui.use_zfs.get_active() and self.ui.use_device.get_active()):
3222 description = self.update_zfs_description(self.extended_description(question))
3223
3218 response = self.frontend.question_dialog(3224 response = self.frontend.question_dialog(
3219 self.description(question),3225 self.description(question),
3220 self.extended_description(question),3226 description,
3221 ('ubiquity/text/go_back', 'ubiquity/text/continue'))3227 ('ubiquity/text/go_back', 'ubiquity/text/continue'))
3222 if response == 'ubiquity/text/continue':3228 if response == 'ubiquity/text/continue':
3223 self.db.set('ubiquity/partman-confirm', question[8:])3229 self.db.set('ubiquity/partman-confirm', question[8:])
@@ -3293,6 +3299,40 @@ class Page(plugin.Plugin):
32933299
3294 return plugin.Plugin.run(self, priority, question)3300 return plugin.Plugin.run(self, priority, question)
32953301
3302 def update_zfs_description(self, description):
3303 """Update the description in the partman dialog to display custom
3304 messages"""
3305
3306 misc.execute_root('/usr/share/ubiquity/zsys-setup', 'layout')
3307
3308 zsys_layout = '/tmp/zsys-setup/layout'
3309 lines = description.splitlines()
3310 # Remove the last line of the output from partman which corresponds to
3311 # the ext4 partition
3312 del(lines[-1])
3313
3314 if not os.path.exists(zsys_layout):
3315 return description
3316
3317 with open(zsys_layout, 'r') as f:
3318 layout = f.readlines()
3319
3320 partlabel = misc.utf8(self.db.metaget('ubiquity/text/partman_confirm_zfs', 'extended_description'),
3321 errors='replace')
3322 for line in layout:
3323 if not line.startswith("part:"):
3324 continue
3325
3326 line = line.strip()
3327 (t, f, u, p) = line.split(':')
3328
3329 lines.append(" " + partlabel % {
3330 'partid': os.path.basename(p),
3331 'parttype': f,
3332 'partusage': u})
3333
3334 return "\n".join(lines)
3335
3296 def ok_handler(self):3336 def ok_handler(self):
3297 if self.install_bootloader and not self.is_bootdev_preseeded():3337 if self.install_bootloader and not self.is_bootdev_preseeded():
3298 self.preseed('grub-installer/bootdev', self.ui.get_grub_choice())3338 self.preseed('grub-installer/bootdev', self.ui.get_grub_choice())

Subscribers

People subscribed via source and target branches