( cls, disk_config: _DiskLayoutConfigurationSerialization, enc_password: Password | None = None, )
| 113 | |
| 114 | @classmethod |
| 115 | def parse_arg( |
| 116 | cls, |
| 117 | disk_config: _DiskLayoutConfigurationSerialization, |
| 118 | enc_password: Password | None = None, |
| 119 | ) -> Self | None: |
| 120 | from archinstall.lib.disk.device_handler import device_handler |
| 121 | |
| 122 | device_modifications: list[DeviceModification] = [] |
| 123 | config_type = disk_config.get('config_type', None) |
| 124 | |
| 125 | if not config_type: |
| 126 | raise ValueError('Missing disk layout configuration: config_type') |
| 127 | |
| 128 | config = cls( |
| 129 | config_type=DiskLayoutType(config_type), |
| 130 | device_modifications=device_modifications, |
| 131 | ) |
| 132 | |
| 133 | if config_type == DiskLayoutType.Pre_mount.value: |
| 134 | if not (mountpoint := disk_config.get('mountpoint')): |
| 135 | raise ValueError('Must set a mountpoint when layout type is pre-mount') |
| 136 | |
| 137 | path = Path(str(mountpoint)) |
| 138 | |
| 139 | mods = device_handler.detect_pre_mounted_mods(path) |
| 140 | device_modifications.extend(mods) |
| 141 | |
| 142 | config.mountpoint = path |
| 143 | |
| 144 | return config |
| 145 | |
| 146 | for entry in disk_config.get('device_modifications', []): |
| 147 | device_path = Path(entry['device']) if entry.get('device', None) else None |
| 148 | |
| 149 | if not device_path: |
| 150 | continue |
| 151 | |
| 152 | device = device_handler.get_device(device_path) |
| 153 | |
| 154 | if not device: |
| 155 | continue |
| 156 | |
| 157 | device_modification = DeviceModification( |
| 158 | wipe=entry.get('wipe', False), |
| 159 | device=device, |
| 160 | ) |
| 161 | |
| 162 | device_partitions: list[PartitionModification] = [] |
| 163 | |
| 164 | for partition in entry.get('partitions', []): |
| 165 | flags = [flag for f in partition.get('flags', []) if (flag := PartitionFlag.from_string(f))] |
| 166 | |
| 167 | if fs_type := partition.get('fs_type'): |
| 168 | fs_type = FilesystemType(fs_type) |
| 169 | else: |
| 170 | fs_type = None |
| 171 | |
| 172 | device_partition = PartitionModification( |
nothing calls this directly
no test coverage detected