|
1 | 1 | __author__ = "desultory" |
2 | | -__version__ = "4.1.1" |
| 2 | +__version__ = "4.1.2" |
3 | 3 |
|
4 | 4 | from json import loads |
5 | 5 | from pathlib import Path |
@@ -242,10 +242,18 @@ def _validate_cryptsetup_header(self, mapped_name: str) -> None: |
242 | 242 | self.logger.warning(f"Unable to validate LUKS header for: {c_(mapped_name, 'red', bold=True)}\n") |
243 | 243 | if "header_file" not in cryptsetup_info: |
244 | 244 | self.logger.warning("If the header is detached, please set `header_file` in the configuration.") |
245 | | - self.logger.warning("If the header is detached not accessible at build time, please set `validate_header = false`.") |
246 | | - self.logger.critical("When header validation is disabled, it's up to the user to ensure valid headers are accessible at boot time, and that cryptsetup is built with the correct dependencies!") |
247 | | - self.logger.warning("Validation is not supported for LUKS1. If LUKS1 is being used, please consider using LUKS2 if possible.\n") |
248 | | - self.logger.info(f"Header validation can be disabled for this LUKS volume by setting the following configuration:\n\n[cryptsetup.{mapped_name}]\nvalidate_header = false\n\nor by setting `cryptsetup_header_validation = false` globally.\n") |
| 245 | + self.logger.warning( |
| 246 | + "If the header is detached not accessible at build time, please set `validate_header = false`." |
| 247 | + ) |
| 248 | + self.logger.critical( |
| 249 | + "When header validation is disabled, it's up to the user to ensure valid headers are accessible at boot time, and that cryptsetup is built with the correct dependencies!" |
| 250 | + ) |
| 251 | + self.logger.warning( |
| 252 | + "Validation is not supported for LUKS1. If LUKS1 is being used, please consider using LUKS2 if possible.\n" |
| 253 | + ) |
| 254 | + self.logger.info( |
| 255 | + f"Header validation can be disabled for this LUKS volume by setting the following configuration:\n\n[cryptsetup.{mapped_name}]\nvalidate_header = false\n\nor by setting `cryptsetup_header_validation = false` globally.\n" |
| 256 | + ) |
249 | 257 |
|
250 | 258 | raise e |
251 | 259 |
|
@@ -504,12 +512,18 @@ def _open_crypt_dev(self, name: str, parameters: dict) -> list[str]: |
504 | 512 | key_command = parameters.get("key_command") |
505 | 513 | plymouth_key_command = parameters.get("plymouth_key_command") if "ugrd.base.plymouth" in self["modules"] else None |
506 | 514 |
|
507 | | - _key_command_lines = f""" einfo "($i/$retries)[{name}] Running key command: {key_command}" |
508 | | - if ! {key_command} > /run/ugrd/key_data; then |
509 | | - ewarn 'Failed to run key command: {key_command}' |
510 | | - {reset_command} |
511 | | - continue |
512 | | - fi""" |
| 515 | + # Build the key command lines |
| 516 | + _key_command_lines = "\n".join( |
| 517 | + [ |
| 518 | + f'einfo "($i/$retries)[{name}] Running key command: {key_command}"', |
| 519 | + f"if ! {key_command} > /run/ugrd/key_data; then", |
| 520 | + f" ewarn 'Failed to run key command: {key_command}'", |
| 521 | + " prompt_user 'Press space to retry'" if not self["cryptsetup_autoretry"] else "", |
| 522 | + f" {reset_command}" if reset_command else "", |
| 523 | + " continue", |
| 524 | + "fi", |
| 525 | + ] |
| 526 | + ) |
513 | 527 |
|
514 | 528 | if key_command: |
515 | 529 | self.logger.debug("[%s] Using key command: %s" % (name, key_command)) |
|
0 commit comments