parent
af13a88c81
commit
859bc990e0
1 changed files with 10 additions and 11 deletions
|
|
@ -275,11 +275,17 @@ class BlockPair():
|
||||||
|
|
||||||
def safety_check(self):
|
def safety_check(self):
|
||||||
"""Run safety check and abort if necessary."""
|
"""Run safety check and abort if necessary."""
|
||||||
|
# TODO: Expand section to support non-Linux systems
|
||||||
dest_size = -1
|
dest_size = -1
|
||||||
if self.destination.exists():
|
if self.destination.is_block_device():
|
||||||
dest_obj = hw_disk.Disk(self.destination)
|
cmd = [
|
||||||
dest_size = dest_obj.size
|
'lsblk', '--bytes', '--json',
|
||||||
del dest_obj
|
'--nodeps', '--noheadings', '--output=size',
|
||||||
|
self.destination,
|
||||||
|
]
|
||||||
|
json_data = exe.get_json_from_command(cmd)
|
||||||
|
dest_size = json_data['blockdevices'][0]['size']
|
||||||
|
del json_data
|
||||||
|
|
||||||
# Check destination size if cloning
|
# Check destination size if cloning
|
||||||
if not self.destination.is_file() and dest_size < self.size:
|
if not self.destination.is_file() and dest_size < self.size:
|
||||||
|
|
@ -712,13 +718,6 @@ class State():
|
||||||
# Set mode
|
# Set mode
|
||||||
self.mode = set_mode(docopt_args)
|
self.mode = set_mode(docopt_args)
|
||||||
|
|
||||||
# Image mode is broken..
|
|
||||||
# TODO: Fix image mode
|
|
||||||
# Definitely for Linux, maybe for macOS
|
|
||||||
if self.mode == 'Image':
|
|
||||||
std.print_error("I'm sorry but image mode is currently broken...")
|
|
||||||
std.abort()
|
|
||||||
|
|
||||||
# Select source
|
# Select source
|
||||||
self.source = get_object(docopt_args['<source>'])
|
self.source = get_object(docopt_args['<source>'])
|
||||||
if not self.source:
|
if not self.source:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue