1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-05-26 02:51:49 +02:00

system: Allow the root file system to be named by UUID.

* gnu/build/file-systems.scm (canonicalize-device-spec)[canonical-title]:
Use 'string->uuid' to check whether SPEC is a UUID.
When SPEC is a string and CANONICAL-TITLE is 'uuid, call 'string->uuid'.
* gnu/system.scm (operating-system-grub.cfg): Add 'root-device'
variable and use it for the "--root=" argument.
This commit is contained in:
Ludovic Courtès
2016-01-01 22:45:58 +01:00
parent f8865db6a0
commit f453f637d5
2 changed files with 15 additions and 6 deletions
+11 -4
View File
@@ -295,9 +295,12 @@ the following:
;; The realm of canonicalization.
(if (eq? title 'any)
(if (string? spec)
(if (string-prefix? "/" spec)
'device
'label)
;; The "--root=SPEC" kernel command-line option always provides a
;; string, but the string can represent a device, a UUID, or a
;; label. So check for all three.
(cond ((string-prefix? "/" spec) 'device)
((string->uuid spec) 'uuid)
(else 'label))
'uuid)
title))
@@ -323,7 +326,11 @@ the following:
;; Resolve the label.
(resolve find-partition-by-label spec identity))
((uuid)
(resolve find-partition-by-uuid spec uuid->string))
(resolve find-partition-by-uuid
(if (string? spec)
(string->uuid spec)
spec)
uuid->string))
(else
(error "unknown device title" title))))