diff options
Diffstat (limited to 'gnu/bootloader')
| -rw-r--r-- | gnu/bootloader/grub.scm | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index af7b7561ff0..29c81ae641e 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | ;;; Copyright © 2017 Leo Famulari <leo@famulari.name> | 4 | ;;; Copyright © 2017 Leo Famulari <leo@famulari.name> |
| 5 | ;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com> | 5 | ;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com> |
| 6 | ;;; Copyright © 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> | 6 | ;;; Copyright © 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> |
| 7 | ;;; Copyright © 2019 Miguel Ángel Arruga Vivas <rosen644835@gmail.com> | 7 | ;;; Copyright © 2019, 2020 Miguel Ángel Arruga Vivas <rosen644835@gmail.com> |
| 8 | ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com> | 8 | ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com> |
| 9 | ;;; Copyright © 2020 Stefan <stefan-guix@vodafonemail.de> | 9 | ;;; Copyright © 2020 Stefan <stefan-guix@vodafonemail.de> |
| 10 | ;;; | 10 | ;;; |
| @@ -359,11 +359,14 @@ code." | |||
| 359 | (locale #f) | 359 | (locale #f) |
| 360 | (system (%current-system)) | 360 | (system (%current-system)) |
| 361 | (old-entries '()) | 361 | (old-entries '()) |
| 362 | (store-crypto-devices '()) | ||
| 362 | store-directory-prefix) | 363 | store-directory-prefix) |
| 363 | "Return the GRUB configuration file corresponding to CONFIG, a | 364 | "Return the GRUB configuration file corresponding to CONFIG, a |
| 364 | <bootloader-configuration> object, and where the store is available at | 365 | <bootloader-configuration> object, and where the store is available at |
| 365 | STORE-FS, a <file-system> object. OLD-ENTRIES is taken to be a list of menu | 366 | STORE-FS, a <file-system> object. OLD-ENTRIES is taken to be a list of menu |
| 366 | entries corresponding to old generations of the system. | 367 | entries corresponding to old generations of the system. |
| 368 | STORE-CRYPTO-DEVICES contain the UUIDs of the encrypted units that must | ||
| 369 | be unlocked to access the store contents. | ||
| 367 | STORE-DIRECTORY-PREFIX may be used to specify a store prefix, as is required | 370 | STORE-DIRECTORY-PREFIX may be used to specify a store prefix, as is required |
| 368 | when booting a root file system on a Btrfs subvolume." | 371 | when booting a root file system on a Btrfs subvolume." |
| 369 | (define all-entries | 372 | (define all-entries |
| @@ -411,6 +414,21 @@ menuentry ~s { | |||
| 411 | (string-join (map string-join '#$modules) | 414 | (string-join (map string-join '#$modules) |
| 412 | "\n module " 'prefix)))))) | 415 | "\n module " 'prefix)))))) |
| 413 | 416 | ||
| 417 | (define (crypto-devices) | ||
| 418 | (define (crypto-device->cryptomount dev) | ||
| 419 | (if (uuid? dev) | ||
| 420 | #~(format port "cryptomount -u ~a~%" | ||
| 421 | ;; cryptomount only accepts UUID without the hypen. | ||
| 422 | #$(string-delete #\- (uuid->string dev))) | ||
| 423 | ;; Other type of devices aren't implemented. | ||
| 424 | #~())) | ||
| 425 | (let ((devices (map crypto-device->cryptomount store-crypto-devices)) | ||
| 426 | ;; XXX: Add luks2 when grub 2.06 is packaged. | ||
| 427 | (modules #~(format port "insmod luks~%"))) | ||
| 428 | (if (null? devices) | ||
| 429 | devices | ||
| 430 | (cons modules devices)))) | ||
| 431 | |||
| 414 | (define (sugar) | 432 | (define (sugar) |
| 415 | (let* ((entry (first all-entries)) | 433 | (let* ((entry (first all-entries)) |
| 416 | (device (menu-entry-device entry)) | 434 | (device (menu-entry-device entry)) |
| @@ -474,6 +492,7 @@ keymap ~a~%" #$keymap)))) | |||
| 474 | "# This file was generated from your Guix configuration. Any changes | 492 | "# This file was generated from your Guix configuration. Any changes |
| 475 | # will be lost upon reconfiguration. | 493 | # will be lost upon reconfiguration. |
| 476 | ") | 494 | ") |
| 495 | #$@(crypto-devices) | ||
| 477 | #$(sugar) | 496 | #$(sugar) |
| 478 | #$locale-config | 497 | #$locale-config |
| 479 | #$keyboard-layout-config | 498 | #$keyboard-layout-config |
