refs #2414 improve some error messages, create a windows logical partition rather than an empty one
parent
73721d70f7
commit
8029d469a7
|
@ -156,6 +156,7 @@ def ogCreatePartitions (disk, parts):
|
|||
return None
|
||||
|
||||
# Comprobar tamaño numérico y convertir en sectores
|
||||
ORIG_SIZE = SIZE ## para reportar en un error
|
||||
if 512 == IOSIZE: SIZE *= 2
|
||||
else: SIZE = (SIZE+3)//4 ## sumamos 3 para que la división entera "redondee al alza"
|
||||
|
||||
|
@ -195,7 +196,7 @@ def ogCreatePartitions (disk, parts):
|
|||
pass ## sin problema, la partición 5 es simplemente una más
|
||||
else:
|
||||
if not EXTSTART:
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, 'PART==5 and not EXTSTART')
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, 'la partición 5 es lógica pero no hay ninguna EXTENDED definida antes')
|
||||
return None
|
||||
START = EXTSTART
|
||||
SECTORS = EXTSTART+EXTSIZE
|
||||
|
@ -212,7 +213,7 @@ def ogCreatePartitions (disk, parts):
|
|||
|
||||
# Error si se supera el nº total de sectores.
|
||||
if START > SECTORS:
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, f'{START//2} > {SECTORS//2}')
|
||||
SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, f'partición "{TYPE}:{ORIG_SIZE}" no cabe')
|
||||
return None
|
||||
PART += 1
|
||||
|
||||
|
@ -226,7 +227,8 @@ def ogCreatePartitions (disk, parts):
|
|||
|
||||
# Si se define partición extendida sin lógicas, crear particion 5 vacía.
|
||||
if 5 == PART and EXTSTART:
|
||||
sfdisk_input += f'{DISK}5 : start={EXTSTART}, SIZE={EXTSIZE}, type=0\n'
|
||||
ID = ogTypeToId ('WINDOWS', PTTYPE)
|
||||
sfdisk_input += f'{DISK}5 : start={EXTSTART}, SIZE={EXTSIZE}, type={ID}\n'
|
||||
|
||||
# Desmontar los sistemas de archivos del disco antes de realizar las operaciones.
|
||||
FileSystemLib.ogUnmountAll (ND)
|
||||
|
|
Loading…
Reference in New Issue