Initial wk-ddrescue menu
This commit is contained in:
parent
d57b08ec6f
commit
8b1e19fa4b
2 changed files with 90 additions and 0 deletions
58
.bin/Scripts/functions/ddrescue.py
Normal file
58
.bin/Scripts/functions/ddrescue.py
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
# Wizard Kit: Functions - ddrescue
|
||||||
|
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
|
||||||
|
from functions.common import *
|
||||||
|
|
||||||
|
# STATIC VARIABLES
|
||||||
|
USAGE=""" {script_name} clone [source [destination]]
|
||||||
|
{script_name} image [source [destination]]
|
||||||
|
(e.g. {script_name} clone /dev/sda /dev/sdb)
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Functions
|
||||||
|
def menu_clone(source_path, dest_path):
|
||||||
|
print_success('GNU ddrescue: Cloning Menu')
|
||||||
|
pass
|
||||||
|
|
||||||
|
def menu_ddrescue(*args):
|
||||||
|
"""Main ddrescue loop/menu."""
|
||||||
|
args = list(args)
|
||||||
|
script_name = os.path.basename(args.pop(0))
|
||||||
|
run_mode = ''
|
||||||
|
source_path = None
|
||||||
|
dest_path = None
|
||||||
|
|
||||||
|
# Parse args
|
||||||
|
try:
|
||||||
|
run_mode = args.pop(0)
|
||||||
|
source_path = args.pop(0)
|
||||||
|
dest_path = args.pop(0)
|
||||||
|
except IndexError:
|
||||||
|
# We'll set the missing paths later
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Show proper menu or exit
|
||||||
|
if run_mode == 'clone':
|
||||||
|
menu_clone(source_path, dest_path)
|
||||||
|
elif run_mode == 'image':
|
||||||
|
menu_image(source_path, dest_path)
|
||||||
|
else:
|
||||||
|
if not re.search(r'(^$|help|-h|\?)', run_mode, re.IGNORECASE):
|
||||||
|
print_error('Invalid mode.')
|
||||||
|
show_usage(script_name)
|
||||||
|
exit_script()
|
||||||
|
|
||||||
|
def menu_image(source_path, dest_path):
|
||||||
|
print_success('GNU ddrescue: Imaging Menu')
|
||||||
|
pass
|
||||||
|
|
||||||
|
def show_usage(script_name):
|
||||||
|
print_info('Usage:')
|
||||||
|
print_standard(USAGE.format(script_name=script_name))
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print("This file is not meant to be called directly.")
|
||||||
|
|
||||||
|
# vim: sts=4 sw=4 ts=4
|
||||||
32
.bin/Scripts/wk-ddrescue
Executable file
32
.bin/Scripts/wk-ddrescue
Executable file
|
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/python3
|
||||||
|
#
|
||||||
|
## Wizard Kit: TUI for ddrescue cloning and imaging
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# Init
|
||||||
|
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
||||||
|
sys.path.append(os.getcwd())
|
||||||
|
from functions.ddrescue import *
|
||||||
|
from functions.hw_diags import *
|
||||||
|
init_global_vars()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
try:
|
||||||
|
# Prep
|
||||||
|
clear_screen()
|
||||||
|
|
||||||
|
# Show menu
|
||||||
|
menu_ddrescue(*sys.argv)
|
||||||
|
|
||||||
|
# Done
|
||||||
|
#print_standard('\nDone.')
|
||||||
|
#pause("Press Enter to exit...")
|
||||||
|
exit_script()
|
||||||
|
except SystemExit:
|
||||||
|
pass
|
||||||
|
except:
|
||||||
|
major_exception()
|
||||||
|
|
||||||
|
# vim: sts=4 sw=4 ts=4
|
||||||
Loading…
Reference in a new issue