index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | archinstall/lib/disk/device_model.py | 31 |
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 |