parent
0a00e17536
commit
94a428f6da
1 changed files with 23 additions and 2 deletions
|
|
@ -1390,6 +1390,25 @@ def build_sfdisk_partition_line(table_type, dev_path, size, details):
|
||||||
return line
|
return line
|
||||||
|
|
||||||
|
|
||||||
|
def check_for_missing_items(state):
|
||||||
|
"""Check if source or destination dissapeared."""
|
||||||
|
items = {
|
||||||
|
'Source': state.source,
|
||||||
|
'Destination': state.destination,
|
||||||
|
}
|
||||||
|
for name, item in items.items():
|
||||||
|
if not item:
|
||||||
|
continue
|
||||||
|
if hasattr(item, 'path'):
|
||||||
|
if not item.path.exists():
|
||||||
|
std.print_error(f'{name} disappeared')
|
||||||
|
elif hasattr(item, 'exists'):
|
||||||
|
if not item.exists():
|
||||||
|
std.print_error(f'{name} disappeared')
|
||||||
|
else:
|
||||||
|
LOG.error('Unknown %s type: %s', name, item)
|
||||||
|
|
||||||
|
|
||||||
def clean_working_dir(working_dir):
|
def clean_working_dir(working_dir):
|
||||||
"""Clean working directory to ensure a fresh recovery session.
|
"""Clean working directory to ensure a fresh recovery session.
|
||||||
|
|
||||||
|
|
@ -1686,7 +1705,8 @@ def main():
|
||||||
state = State()
|
state = State()
|
||||||
try:
|
try:
|
||||||
state.init_recovery(args)
|
state.init_recovery(args)
|
||||||
except std.GenericAbort:
|
except (FileNotFoundError, std.GenericAbort):
|
||||||
|
check_for_missing_items(state)
|
||||||
std.abort()
|
std.abort()
|
||||||
|
|
||||||
# Show menu
|
# Show menu
|
||||||
|
|
@ -1926,7 +1946,8 @@ def run_recovery(state, main_menu, settings_menu, dry_run=True):
|
||||||
state.mark_started()
|
state.mark_started()
|
||||||
try:
|
try:
|
||||||
run_ddrescue(state, pair, pass_name, settings, dry_run=dry_run)
|
run_ddrescue(state, pair, pass_name, settings, dry_run=dry_run)
|
||||||
except (KeyboardInterrupt, std.GenericAbort):
|
except (FileNotFoundError, KeyboardInterrupt, std.GenericAbort):
|
||||||
|
check_for_missing_items(state)
|
||||||
abort = True
|
abort = True
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue