views: restrict EFI part size to 500MiB or higher

Modern Windows systems require higher EFI partition sizes than
most other OS.
Validate partition & format form to ensure the EFI partition has
as size of 500MiB or higher.
master
Alejandro Sirgo Rica 2024-07-23 10:08:56 +02:00
parent efd0b8acb3
commit 6628d93d86
1 changed files with 5 additions and 0 deletions

View File

@ -714,6 +714,7 @@ def action_setup_show():
@login_required
def action_setup_modify():
form = SetupForm(request.form)
MIN_EFI_SIZE = 500
if form.validate():
cache_count = 0
for partition in form.partitions:
@ -724,6 +725,10 @@ def action_setup_modify():
flash(_('The EFI partition requires a FAT32 filesystem'), category='error')
return redirect(url_for('commands'))
if partition.part_type.data == 'EFI' and partition.size.data < MIN_EFI_SIZE:
flash(_(f'The EFI partition requires a size of {MIN_EFI_SIZE}MiB or higher'), category='error')
return redirect(url_for('commands'))
if partition.size.data <= 0:
flash(_('Partitions can\'t have a size of zero or lower'), category='error')
return redirect(url_for('commands'))