Added get_fstype_macos()
This commit is contained in:
parent
ad1adba837
commit
ebbdedef6c
2 changed files with 26 additions and 3 deletions
|
|
@ -727,6 +727,8 @@ class State():
|
||||||
self.update_progress_pane('Idle')
|
self.update_progress_pane('Idle')
|
||||||
self.confirm_selections('Start recovery?')
|
self.confirm_selections('Start recovery?')
|
||||||
|
|
||||||
|
# TODO: Unmount source and/or destination under macOS
|
||||||
|
|
||||||
# Prep destination
|
# Prep destination
|
||||||
if self.mode == 'Clone':
|
if self.mode == 'Clone':
|
||||||
self.prep_destination(source_parts, dry_run=docopt_args['--dry-run'])
|
self.prep_destination(source_parts, dry_run=docopt_args['--dry-run'])
|
||||||
|
|
@ -1196,7 +1198,6 @@ def build_directory_report(path):
|
||||||
line = f'{path:<{width}}{line}'
|
line = f'{path:<{width}}{line}'
|
||||||
report.append(line)
|
report.append(line)
|
||||||
else:
|
else:
|
||||||
# TODO Get dir details under macOS
|
|
||||||
report.append(std.color_string('PATH', 'BLUE'))
|
report.append(std.color_string('PATH', 'BLUE'))
|
||||||
report.append(str(path))
|
report.append(str(path))
|
||||||
|
|
||||||
|
|
@ -1449,7 +1450,10 @@ def fstype_is_ok(path, map_dir=False):
|
||||||
|
|
||||||
# Get fstype
|
# Get fstype
|
||||||
if PLATFORM == 'Darwin':
|
if PLATFORM == 'Darwin':
|
||||||
# TODO: Determine fstype under macOS
|
try:
|
||||||
|
fstype = get_fstype_macos(path)
|
||||||
|
except (IndexError, TypeError, ValueError):
|
||||||
|
# Ignore for now
|
||||||
pass
|
pass
|
||||||
elif PLATFORM == 'Linux':
|
elif PLATFORM == 'Linux':
|
||||||
cmd = [
|
cmd = [
|
||||||
|
|
@ -1517,6 +1521,24 @@ def get_etoc():
|
||||||
return etoc
|
return etoc
|
||||||
|
|
||||||
|
|
||||||
|
def get_fstype_macos(path):
|
||||||
|
"""Get fstype for path under macOS, returns str.
|
||||||
|
|
||||||
|
NOTE: This method is not very effecient.
|
||||||
|
"""
|
||||||
|
cmd = ['df', path]
|
||||||
|
|
||||||
|
# Get device based on the path
|
||||||
|
proc = exe.run_program(cmd, check=False)
|
||||||
|
dev = proc.stdout.splitlines()[1].split()[0]
|
||||||
|
|
||||||
|
# Get device details
|
||||||
|
dev = hw_obj.Disk(dev)
|
||||||
|
|
||||||
|
# Done
|
||||||
|
return dev.details['fstype']
|
||||||
|
|
||||||
|
|
||||||
def get_object(path):
|
def get_object(path):
|
||||||
"""Get object based on path, returns obj."""
|
"""Get object based on path, returns obj."""
|
||||||
obj = None
|
obj = None
|
||||||
|
|
|
||||||
|
|
@ -321,6 +321,7 @@ class Disk(BaseObj):
|
||||||
self.details['bus'] = str(self.details.get('bus', '???')).upper()
|
self.details['bus'] = str(self.details.get('bus', '???')).upper()
|
||||||
self.details['bus'] = self.details['bus'].replace('IMAGE', 'Image')
|
self.details['bus'] = self.details['bus'].replace('IMAGE', 'Image')
|
||||||
self.details['bus'] = self.details['bus'].replace('NVME', 'NVMe')
|
self.details['bus'] = self.details['bus'].replace('NVME', 'NVMe')
|
||||||
|
self.details['fstype'] = self.details.get('fstype', 'Unknown')
|
||||||
self.details['log-sec'] = self.details.get('log-sec', 512)
|
self.details['log-sec'] = self.details.get('log-sec', 512)
|
||||||
self.details['model'] = self.details.get('model', 'Unknown Model')
|
self.details['model'] = self.details.get('model', 'Unknown Model')
|
||||||
self.details['name'] = self.details.get('name', self.path)
|
self.details['name'] = self.details.get('name', self.path)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue