#!/bin/python3 # ## Wizard Kit: TUI for ddrescue cloning and imaging import os import sys # Init sys.path.append(os.path.dirname(os.path.realpath(__file__))) from functions.ddrescue import * from functions.hw_diags import * init_global_vars() if __name__ == '__main__': try: # Prep clear_screen() args = list(sys.argv) run_mode = '' source_path = None dest_path = None # Parse args try: script_name = os.path.basename(args.pop(0)) run_mode = str(args.pop(0)).lower() source_path = args.pop(0) dest_path = args.pop(0) except IndexError: # We'll set the missing paths later pass # Show usage? if run_mode in ('clone', 'image'): menu_ddrescue(source_path, dest_path, run_mode) else: if not re.search(r'(^$|help|-h|\?)', run_mode, re.IGNORECASE): print_error('Invalid mode.') show_usage(script_name) # Done print_standard('\nDone.') pause("Press Enter to exit...") exit_script() except GenericAbort as ga: if str(ga): print_warning(str(ga)) abort() except GenericError as ge: if str(ge): print_error(str(ge)) else: print_error('Generic Error?') abort() except SystemExit: pass except: major_exception() # vim: sts=4 sw=4 ts=4