summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Marusich <cmmarusich@gmail.com>2016-11-01 22:48:13 -0700
committerLudovic Courtès <ludo@gnu.org>2016-11-06 18:08:53 +0100
commitaff7280a0b2fabd2657923fcce62332cd5629e7b (patch)
treea879c92e0b05e129dc3a0ef111b834854518feff
parent45e39eee21f958a6a1445bef46a39cbe4b298cd2 (diff)
downloadguix-aff7280a0b2fabd2657923fcce62332cd5629e7b.tar.gz
system: Optionally limit the entries returned by profile-grub-entries.
* guix/scripts/system.scm (profile-grub-entries): Add an optional parameter
which allows the caller to limit the number of returned grub entries.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--guix/scripts/system.scm9
1 files changed, 5 insertions, 4 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index eee4422d68..5bc40ed735 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -366,8 +366,10 @@ it atomically, and then run OS's activation script."
     (date->string (time-utc->date time)
                   "~Y-~m-~d ~H:~M")))
 
-(define* (profile-grub-entries #:optional (profile %system-profile))
-  "Return a list of 'menu-entry' for the generations of PROFILE."
+(define* (profile-grub-entries #:optional (profile %system-profile)
+                                  (numbers (generation-numbers profile)))
+  "Return a list of 'menu-entry' for the generations of PROFILE specified by
+NUMBERS, which is a list of generation numbers."
   (define (system->grub-entry system number time)
     (unless-file-not-found
      (let* ((file             (string-append system "/parameters"))
@@ -395,8 +397,7 @@ it atomically, and then run OS's activation script."
                 kernel-arguments))
         (initrd initrd)))))
 
-  (let* ((numbers (generation-numbers profile))
-         (systems (map (cut generation-file-name profile <>)
+  (let* ((systems (map (cut generation-file-name profile <>)
                        numbers))
          (times   (map (lambda (system)
                          (unless-file-not-found