summary refs log tree commit diff
path: root/gnu/system.scm
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2018-05-28 20:45:37 -0400
committerMark H Weaver <mhw@netris.org>2018-05-28 20:45:37 -0400
commit82b695b834f88c5561de40e68f3fe7aa24d3b796 (patch)
tree41743fff1013584ee4a50852a94cff01c3cc3d1c /gnu/system.scm
parentfe365a3d0e4df7445bf16d3bb422a0bc6bb68ceb (diff)
parentee3c8fbee21299ce105bafca7dc63bfb096cd7c5 (diff)
downloadguix-82b695b834f88c5561de40e68f3fe7aa24d3b796.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/system.scm')
-rw-r--r--gnu/system.scm38
1 files changed, 21 insertions, 17 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 816e66415c..c53bccf82c 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -131,13 +131,16 @@
   "Prepend extra arguments to KERNEL-ARGUMENTS that allow SYSTEM.DRV to be
 booted from ROOT-DEVICE"
   (cons* (string-append "--root="
-                        (if (uuid? root-device)
-
-                            ;; Note: Always use the DCE format because that's
-                            ;; what (gnu build linux-boot) expects for the
-                            ;; '--root' kernel command-line option.
-                            (uuid->string (uuid-bytevector root-device) 'dce)
-                            root-device))
+                        (cond ((uuid? root-device)
+
+                               ;; Note: Always use the DCE format because that's
+                               ;; what (gnu build linux-boot) expects for the
+                               ;; '--root' kernel command-line option.
+                               (uuid->string (uuid-bytevector root-device)
+                                             'dce))
+                              ((file-system-label? root-device)
+                               (file-system-label->string root-device))
+                              (else root-device)))
          #~(string-append "--system=" #$system.drv)
          #~(string-append "--load=" #$system.drv "/boot")
          kernel-arguments))
@@ -251,10 +254,16 @@ file system labels."
     (match-lambda
       (('uuid (? symbol? type) (? bytevector? bv))
        (bytevector->uuid bv type))
+      (('file-system-label (? string? label))
+       (file-system-label label))
       ((? bytevector? bv)                         ;old format
        (bytevector->uuid bv 'dce))
       ((? string? device)
-       device)))
+       ;; It used to be that we would not distinguish between labels and
+       ;; device names.  Try to infer the right thing here.
+       (if (string-prefix? "/dev/" device)
+           device
+           (file-system-label device)))))
 
   (match (read port)
     (('boot-parameters ('version 0)
@@ -377,7 +386,7 @@ marked as 'needed-for-boot'."
   (let ((target (string-append "/dev/mapper/" (mapped-device-target device))))
     (find (lambda (fs)
             (or (member device (file-system-dependencies fs))
-                (and (eq? 'device (file-system-title fs))
+                (and (string? (file-system-device fs))
                      (string=? (file-system-device fs) target))))
           file-systems)))
 
@@ -933,13 +942,6 @@ listed in OS.  The C library expects to find it under
       (bootloader-configuration-bootloader bootloader-conf))
      bootloader-conf (list entry) #:old-entries old-entries)))
 
-(define (fs->boot-device fs)
-  "Given FS, a <file-system> object, return a value suitable for use as the
-device in a <menu-entry>."
-  (case (file-system-title fs)
-    ((uuid label device) (file-system-device fs))
-    (else #f)))
-
 (define (operating-system-boot-parameters os system.drv root-device)
   "Return a monadic <boot-parameters> record that describes the boot parameters
 of OS.  SYSTEM.DRV is either a derivation or #f.  If it's a derivation, adds
@@ -961,7 +963,7 @@ kernel arguments for that derivation to <boot-parameters>."
                 (operating-system-user-kernel-arguments os)))
              (initrd initrd)
              (bootloader-name bootloader-name)
-             (store-device (ensure-not-/dev (fs->boot-device store)))
+             (store-device (ensure-not-/dev (file-system-device store)))
              (store-mount-point (file-system-mount-point store))))))
 
 (define (device->sexp device)
@@ -969,6 +971,8 @@ kernel arguments for that derivation to <boot-parameters>."
   (match device
     ((? uuid? uuid)
      `(uuid ,(uuid-type uuid) ,(uuid-bytevector uuid)))
+    ((? file-system-label? label)
+     `(file-system-label ,(file-system-label->string label)))
     (_
      device)))