aboutsummaryrefslogtreecommitdiff
path: root/gnu/build
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-01-01 22:45:58 +0100
committerLudovic Courtès <ludo@gnu.org>2016-01-01 22:50:26 +0100
commitf453f637d5410f4d1e0b3787caa8d34b9b72d7d8 (patch)
tree20d946f09635783e3683dcb75a1c8c5b0e56e393 /gnu/build
parentf8865db6a002c9b968d39d0d91524edf55e0d873 (diff)
downloadguix-f453f637d5410f4d1e0b3787caa8d34b9b72d7d8.tar
guix-f453f637d5410f4d1e0b3787caa8d34b9b72d7d8.tar.gz
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.
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/file-systems.scm15
1 files changed, 11 insertions, 4 deletions
diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index d83a4f6015..f8b8697b46 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -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))))