Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk/helpers.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-10-30 17:15:33 +0200
committerAnton Hvornum <anton@hvornum.se>2021-10-30 17:15:33 +0200
commit3ee1a5c18e4bf248b54e8da9be6a88cfe042a2b9 (patch)
treeee7980a51b4e1f533d228ecc1ba5457d60ad2aab /archinstall/lib/disk/helpers.py
parent4bc164cccc4c95d1f1e12e721aa61bb7299c1cef (diff)
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.
Diffstat (limited to 'archinstall/lib/disk/helpers.py')
-rw-r--r--archinstall/lib/disk/helpers.py17
1 files changed, 13 insertions, 4 deletions
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: