(cls, args_config: dict[str, Any], args: Arguments)
| 255 | |
| 256 | @classmethod |
| 257 | def from_config(cls, args_config: dict[str, Any], args: Arguments) -> Self: |
| 258 | arch_config = cls() |
| 259 | |
| 260 | arch_config.locale_config = LocaleConfiguration.parse_arg(args_config) |
| 261 | |
| 262 | if script := args_config.get('script', None): |
| 263 | arch_config.script = script |
| 264 | |
| 265 | if archinstall_lang := args_config.get('archinstall-language', None): |
| 266 | arch_config.archinstall_language = translation_handler.get_language_by_name(archinstall_lang) |
| 267 | translation_handler.activate(arch_config.archinstall_language, set_font=False) |
| 268 | |
| 269 | if disk_config := args_config.get('disk_config', {}): |
| 270 | enc_password = args_config.get('encryption_password', '') |
| 271 | password = Password(plaintext=enc_password) if enc_password else None |
| 272 | arch_config.disk_config = DiskLayoutConfiguration.parse_arg(disk_config, password) |
| 273 | |
| 274 | # DEPRECATED |
| 275 | # backwards compatibility for main level disk_encryption entry |
| 276 | disk_encryption: DiskEncryption | None = None |
| 277 | |
| 278 | if args_config.get('disk_encryption', None) is not None and arch_config.disk_config is not None: |
| 279 | disk_encryption = DiskEncryption.parse_arg( |
| 280 | arch_config.disk_config, |
| 281 | args_config['disk_encryption'], |
| 282 | Password(plaintext=args_config.get('encryption_password', '')), |
| 283 | ) |
| 284 | |
| 285 | if disk_encryption: |
| 286 | arch_config.disk_config.disk_encryption = disk_encryption |
| 287 | |
| 288 | if profile_config := args_config.get('profile_config', None): |
| 289 | arch_config.profile_config = ProfileConfiguration.parse_arg(profile_config) |
| 290 | |
| 291 | if mirror_config := args_config.get('mirror_config', None): |
| 292 | backwards_compatible_repo = [] |
| 293 | if additional_repositories := args_config.get('additional-repositories', []): |
| 294 | backwards_compatible_repo = [Repository(r) for r in additional_repositories] |
| 295 | |
| 296 | arch_config.mirror_config = MirrorConfiguration.parse_args( |
| 297 | mirror_config, |
| 298 | backwards_compatible_repo, |
| 299 | ) |
| 300 | |
| 301 | if net_config := args_config.get('network_config', None): |
| 302 | arch_config.network_config = NetworkConfiguration.parse_arg(net_config) |
| 303 | |
| 304 | if bootloader_config_dict := args_config.get('bootloader_config', None): |
| 305 | arch_config.bootloader_config = BootloaderConfiguration.parse_arg(bootloader_config_dict, args.skip_boot) |
| 306 | # DEPRECATED: separate bootloader and uki fields (backward compatibility) |
| 307 | elif bootloader_str := args_config.get('bootloader', None): |
| 308 | bootloader = Bootloader.from_arg(bootloader_str, args.skip_boot) |
| 309 | uki = args_config.get('uki', False) |
| 310 | if uki and not bootloader.has_uki_support(): |
| 311 | uki = False |
| 312 | arch_config.bootloader_config = BootloaderConfiguration(bootloader=bootloader, uki=uki, removable=True) |
| 313 | |
| 314 | # deprecated: backwards compatibility |
no test coverage detected