guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/03: guix system: Fix 'describe' when booting the latest generation.


From: guix-commits
Subject: 03/03: guix system: Fix 'describe' when booting the latest generation.
Date: Tue, 15 Feb 2022 11:24:42 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 791069737c8c51582cc021438dae32eb0fb7b8e0
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Tue Feb 15 16:56:14 2022 +0100

    guix system: Fix 'describe' when booting the latest generation.
    
    Fixes a regression introduced in
    9679123ce083c69cdfd1505d95a4066d41280394, whereby 'guix system describe'
    would error out when /run/current-system points to /gnu/store/…-system,
    which is the case when booting the latest generation or after
    reconfigure.
    
    * guix/scripts/system.scm (process-command): For 'describe'. Try
    'generation-number' with and without the optional argument.
---
 guix/scripts/system.scm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 430815902d..a6e717d52c 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -1328,9 +1328,17 @@ argument list and OPTS is the option alist."
                       (x (leave (G_ "wrong number of arguments~%"))))))
        (list-generations pattern)))
     ((describe)
+     ;; Describe the running system, which is not necessarily the current
+     ;; generation.  /run/current-system might point to
+     ;; /var/guix/profiles/system-N-link, or it might point directly to
+     ;; /gnu/store/…-system.  Try both.
      (match (generation-number "/run/current-system" %system-profile)
        (0
-        (leave (G_ "no system generation, nothing to describe~%")))
+        (match (generation-number %system-profile)
+          (0
+           (leave (G_ "no system generation, nothing to describe~%")))
+          (generation
+           (display-system-generation generation))))
        (generation
         (display-system-generation generation))))
     ((search)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]