diff options
author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-09-27 15:59:30 -0400 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-09-27 15:59:30 -0400 |
commit | 990a4822f1cb45c1470fe38cbf17fd7bb54d0088 (patch) | |
tree | 1c1ff41c9264fe5af5ee0b8723d1e367e958c051 /gnu/installer/parted.scm | |
parent | 91db77c955cc7ef95dd8b535e40d6b4cf28669ec (diff) | |
parent | 3c6e220d8100281074c414a43c1efe9a01b53771 (diff) | |
download | guix-990a4822f1cb45c1470fe38cbf17fd7bb54d0088.tar.gz guix-990a4822f1cb45c1470fe38cbf17fd7bb54d0088.zip |
Merge branch 'staging' into core-updates
Conflicts resolved in:
gnu/local.mk
gnu/packages/cran.scm
gnu/packages/gnome.scm
gnu/packages/gtk.scm
gnu/packages/icu4c.scm
gnu/packages/java.scm
gnu/packages/machine-learning.scm
gnu/packages/tex.scm
Diffstat (limited to 'gnu/installer/parted.scm')
-rw-r--r-- | gnu/installer/parted.scm | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm index 84fdbe24fb..fcc936a391 100644 --- a/gnu/installer/parted.scm +++ b/gnu/installer/parted.scm @@ -148,7 +148,7 @@ (default #f)) (crypt-label user-partition-crypt-label (default #f)) - (crypt-password user-partition-crypt-password + (crypt-password user-partition-crypt-password ; <secret> (default #f)) (fs-type user-partition-fs-type (default 'ext4)) @@ -1183,7 +1183,7 @@ USER-PARTITION if it is encrypted, or the plain file-name otherwise." "Format and open the encrypted partition pointed by USER-PARTITION." (let* ((file-name (user-partition-file-name user-partition)) (label (user-partition-crypt-label user-partition)) - (password (user-partition-crypt-password user-partition))) + (password (secret-content (user-partition-crypt-password user-partition)))) (call-with-luks-key-file password (lambda (key-file) @@ -1194,6 +1194,20 @@ USER-PARTITION if it is encrypted, or the plain file-name otherwise." ((run-command-in-installer) "cryptsetup" "open" "--type" "luks" "--key-file" key-file file-name label))))) +(define (luks-ensure-open user-partition) + "Ensure partition pointed by USER-PARTITION is opened." + (unless (file-exists? (user-partition-upper-file-name user-partition)) + (let* ((file-name (user-partition-file-name user-partition)) + (label (user-partition-crypt-label user-partition)) + (password (secret-content (user-partition-crypt-password user-partition)))) + (call-with-luks-key-file + password + (lambda (key-file) + (installer-log-line "opening LUKS entry ~s at ~s" + label file-name) + ((run-command-in-installer) "cryptsetup" "open" "--type" "luks" + "--key-file" key-file file-name label)))))) + (define (luks-close user-partition) "Close the encrypted partition pointed by USER-PARTITION." (let ((label (user-partition-crypt-label user-partition))) @@ -1278,6 +1292,8 @@ respective mount-points." (user-fs-type->mount-type fs-type)) (file-name (user-partition-upper-file-name user-partition))) + (when crypt-label + (luks-ensure-open user-partition)) (mkdir-p target) (installer-log-line "mounting ~s on ~s" file-name target) (mount file-name target mount-type))) |