Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archinstall/lib/disk/device_model.py31
-rw-r--r--archinstall/lib/interactions/disk_conf.py3
2 files changed, 29 insertions, 5 deletions
diff --git a/archinstall/lib/disk/device_model.py b/archinstall/lib/disk/device_model.py
index 15e68116..54b4932b 100644
--- a/archinstall/lib/disk/device_model.py
+++ b/archinstall/lib/disk/device_model.py
@@ -42,12 +42,20 @@ class DiskLayoutType(Enum):
class DiskLayoutConfiguration:
config_type: DiskLayoutType
device_modifications: List[DeviceModification] = field(default_factory=list)
+ # used for pre-mounted config
+ mountpoint: Optional[Path] = None
def json(self) -> Dict[str, Any]:
- return {
- 'config_type': self.config_type.value,
- 'device_modifications': [mod.json() for mod in self.device_modifications]
- }
+ if self.config_type == DiskLayoutType.Pre_mount:
+ return {
+ 'config_type': self.config_type.value,
+ 'mountpoint': str(self.mountpoint)
+ }
+ else:
+ return {
+ 'config_type': self.config_type.value,
+ 'device_modifications': [mod.json() for mod in self.device_modifications]
+ }
@classmethod
def parse_arg(cls, disk_config: Dict[str, List[Dict[str, Any]]]) -> Optional[DiskLayoutConfiguration]:
@@ -64,6 +72,21 @@ class DiskLayoutConfiguration:
device_modifications=device_modifications
)
+ if config_type == DiskLayoutType.Pre_mount.value:
+ if not (mountpoint := disk_config.get('mountpoint')):
+ raise ValueError('Must set a mountpoint when layout type is pre-mount')
+
+ path = Path(str(mountpoint))
+
+ mods = device_handler.detect_pre_mounted_mods(path)
+ device_modifications.extend(mods)
+
+ storage['MOUNT_POINT'] = path
+
+ config.mountpoint = path
+
+ return config
+
for entry in disk_config.get('device_modifications', []):
device_path = Path(entry.get('device', None)) if entry.get('device', None) else None
diff --git a/archinstall/lib/interactions/disk_conf.py b/archinstall/lib/interactions/disk_conf.py
index bf24a22c..8e9643df 100644
--- a/archinstall/lib/interactions/disk_conf.py
+++ b/archinstall/lib/interactions/disk_conf.py
@@ -145,7 +145,8 @@ def select_disk_config(
return disk.DiskLayoutConfiguration(
config_type=disk.DiskLayoutType.Pre_mount,
- device_modifications=mods
+ device_modifications=mods,
+ mountpoint=path
)
preset_devices = [mod.device for mod in preset.device_modifications] if preset else []