Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions ubiquity/plugins/ubi-prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ def prepare(self):
if 'efi' in subarch:
if is_secure_boot():
self.ui.set_using_secureboot(True)
self.check_bitlocker_and_space()

self.ui.download_updates = self.db.get('ubiquity/download_updates') == 'true'
if self.ui.download_updates_enabled:
Expand Down Expand Up @@ -533,6 +534,35 @@ def apply_debconf_branding(self):
'ubiquity/text/free_space']:
self.db.subst(template, 'RELEASE', release.name)

def check_bitlocker_and_space(self):
from ubiquity import parted_server
try:
parted = parted_server.PartedServer()
required_size = misc.install_size()
has_suitable_drive = False
for disk in parted.disks():
parted.select_disk(disk)
can_install = False
for partition in parted.partitions():
p_size = int(partition[2])
p_fs = partition[4]
if p_fs == 'free' and p_size >= required_size:
can_install = True
break
elif p_fs not in ('free', 'BitLocker'):
can_install = True
break
if can_install:
has_suitable_drive = True
break
if not has_suitable_drive:
title = self.controller.get_string('ubiquity/text/bitlocker_header')
self.frontend.error_dialog(title, '', True)
return True
except Exception:
pass
return False

def should_show_rst_page(self):
search = '/sys/module/ahci/drivers/pci:ahci/*/remapped_nvme'
for remapped_nvme in glob.glob(search):
Expand Down