summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2016-08-20 03:49:42 -0400
committerMark H Weaver <mhw@netris.org>2016-08-20 04:48:31 -0400
commitc52bf877e9352cd9f29afb13fd4f7d39ed38f1a0 (patch)
tree8fd226f2b79905b44e39637f37bf46dbea1fe255
parentd760a2fc18c2ba89a183c9071133b8a113279f8a (diff)
downloadguix-c52bf877e9352cd9f29afb13fd4f7d39ed38f1a0.tar.gz
system: Fix 'guix system' when root fs is named by UUID.
Fixes <https://bugs.gnu.org/23881>.

* guix/scripts/system.scm (previous-grub-entries)
(display-system-generation): Handle the case where the root device is
specified by UUID.
-rw-r--r--guix/scripts/system.scm23
1 files changed, 15 insertions, 8 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 209ebf9752..4b53c3d263 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -52,6 +52,7 @@
   #:use-module (srfi srfi-35)
   #:use-module (srfi srfi-37)
   #:use-module (ice-9 match)
+  #:use-module (rnrs bytevectors)
   #:export (guix-system
             read-operating-system))
 
@@ -397,6 +398,9 @@ it atomically, and then run OS's activation script."
                                 read-boot-parameters))
             (label            (boot-parameters-label params))
             (root             (boot-parameters-root-device params))
+            (root-device      (if (bytevector? root)
+                                  (uuid->string root)
+                                  root))
             (kernel           (boot-parameters-kernel params))
             (kernel-arguments (boot-parameters-kernel-arguments params)))
        (menu-entry
@@ -405,7 +409,7 @@ it atomically, and then run OS's activation script."
                               (seconds->string time) ")"))
         (linux kernel)
         (linux-arguments
-         (cons* (string-append "--root=" root)
+         (cons* (string-append "--root=" root-device)
                 #~(string-append "--system=" #$system)
                 #~(string-append "--load=" #$system "/boot")
                 kernel-arguments))
@@ -473,18 +477,21 @@ list of services."
                                     #:optional (profile %system-profile))
   "Display a summary of system generation NUMBER in a human-readable format."
   (unless (zero? number)
-    (let* ((generation (generation-file-name profile number))
-           (param-file (string-append generation "/parameters"))
-           (params     (call-with-input-file param-file read-boot-parameters))
-           (label      (boot-parameters-label params))
-           (root       (boot-parameters-root-device params))
-           (kernel     (boot-parameters-kernel params)))
+    (let* ((generation  (generation-file-name profile number))
+           (param-file  (string-append generation "/parameters"))
+           (params      (call-with-input-file param-file read-boot-parameters))
+           (label       (boot-parameters-label params))
+           (root        (boot-parameters-root-device params))
+           (root-device (if (bytevector? root)
+                            (uuid->string root)
+                            root))
+           (kernel      (boot-parameters-kernel params)))
       (display-generation profile number)
       (format #t (_ "  file name: ~a~%") generation)
       (format #t (_ "  canonical file name: ~a~%") (readlink* generation))
       ;; TRANSLATORS: Please preserve the two-space indentation.
       (format #t (_ "  label: ~a~%") label)
-      (format #t (_ "  root device: ~a~%") root)
+      (format #t (_ "  root device: ~a~%") root-device)
       (format #t (_ "  kernel: ~a~%") kernel))))
 
 (define* (list-generations pattern #:optional (profile %system-profile))