From 6628d93d8684d1fd8f8bc2c60f83d6045b503ac0 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Tue, 23 Jul 2024 10:08:56 +0200 Subject: 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. --- ogcp/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ogcp/views.py b/ogcp/views.py index 525ed3a..72a8b14 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -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')) -- cgit v1.2.3-18-g5258