diff options
author | Mark H Weaver <mhw@netris.org> | 2018-05-28 20:45:37 -0400 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2018-05-28 20:45:37 -0400 |
commit | 82b695b834f88c5561de40e68f3fe7aa24d3b796 (patch) | |
tree | 41743fff1013584ee4a50852a94cff01c3cc3d1c /gnu/build | |
parent | fe365a3d0e4df7445bf16d3bb422a0bc6bb68ceb (diff) | |
parent | ee3c8fbee21299ce105bafca7dc63bfb096cd7c5 (diff) | |
download | patches-82b695b834f88c5561de40e68f3fe7aa24d3b796.tar patches-82b695b834f88c5561de40e68f3fe7aa24d3b796.tar.gz |
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/build')
-rw-r--r-- | gnu/build/file-systems.scm | 54 | ||||
-rw-r--r-- | gnu/build/linux-boot.scm | 12 | ||||
-rw-r--r-- | gnu/build/shepherd.scm | 3 |
3 files changed, 24 insertions, 45 deletions
diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm index 145b3b14e7..3dd7358fd3 100644 --- a/gnu/build/file-systems.scm +++ b/gnu/build/file-systems.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2016, 2017 David Craven <david@craven.ch> ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> ;;; @@ -473,17 +473,9 @@ were found." (find-partition luks-partition-uuid-predicate)) -(define* (canonicalize-device-spec spec #:optional (title 'any)) - "Return the device name corresponding to SPEC. TITLE is a symbol, one of -the following: - - • 'device', in which case SPEC is known to designate a device node--e.g., - \"/dev/sda1\"; - • 'label', in which case SPEC is known to designate a partition label--e.g., - \"my-root-part\"; - • 'uuid', in which case SPEC must be a UUID designating a partition; - • 'any', in which case SPEC can be anything. -" +(define (canonicalize-device-spec spec) + "Return the device name corresponding to SPEC, which can be a <uuid>, a +<file-system-label>, or a string (typically a /dev file name)." (define max-trials ;; Number of times we retry partition label resolution, 1 second per ;; trial. Note: somebody reported a delay of 16 seconds (!) before their @@ -491,19 +483,6 @@ the following: ;; this long. 20) - (define canonical-title - ;; The realm of canonicalization. - (if (eq? title 'any) - (if (string? spec) - ;; 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)) - (define (resolve find-partition spec fmt) (let loop ((count 0)) (let ((device (find-partition spec))) @@ -518,23 +497,19 @@ the following: (sleep 1) (loop (+ 1 count)))))))) - (case canonical-title - ((device) + (match spec + ((? string?) ;; Nothing to do. spec) - ((label) + ((? file-system-label?) ;; Resolve the label. - (resolve find-partition-by-label spec identity)) - ((uuid) + (resolve find-partition-by-label + (file-system-label->string spec) + identity)) + ((? uuid?) (resolve find-partition-by-uuid - (cond ((string? spec) - (string->uuid spec)) - ((uuid? spec) - (uuid-bytevector spec)) - (else spec)) - uuid->string)) - (else - (error "unknown device title" title)))) + (uuid-bytevector spec) + uuid->string)))) (define (check-file-system device type) "Run a file system check of TYPE on DEVICE." @@ -615,8 +590,7 @@ run a file system check." ""))))) (let ((type (file-system-type fs)) (options (file-system-options fs)) - (source (canonicalize-device-spec (file-system-device fs) - (file-system-title fs))) + (source (canonicalize-device-spec (file-system-device fs))) (mount-point (string-append root "/" (file-system-mount-point fs))) (flags (mount-flags->bit-mask (file-system-flags fs)))) diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm index 18d87260a9..44b3506284 100644 --- a/gnu/build/linux-boot.scm +++ b/gnu/build/linux-boot.scm @@ -507,9 +507,15 @@ upon error." (error "pre-mount actions failed"))) (if root - (mount-root-file-system (canonicalize-device-spec root) - root-fs-type - #:volatile-root? volatile-root?) + ;; 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. + (let ((root (cond ((string-prefix? "/" root) root) + ((uuid root) => identity) + (else (file-system-label root))))) + (mount-root-file-system (canonicalize-device-spec root) + root-fs-type + #:volatile-root? volatile-root?)) (mount "none" "/root" "tmpfs")) ;; Mount the specified file systems. diff --git a/gnu/build/shepherd.scm b/gnu/build/shepherd.scm index c955e3c83f..f383259924 100644 --- a/gnu/build/shepherd.scm +++ b/gnu/build/shepherd.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -55,7 +55,6 @@ (define (tmpfs directory) (file-system (device "none") - (title 'device) (mount-point directory) (type "tmpfs") (check? #f))) |