summary refs log tree commit diff
path: root/gnu/system
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-06-25 22:54:52 +0200
committerLudovic Courtès <ludo@gnu.org>2014-06-25 23:53:27 +0200
commitfe6e3fe2a56aede1d5e04bab3281515c8df86ff8 (patch)
tree352cdbc887b981e99aedd9a025e2823ae34f4d34 /gnu/system
parent64e40dbb692d537e67d1dccd727dd5c36e39a10e (diff)
downloadguix-fe6e3fe2a56aede1d5e04bab3281515c8df86ff8.tar.gz
system: Support the addition of old entries in the GRUB menu.
* gnu/system.scm (operating-system-grub.cfg): Add 'old-entries'
  parameter.  Pass it to 'grub-configuration-file'.
* gnu/system/grub.scm (grub-configuration-file): Add #:old-entries
  parameter.  Honor it.
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/grub.scm16
1 files changed, 13 insertions, 3 deletions
diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm
index e789e4c591..85a9fca9ff 100644
--- a/gnu/system/grub.scm
+++ b/gnu/system/grub.scm
@@ -63,9 +63,12 @@
   (initrd          menu-entry-initrd))     ; file name of the initrd as a gexp
 
 (define* (grub-configuration-file config entries
-                                  #:key (system (%current-system)))
+                                  #:key
+                                  (system (%current-system))
+                                  (old-entries '()))
   "Return the GRUB configuration file corresponding to CONFIG, a
-<grub-configuration> object."
+<grub-configuration> object.  OLD-ENTRIES is taken to be a list of menu
+entries corresponding to old generations of the system."
   (define all-entries
     (append entries (grub-configuration-menu-entries config)))
 
@@ -93,7 +96,14 @@ search.file ~a/bzImage~%"
                           (($ <menu-entry> _ linux)
                            linux))
                          all-entries))
-          #$@(map entry->gexp all-entries))))
+          #$@(map entry->gexp all-entries)
+
+          #$@(if (pair? old-entries)
+                 #~((format port "
+submenu \"GNU system, old configurations...\" {~%")
+                    #$@(map entry->gexp old-entries)
+                    (format port "}~%"))
+                 #~()))))
 
   (gexp->derivation "grub.cfg" builder))