Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk
diff options
context:
space:
mode:
authorcodefiles <11915375+codefiles@users.noreply.github.com>2023-09-26 04:57:45 -0400
committerGitHub <noreply@github.com>2023-09-26 10:57:45 +0200
commit717a22371fd25aac10d1f435b65842e800fd9d7e (patch)
treeb1da060c4525f0d0352359a0f1031c3cd6212769 /archinstall/lib/disk
parentc427391543d464856c8153d17ddeef2c693fcf95 (diff)
Fix `mountpoint` for pre-mounted disk configuration (#2113)
* Fix `mountpoint` for pre-mounted disk configuration * Add missing commas
Diffstat (limited to 'archinstall/lib/disk')
-rw-r--r--archinstall/lib/disk/device_handler.py4
-rw-r--r--archinstall/lib/disk/device_model.py22
2 files changed, 9 insertions, 17 deletions
diff --git a/archinstall/lib/disk/device_handler.py b/archinstall/lib/disk/device_handler.py
index 9646103f..4cb35c03 100644
--- a/archinstall/lib/disk/device_handler.py
+++ b/archinstall/lib/disk/device_handler.py
@@ -594,7 +594,9 @@ class DeviceHandler(object):
if is_subpath(mountpoint, base_mountpoint):
path = Path(part_info.disk.device.path)
part_mods.setdefault(path, [])
- part_mods[path].append(PartitionModification.from_existing_partition(part_info))
+ part_mod = PartitionModification.from_existing_partition(part_info)
+ part_mod.mountpoint = mountpoint.root / mountpoint.relative_to(base_mountpoint)
+ part_mods[path].append(part_mod)
break
device_mods: List[DeviceModification] = []
diff --git a/archinstall/lib/disk/device_model.py b/archinstall/lib/disk/device_model.py
index 08861a63..b1f012f7 100644
--- a/archinstall/lib/disk/device_model.py
+++ b/archinstall/lib/disk/device_model.py
@@ -42,12 +42,6 @@ class DiskLayoutType(Enum):
class DiskLayoutConfiguration:
config_type: DiskLayoutType
device_modifications: List[DeviceModification] = field(default_factory=list)
- # used for pre-mounted config
- relative_mountpoint: Optional[Path] = None
-
- def __post_init__(self):
- if self.config_type == DiskLayoutType.Pre_mount and self.relative_mountpoint is None:
- raise ValueError('Must set a relative mountpoint when layout type is pre-mount"')
def json(self) -> Dict[str, Any]:
return {
@@ -487,10 +481,8 @@ class SubvolumeModification:
raise ValueError('Mountpoint is not specified')
- def is_root(self, relative_mountpoint: Optional[Path] = None) -> bool:
+ def is_root(self) -> bool:
if self.mountpoint:
- if relative_mountpoint is not None:
- return self.mountpoint.relative_to(relative_mountpoint) == Path('.')
return self.mountpoint == Path('/')
return False
@@ -742,14 +734,12 @@ class PartitionModification:
"""
return any(set(self.flags) & set(self._boot_indicator_flags))
- def is_root(self, relative_mountpoint: Optional[Path] = None) -> bool:
- if relative_mountpoint is not None and self.mountpoint is not None:
- return self.mountpoint.relative_to(relative_mountpoint) == Path('.')
- elif self.mountpoint is not None:
+ def is_root(self) -> bool:
+ if self.mountpoint is not None:
return Path('/') == self.mountpoint
else:
for subvol in self.btrfs_subvols:
- if subvol.is_root(relative_mountpoint):
+ if subvol.is_root():
return True
return False
@@ -861,8 +851,8 @@ class DeviceModification:
filtered = filter(lambda x: x.is_boot() and x.mountpoint, self.partitions)
return next(filtered, None)
- def get_root_partition(self, relative_path: Optional[Path]) -> Optional[PartitionModification]:
- filtered = filter(lambda x: x.is_root(relative_path), self.partitions)
+ def get_root_partition(self) -> Optional[PartitionModification]:
+ filtered = filter(lambda x: x.is_root(), self.partitions)
return next(filtered, None)
def json(self) -> Dict[str, Any]: