From 87b566532cfa6d457017461902825943198ee176 Mon Sep 17 00:00:00 2001 From: Natalia Serrano Date: Mon, 14 Jul 2025 12:20:34 +0200 Subject: [PATCH] refs #2415 check that 1st partition is the ESP in EFI systems --- ogclient/interfaceAdm/Configurar.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/ogclient/interfaceAdm/Configurar.py b/ogclient/interfaceAdm/Configurar.py index 6da2e0c..7e9f6aa 100755 --- a/ogclient/interfaceAdm/Configurar.py +++ b/ogclient/interfaceAdm/Configurar.py @@ -79,7 +79,7 @@ sparams = sparam.split('%') maxp=0 sum_tam = 0 do_sum_tam = True -cache_seen = extended_seen = False +cache_seen = extended_seen = efi_seen = False for item in sparams: if not item: continue ## por si nos pasan un '%' al final de todo # Leer datos de la partición, separados por "*". @@ -109,6 +109,11 @@ for item in sparams: sys.exit (1) # Componer datos de particionado. + if 'EFI' == cpt: + if efi_seen: + SystemLib.ogRaiseError (['log', 'session'], ogGlobals.OG_ERR_FORMAT, f'se ha solicitado más de una partición de ESP') + sys.exit (1) + efi_seen = True if 'CACHE' == cpt: if cache_seen: SystemLib.ogRaiseError (['log', 'session'], ogGlobals.OG_ERR_FORMAT, f'se ha solicitado más de una partición de cache') @@ -148,8 +153,8 @@ if not cache_seen and not tbp: sys.exit (1) if 'GPT' == ptt and extended_seen: - SystemLib.ogRaiseError (['session', 'log'], ogGlobals.OG_ERR_FORMAT, f'En GPT no se pueden usar particiones extendidas') - sys.exit (1) + SystemLib.ogRaiseError (['session', 'log'], ogGlobals.OG_ERR_FORMAT, f'En GPT no se pueden usar particiones extendidas') + sys.exit (1) ## error si nos piden más de 4 y ninguna es extendida if 'MSDOS' == ptt and not extended_seen: @@ -159,6 +164,15 @@ if 'MSDOS' == ptt and not extended_seen: SystemLib.ogRaiseError (['session', 'log'], ogGlobals.OG_ERR_FORMAT, f'Se han solicitado más de 4 particiones y ninguna es extendida') sys.exit (1) +if efi_seen: + if 'EFI' != tbp[0].split (':')[0]: + SystemLib.ogRaiseError (['session', 'log'], ogGlobals.OG_ERR_FORMAT, f'la partición ESP debe estar declarada en primera posición') + sys.exit (1) +else: + if 'GPT' == ptt and 1 == dis: + SystemLib.ogRaiseError (['session', 'log'], ogGlobals.OG_ERR_FORMAT, f'En GPT debe haber una partición ESP') + sys.exit (1) + ## si no nos definen partición de cache y el disco tiene una, hay que borrarla if not cache_seen: c = CacheLib.ogFindCache()