File gnu/bootloader/grub.scm changed (mode: 100644) (index 611580a350..d42cb70067) |
... |
... |
code." |
338 |
338 |
#:key |
#:key |
339 |
339 |
(locale #f) |
(locale #f) |
340 |
340 |
(system (%current-system)) |
(system (%current-system)) |
|
341 |
|
(crypto-devices '()) |
341 |
342 |
(old-entries '()) |
(old-entries '()) |
342 |
343 |
store-directory-prefix) |
store-directory-prefix) |
343 |
344 |
"Return the GRUB configuration file corresponding to CONFIG, a |
"Return the GRUB configuration file corresponding to CONFIG, a |
|
... |
... |
menuentry ~s { |
391 |
392 |
(string-join (map string-join '#$modules) |
(string-join (map string-join '#$modules) |
392 |
393 |
"\n module " 'prefix)))))) |
"\n module " 'prefix)))))) |
393 |
394 |
|
|
|
395 |
|
(define (device-uuid->gexp device-uuid) |
|
396 |
|
(let* ((uuid-string (uuid->string device-uuid)) |
|
397 |
|
;; XXX: My tests only worked with UUID values without |
|
398 |
|
;; any hyphen character. |
|
399 |
|
(filtered-uuid (string-filter (lambda (c) |
|
400 |
|
(not (eqv? c #\-))) |
|
401 |
|
uuid-string))) |
|
402 |
|
#~(format port "# Unlock encrypted device ~a |
|
403 |
|
cryptomount -u ~a~%" |
|
404 |
|
#$uuid-string |
|
405 |
|
#$filtered-uuid))) |
|
406 |
|
|
394 |
407 |
(define (sugar) |
(define (sugar) |
395 |
408 |
(let* ((entry (first all-entries)) |
(let* ((entry (first all-entries)) |
396 |
409 |
(device (menu-entry-device entry)) |
(device (menu-entry-device entry)) |
|
... |
... |
keymap ~a~%" #$keymap)))) |
438 |
451 |
"# This file was generated from your Guix configuration. Any changes |
"# This file was generated from your Guix configuration. Any changes |
439 |
452 |
# will be lost upon reconfiguration. |
# will be lost upon reconfiguration. |
440 |
453 |
") |
") |
|
454 |
|
#$@(map device-uuid->gexp crypto-devices) |
441 |
455 |
#$(sugar) |
#$(sugar) |
442 |
456 |
#$locale-config |
#$locale-config |
443 |
457 |
#$keyboard-layout-config |
#$keyboard-layout-config |
File gnu/system.scm changed (mode: 100644) (index 2781674062..4e22d42d62) |
149 |
149 |
boot-parameters-bootloader-menu-entries |
boot-parameters-bootloader-menu-entries |
150 |
150 |
boot-parameters-store-device |
boot-parameters-store-device |
151 |
151 |
boot-parameters-store-mount-point |
boot-parameters-store-mount-point |
|
152 |
|
boot-parameters-crypto-devices |
152 |
153 |
boot-parameters-kernel |
boot-parameters-kernel |
153 |
154 |
boot-parameters-kernel-arguments |
boot-parameters-kernel-arguments |
154 |
155 |
boot-parameters-initrd |
boot-parameters-initrd |
|
... |
... |
directly by the user." |
300 |
301 |
(store-device boot-parameters-store-device) |
(store-device boot-parameters-store-device) |
301 |
302 |
(store-mount-point boot-parameters-store-mount-point) |
(store-mount-point boot-parameters-store-mount-point) |
302 |
303 |
(locale boot-parameters-locale) |
(locale boot-parameters-locale) |
|
304 |
|
(crypto-devices boot-parameters-crypto-devices) |
303 |
305 |
(kernel boot-parameters-kernel) |
(kernel boot-parameters-kernel) |
304 |
306 |
(kernel-arguments boot-parameters-kernel-arguments) |
(kernel-arguments boot-parameters-kernel-arguments) |
305 |
307 |
(initrd boot-parameters-initrd) |
(initrd boot-parameters-initrd) |
|
... |
... |
file system labels." |
333 |
335 |
device |
device |
334 |
336 |
(file-system-label device)))))) |
(file-system-label device)))))) |
335 |
337 |
|
|
|
338 |
|
(define uuid-sexp->uuid |
|
339 |
|
(match-lambda |
|
340 |
|
(('uuid (? symbol? type) (? bytevector? bv)) |
|
341 |
|
(bytevector->uuid bv type)) |
|
342 |
|
(x |
|
343 |
|
(warning (G_ "unrecognized uuid ~a at '~a'~%") x (port-filename port)) |
|
344 |
|
#f))) |
|
345 |
|
|
336 |
346 |
(match (read port) |
(match (read port) |
337 |
347 |
(('boot-parameters ('version 0) |
(('boot-parameters ('version 0) |
338 |
348 |
('label label) ('root-device root) |
('label label) ('root-device root) |
|
... |
... |
file system labels." |
382 |
392 |
((_ locale) locale) |
((_ locale) locale) |
383 |
393 |
(#f #f))) |
(#f #f))) |
384 |
394 |
|
|
|
395 |
|
(crypto-devices |
|
396 |
|
(match (assq 'crypto-devices rest) |
|
397 |
|
((_ device-list) (map uuid-sexp->uuid device-list)) |
|
398 |
|
(#f '()))) |
|
399 |
|
|
385 |
400 |
(store-device |
(store-device |
386 |
401 |
;; Linux device names like "/dev/sda1" are not suitable GRUB device |
;; Linux device names like "/dev/sda1" are not suitable GRUB device |
387 |
402 |
;; identifiers, so we just filter them out. |
;; identifiers, so we just filter them out. |
|
... |
... |
from the initrd." |
507 |
522 |
(any file-system-needed-for-boot? users))) |
(any file-system-needed-for-boot? users))) |
508 |
523 |
devices))) |
devices))) |
509 |
524 |
|
|
|
525 |
|
(define (operating-system-boot-crypto-devices os) |
|
526 |
|
(define (crypto-device? device) |
|
527 |
|
(let ((type (mapped-device-type device))) |
|
528 |
|
(eq? type luks-device-mapping))) |
|
529 |
|
(define (with-uuid? device) |
|
530 |
|
(if (uuid? (mapped-device-source device)) |
|
531 |
|
#t |
|
532 |
|
(begin |
|
533 |
|
(warning (G_ "the source from mapped-device at ~a is not an UUID. |
|
534 |
|
It will be ignored for the bootloader configuration.~%") |
|
535 |
|
(mapped-device-location device)) |
|
536 |
|
#f))) |
|
537 |
|
(let* ((mapped-devices (operating-system-boot-mapped-devices os)) |
|
538 |
|
(crypto-devices (filter crypto-device? mapped-devices)) |
|
539 |
|
(valid-devices (filter with-uuid? crypto-devices))) |
|
540 |
|
(map mapped-device-source valid-devices))) |
|
541 |
|
|
510 |
542 |
(define (device-mapping-services os) |
(define (device-mapping-services os) |
511 |
543 |
"Return the list of device-mapping services for OS as a list." |
"Return the list of device-mapping services for OS as a list." |
512 |
544 |
(map device-mapping-service |
(map device-mapping-service |
|
... |
... |
a list of <menu-entry>, to populate the \"old entries\" menu." |
1243 |
1275 |
(root-fs (operating-system-root-file-system os)) |
(root-fs (operating-system-root-file-system os)) |
1244 |
1276 |
(root-device (file-system-device root-fs)) |
(root-device (file-system-device root-fs)) |
1245 |
1277 |
(locale (operating-system-locale os)) |
(locale (operating-system-locale os)) |
|
1278 |
|
(crypto-devices (operating-system-boot-crypto-devices os)) |
1246 |
1279 |
(params (operating-system-boot-parameters |
(params (operating-system-boot-parameters |
1247 |
1280 |
os root-device |
os root-device |
1248 |
1281 |
#:system-kernel-arguments? #t)) |
#:system-kernel-arguments? #t)) |
|
... |
... |
a list of <menu-entry>, to populate the \"old entries\" menu." |
1254 |
1287 |
(bootloader-configuration-bootloader bootloader-conf))) |
(bootloader-configuration-bootloader bootloader-conf))) |
1255 |
1288 |
|
|
1256 |
1289 |
(generate-config-file bootloader-conf (list entry) |
(generate-config-file bootloader-conf (list entry) |
|
1290 |
|
#:crypto-devices crypto-devices |
1257 |
1291 |
#:locale locale |
#:locale locale |
1258 |
1292 |
#:old-entries old-entries |
#:old-entries old-entries |
1259 |
1293 |
#:store-directory-prefix |
#:store-directory-prefix |
|
... |
... |
such as '--root' and '--load' to <boot-parameters>." |
1298 |
1332 |
(bootloader (bootloader-configuration-bootloader |
(bootloader (bootloader-configuration-bootloader |
1299 |
1333 |
(operating-system-bootloader os))) |
(operating-system-bootloader os))) |
1300 |
1334 |
(bootloader-name (bootloader-name bootloader)) |
(bootloader-name (bootloader-name bootloader)) |
|
1335 |
|
(crypto-devices (operating-system-boot-crypto-devices os)) |
1301 |
1336 |
(label (operating-system-label os)) |
(label (operating-system-label os)) |
1302 |
1337 |
(multiboot-modules (operating-system-multiboot-modules os))) |
(multiboot-modules (operating-system-multiboot-modules os))) |
1303 |
1338 |
(boot-parameters |
(boot-parameters |
|
... |
... |
such as '--root' and '--load' to <boot-parameters>." |
1314 |
1349 |
(bootloader-menu-entries |
(bootloader-menu-entries |
1315 |
1350 |
(bootloader-configuration-menu-entries (operating-system-bootloader os))) |
(bootloader-configuration-menu-entries (operating-system-bootloader os))) |
1316 |
1351 |
(locale locale) |
(locale locale) |
|
1352 |
|
(crypto-devices crypto-devices) |
1317 |
1353 |
(store-device (ensure-not-/dev (file-system-device store))) |
(store-device (ensure-not-/dev (file-system-device store))) |
1318 |
1354 |
(store-mount-point (file-system-mount-point store))))) |
(store-mount-point (file-system-mount-point store))))) |
1319 |
1355 |
|
|
|
... |
... |
being stored into the \"parameters\" file)." |
1367 |
1403 |
bootloader-configuration-menu-entries) |
bootloader-configuration-menu-entries) |
1368 |
1404 |
'()))) |
'()))) |
1369 |
1405 |
(locale #$(boot-parameters-locale params)) |
(locale #$(boot-parameters-locale params)) |
|
1406 |
|
(crypto-devices |
|
1407 |
|
#$(map device->sexp |
|
1408 |
|
(boot-parameters-crypto-devices params))) |
1370 |
1409 |
(store |
(store |
1371 |
1410 |
(device |
(device |
1372 |
1411 |
#$(device->sexp (boot-parameters-store-device params))) |
#$(device->sexp (boot-parameters-store-device params))) |