Added option to match source partition table type
This commit is contained in:
parent
9702d7665f
commit
5d0ed475a6
1 changed files with 29 additions and 4 deletions
|
|
@ -285,12 +285,19 @@ class State():
|
||||||
settings['Needs Format'] = True
|
settings['Needs Format'] = True
|
||||||
offset = 0
|
offset = 0
|
||||||
if std.ask('Create an empty Windows boot partition on the clone?'):
|
if std.ask('Create an empty Windows boot partition on the clone?'):
|
||||||
offset = 2
|
|
||||||
settings['Create Boot Partition'] = True
|
settings['Create Boot Partition'] = True
|
||||||
settings['Table Type'] = 'GPT'
|
user_choice = std.choice(
|
||||||
if std.choice(['G', 'M'], 'GPT or MBR partition table?') == 'M':
|
['G', 'M', 'S'],
|
||||||
offset = 1
|
'Use GPT, MBR, or match Source type?',
|
||||||
|
)
|
||||||
|
if user_choice == 'G':
|
||||||
|
settings['Table Type'] = 'GPT'
|
||||||
|
elif user_choice == 'M':
|
||||||
settings['Table Type'] = 'MBR'
|
settings['Table Type'] = 'MBR'
|
||||||
|
else:
|
||||||
|
# Match source type
|
||||||
|
settings['Table Type'] = get_table_type(self.source)
|
||||||
|
offset = 2 if settings['Table Type'] == 'GPT' else 1
|
||||||
|
|
||||||
# Add pairs
|
# Add pairs
|
||||||
for dest_num, part in enumerate(source_parts):
|
for dest_num, part in enumerate(source_parts):
|
||||||
|
|
@ -1363,6 +1370,24 @@ def get_percent_color(percent):
|
||||||
return color
|
return color
|
||||||
|
|
||||||
|
|
||||||
|
def get_table_type(disk):
|
||||||
|
"""Get disk partition table type, returns str.
|
||||||
|
|
||||||
|
NOTE: If resulting table type is not GPT or MBR
|
||||||
|
then an exception is raised.
|
||||||
|
"""
|
||||||
|
table_type = str(disk.details.get('pttype', '')).upper()
|
||||||
|
table_type = table_type.replace('DOS', 'MBR')
|
||||||
|
|
||||||
|
# Check type
|
||||||
|
if table_type not in ('GPT', 'MBR'):
|
||||||
|
std.print_error(f'Unsupported partition table type: {table_type}')
|
||||||
|
raise std.GenericAbort()
|
||||||
|
|
||||||
|
# Done
|
||||||
|
return table_type
|
||||||
|
|
||||||
|
|
||||||
def get_working_dir(mode, destination, force_local=False):
|
def get_working_dir(mode, destination, force_local=False):
|
||||||
"""Get working directory using mode and destination, returns path."""
|
"""Get working directory using mode and destination, returns path."""
|
||||||
ticket_id = None
|
ticket_id = None
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue