aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'gnu')
-rw-r--r--gnu/system.scm8
-rw-r--r--gnu/system/grub.scm16
2 files changed, 18 insertions, 6 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 12d9f5fe02..0b62350c63 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -493,8 +493,9 @@ we're running in the final root."
(package-version kernel)
" (technology preview)"))
-(define (operating-system-grub.cfg os)
- "Return the GRUB configuration file for OS."
+(define* (operating-system-grub.cfg os #:optional (old-entries '()))
+ "Return the GRUB configuration file for OS. Use OLD-ENTRIES to populate the
+\"old entries\" menu."
(mlet* %store-monad
((system (operating-system-derivation os))
(root-fs -> (operating-system-root-file-system os))
@@ -509,7 +510,8 @@ we're running in the final root."
#~(string-append "--load=" #$system
"/boot")))
(initrd #~(string-append #$system "/initrd"))))))
- (grub-configuration-file (operating-system-bootloader os) entries)))
+ (grub-configuration-file (operating-system-bootloader os) entries
+ #:old-entries old-entries)))
(define (operating-system-parameters-file os)
"Return a file that describes the boot parameters of OS. The primary use of
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))