live: improve logging with setup command

Improve logging when setting up partition, provide more hints on progress.

Fail in case partition layout is not supported.
master
OpenGnSys Support Team 2024-02-22 11:03:13 +01:00
parent 26ca4c7950
commit e3bb01f5f1
1 changed files with 10 additions and 2 deletions

View File

@ -332,9 +332,14 @@ class OgLiveOperations:
cxt.create_disklabel('dos') cxt.create_disklabel('dos')
elif table_type == 'GPT': elif table_type == 'GPT':
cxt.create_disklabel('gpt') cxt.create_disklabel('gpt')
else:
logging.info(f'Unsupported partition layout: {table_type}, only MSDOS and GPT are supported')
raise ValueError(f'Unsupported partition scheme {table_type}, only MSDOS and GPT are supported')
logging.info(f'Setting up partition layout to {table_type}')
for part in partlist: for part in partlist:
logging.debug(f'Adding partition: {part}') logging.info(f'Creating partition {part["partition"]} with {part["code"]} of {int(part["size"])//1024} Mbytes')
if part["code"] == 'EMPTY': if part["code"] == 'EMPTY':
continue continue
if ogRest.terminated: if ogRest.terminated:
@ -358,8 +363,11 @@ class OgLiveOperations:
for part in partlist: for part in partlist:
if part["filesystem"] == 'EMPTY': if part["filesystem"] == 'EMPTY':
continue continue
partition = int(part["partition"])
fs = part["filesystem"].lower() fs = part["filesystem"].lower()
logging.info(f'Formatting partition {part["partition"]} with filesystem {part["filesystem"]}')
partition = int(part["partition"])
if fs == 'cache': if fs == 'cache':
mkfs('ext4', int(disk), partition, label='CACHE') mkfs('ext4', int(disk), partition, label='CACHE')
init_cache() init_cache()