Skip to content

Commit be7f7bf

Browse files
committed
change recovery mount to use the same function as the main mount
Signed-off-by: Zen <[email protected]>
1 parent 410b2d5 commit be7f7bf

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

ugrd/crypto/cryptsetup.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__author__ = 'desultory'
22

3-
__version__ = '0.6.4'
3+
__version__ = '0.6.5'
44

55

66
CRYPTSETUP_PARAMETERS = ['key_type', 'partuuid', 'uuid', 'key_file', 'header_file', 'retries', 'key_command', 'try_nokey']
@@ -103,7 +103,7 @@ def open_crypt_device(self, name, parameters):
103103
self.logger.debug("[%s] Using key file: %s" % (name, parameters['key_file']))
104104
cryptsetup_command = f' cryptsetup open --key-file {parameters["key_file"]}'
105105
else:
106-
cryptsetup_command = ' cryptsetup open '
106+
cryptsetup_command = ' cryptsetup open'
107107

108108
# Add the header file if it exists
109109
if header_file := parameters.get('header_file'):
@@ -129,11 +129,12 @@ def crypt_init(self):
129129
for name, parameters in self.config_dict['cryptsetup'].items():
130130
out += open_crypt_device(self, name, parameters)
131131
if 'try_nokey' in parameters and parameters.get('key_file'):
132-
out += [f'cryptsetup status {name}',
133-
'if [ $? -ne 0 ]; then',
134-
f' echo "Failed to open {name} with a key, attempting a passkey"',
135-
f' cryptsetup open $CRYPTSETUP_SOURCE_{name} --tries {parameters["retries"]} {name}',
136-
'fi']
132+
parameters.pop('key_file')
133+
parameters.pop('key_command')
134+
out += [f'\ncryptsetup status {name}',
135+
'if [$? -ne 0]; then',
136+
f' echo "Failed to open device using keys: {name}"']
137+
out += [f' {bash_line}' for bash_line in open_crypt_device(self, name, parameters)]
137138
return out
138139

139140

0 commit comments

Comments
 (0)