Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
2Shirt 2023-08-26 17:40:26 -07:00
commit ce1a4ed723
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -257,8 +257,6 @@ def finalize_recovery(state: State, dry_run: bool = True) -> None:
return
# Run functions
if menu.options['Relocate Backup GPT']['Selected']:
relocate_backup_gpt(state, dry_run=dry_run)
if menu.options['Zero-fill Gaps']['Selected']:
zero_fill_gaps(
state,
@ -266,6 +264,9 @@ def finalize_recovery(state: State, dry_run: bool = True) -> None:
dry_run=dry_run,
extend_to_end=menu.options['Zero-fill Extra Space']['Selected'],
)
if menu.options['Relocate Backup GPT']['Selected']:
# NOTE: This needs to be run last to avoid corrupting/erasing the backup GPT
relocate_backup_gpt(state, dry_run=dry_run)
def is_missing_source_or_destination(state) -> bool:
@ -402,7 +403,6 @@ def relocate_backup_gpt(state: State, dry_run: bool = True) -> None:
and state.source.size < state.destination.size
and not state.source.parent
and str(state.source.raw_details.get('pttype', 'Unknown')).lower() == 'gpt'
and cli.ask('Relocate backup GPT to the end of the device?')
):
LOG.warning('Refusing to attempt a backup GPT relocation.')
return
@ -698,11 +698,13 @@ def zero_fill_gaps(
) -> None:
"""Zero-fill any gaps on the destination."""
#fake_settings_menu = menus.settings(state.mode)
full_disk_clone = False
full_disk_clone = bool(
state.mode == 'Clone'
and len(state.block_pairs) == 1
and not state.source.parent
)
larger_destination = state.source.size < dest_size
percent_recovered = state.get_percent_recovered()
if state.mode == 'Clone' and len(state.block_pairs) == 1:
full_disk_clone = True
# Bail early
if percent_recovered == 100 and not (larger_destination and extend_to_end):