file-systems: Preserve UUID types when serializing.
Reported by Roel Janssen <roel@gnu.org> at <https://lists.gnu.org/archive/html/help-guix/2017-09/msg00094.html>. * gnu/system/file-systems.scm (file-system->spec): When DEVICE is a UUID, serialize it in a way that preserves its type. (spec->file-system): Adjust accordingly. * gnu/build/file-systems.scm (canonicalize-device-spec): Add case for when SPEC is 'uuid?'.master
parent
1c65cca574
commit
9976c76aab
|
@ -450,8 +450,7 @@ the following:
|
||||||
\"/dev/sda1\";
|
\"/dev/sda1\";
|
||||||
• 'label', in which case SPEC is known to designate a partition label--e.g.,
|
• 'label', in which case SPEC is known to designate a partition label--e.g.,
|
||||||
\"my-root-part\";
|
\"my-root-part\";
|
||||||
• 'uuid', in which case SPEC must be a UUID (a 16-byte bytevector)
|
• 'uuid', in which case SPEC must be a UUID designating a partition;
|
||||||
designating a partition;
|
|
||||||
• 'any', in which case SPEC can be anything.
|
• 'any', in which case SPEC can be anything.
|
||||||
"
|
"
|
||||||
(define max-trials
|
(define max-trials
|
||||||
|
@ -497,9 +496,11 @@ the following:
|
||||||
(resolve find-partition-by-label spec identity))
|
(resolve find-partition-by-label spec identity))
|
||||||
((uuid)
|
((uuid)
|
||||||
(resolve find-partition-by-uuid
|
(resolve find-partition-by-uuid
|
||||||
(if (string? spec)
|
(cond ((string? spec)
|
||||||
(string->uuid spec)
|
(string->uuid spec))
|
||||||
spec)
|
((uuid? spec)
|
||||||
|
(uuid-bytevector spec))
|
||||||
|
(else spec))
|
||||||
uuid->string))
|
uuid->string))
|
||||||
(else
|
(else
|
||||||
(error "unknown device title" title))))
|
(error "unknown device title" title))))
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
(define-module (gnu system file-systems)
|
(define-module (gnu system file-systems)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
|
#:use-module (rnrs bytevectors)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (guix records)
|
#:use-module (guix records)
|
||||||
#:use-module (gnu system uuid)
|
#:use-module (gnu system uuid)
|
||||||
|
@ -161,7 +162,7 @@ initrd code."
|
||||||
(match fs
|
(match fs
|
||||||
(($ <file-system> device title mount-point type flags options _ _ check?)
|
(($ <file-system> device title mount-point type flags options _ _ check?)
|
||||||
(list (if (uuid? device)
|
(list (if (uuid? device)
|
||||||
(uuid-bytevector device)
|
`(uuid ,(uuid-type device) ,(uuid-bytevector device))
|
||||||
device)
|
device)
|
||||||
title mount-point type flags options check?))))
|
title mount-point type flags options check?))))
|
||||||
|
|
||||||
|
@ -170,7 +171,12 @@ initrd code."
|
||||||
(match sexp
|
(match sexp
|
||||||
((device title mount-point type flags options check?)
|
((device title mount-point type flags options check?)
|
||||||
(file-system
|
(file-system
|
||||||
(device device) (title title)
|
(device (match device
|
||||||
|
(('uuid (? symbol? type) (? bytevector? bv))
|
||||||
|
(bytevector->uuid bv type))
|
||||||
|
(_
|
||||||
|
device)))
|
||||||
|
(title title)
|
||||||
(mount-point mount-point) (type type)
|
(mount-point mount-point) (type type)
|
||||||
(flags flags) (options options)
|
(flags flags) (options options)
|
||||||
(check? check?)))))
|
(check? check?)))))
|
||||||
|
|
Reference in New Issue