From 3ee1a5c18e4bf248b54e8da9be6a88cfe042a2b9 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 30 Oct 2021 17:15:33 +0200 Subject: Tweaked get_mount_info() and mount_subvolume(). mount info now returns the path it found after traversal. mount_subvolume will no longer assume installation.target is of pathlib.Path and converts it if it isn't. --- archinstall/lib/disk/helpers.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'archinstall/lib/disk/helpers.py') diff --git a/archinstall/lib/disk/helpers.py b/archinstall/lib/disk/helpers.py index 78bf08ed..341b732f 100644 --- a/archinstall/lib/disk/helpers.py +++ b/archinstall/lib/disk/helpers.py @@ -117,7 +117,7 @@ def harddrive(size=None, model=None, fuzzy=False): return collection[drive] -def get_mount_info(path :Union[pathlib.Path, str], traverse=False) -> dict: +def get_mount_info(path :Union[pathlib.Path, str], traverse=False, return_real_path=False) -> dict: for traversal in list(map(str, [str(path)] + list(pathlib.Path(str(path)).parents))): try: log(f"Getting mount information at location {traversal}", level=logging.INFO) @@ -131,16 +131,25 @@ def get_mount_info(path :Union[pathlib.Path, str], traverse=False) -> dict: break if not output: - return {} + if return_real_path: + return {}, None + else: + return {} output = json.loads(output) if 'filesystems' in output: if len(output['filesystems']) > 1: raise DiskError(f"Path '{path}' contains multiple mountpoints: {output['filesystems']}") - return output['filesystems'][0] + if return_real_path: + return output['filesystems'][0], traversal + else: + return output['filesystems'][0] - return {} + if return_real_path: + return {}, traversal + else: + return {} def get_partitions_in_use(mountpoint) -> list: -- cgit v1.2.3-54-g00ecf