|
1 | 1 | __author__ = "desultory" |
2 | | -__version__ = "3.2.3" |
| 2 | +__version__ = "3.2.4" |
3 | 3 |
|
4 | 4 | from pathlib import Path |
5 | 5 |
|
@@ -311,23 +311,26 @@ def open_crypt_device(self, name: str, parameters: dict) -> list[str]: |
311 | 311 | " fi", |
312 | 312 | ] |
313 | 313 |
|
| 314 | + |
| 315 | + reset_command = parameters.get("reset_command", 'continue') |
314 | 316 | # When there is a key command, evaluate it into $key_data |
315 | 317 | if "key_command" in parameters: |
316 | 318 | self.logger.debug("[%s] Using key command: %s" % (name, parameters["key_command"])) |
317 | 319 | out += [ |
318 | 320 | f" einfo 'Attempting to open LUKS key: {parameters['key_file']}'", |
319 | 321 | f" edebug 'Using key command: {parameters['key_command']}'", |
320 | 322 | ] |
| 323 | + |
321 | 324 | if "plymouth_key_command" in parameters and "ugrd.base.plymouth" in self["modules"]: |
322 | 325 | out += [ |
323 | 326 | " if plymouth --ping; then", |
324 | | - f' plymouth ask-for-password --prompt "[${{i}} / {retries}] Enter passphrase to unlock key for: {name}" --command "{parameters["plymouth_key_command"]}" --number-of-tries 1 > /run/vars/key_data || continue', |
| 327 | + f' plymouth ask-for-password --prompt "[${{i}} / {retries}] Enter passphrase to unlock key for: {name}" --command "{parameters["plymouth_key_command"]}" --number-of-tries 1 > /run/vars/key_data || {reset_command}', |
325 | 328 | " else", |
326 | | - f' {parameters["key_command"]} > /run/vars/key_data || continue', |
| 329 | + f' {parameters["key_command"]} > /run/vars/key_data || {reset_command}', |
327 | 330 | " fi", |
328 | 331 | ] |
329 | 332 | else: |
330 | | - out += [f" {parameters['key_command']} > /run/vars/key_data || continue"] |
| 333 | + out += [f" {parameters['key_command']} > /run/vars/key_data || {reset_command}"] |
331 | 334 |
|
332 | 335 | cryptsetup_command = "cryptsetup open --tries 1" # Set tries to 1 since it runs in the loop |
333 | 336 | cryptsetup_target = f'"$crypt_dev" {name}' # Add a variable for the source device and mapped name |
@@ -364,7 +367,7 @@ def open_crypt_device(self, name: str, parameters: dict) -> list[str]: |
364 | 367 | if not self["cryptsetup_autoretry"]: |
365 | 368 | out += [' prompt_user "Press enter to retry"'] |
366 | 369 | # Add the reset command if it exists |
367 | | - if reset_command := parameters.get("reset_command"): |
| 370 | + if reset_command != "continue": |
368 | 371 | out += [' einfo "Running key reset command"', f" {reset_command}"] |
369 | 372 | out += ["done\n"] |
370 | 373 |
|
|
0 commit comments