From 7d7162a8ec78c84e7eba3ae9f7c4fbf07703617e Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Thu, 1 Feb 2018 08:59:30 +0300 Subject: [PATCH] bootloader: Add additional-options to menu-entry. * gnu/bootloader.scm ()[additional-options]: New field. * gnu/bootloader/grub.scm (grub-configuration-file): Handle this. --- gnu/bootloader.scm | 19 +++++++++++-------- gnu/bootloader/grub.scm | 27 +++++++++++++++++++-------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 736f11952..9a3c29a88 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -31,6 +31,7 @@ menu-entry-linux-arguments menu-entry-initrd menu-entry-device-mount-point + menu-entry-additional-options bootloader bootloader? @@ -65,15 +66,17 @@ (define-record-type* menu-entry make-menu-entry menu-entry? - (label menu-entry-label) - (device menu-entry-device ; file system uuid, label, or #f - (default #f)) + (label menu-entry-label) + (device menu-entry-device ; file system uuid, label, or #f + (default #f)) (device-mount-point menu-entry-device-mount-point - (default #f)) - (linux menu-entry-linux) - (linux-arguments menu-entry-linux-arguments - (default '())) ; list of string-valued gexps - (initrd menu-entry-initrd)) ; file name of the initrd as a gexp + (default #f)) + (linux menu-entry-linux) + (linux-arguments menu-entry-linux-arguments + (default '())) ; list of string-valued gexps + (initrd menu-entry-initrd) ; file name of the initrd as a gexp + (additional-options menu-entry-additional-options + (default '()))) ; list of string-valued gexps ;;; diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 96e53c5c2..7613c2a84 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -324,22 +324,33 @@ entries corresponding to old generations of the system." (label (menu-entry-label entry)) (kernel (menu-entry-linux entry)) (arguments (menu-entry-linux-arguments entry)) - (initrd (menu-entry-initrd entry))) + (initrd (menu-entry-initrd entry)) + (additional-options (menu-entry-additional-options entry))) ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. ;; Use the right file names for KERNEL and INITRD in case ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a ;; separate partition. - (let ((kernel (strip-mount-point device-mount-point kernel)) - (initrd (strip-mount-point device-mount-point initrd))) - #~(format port "menuentry ~s { + (if (and (file-append? kernel) (file-append? initrd)) + (let ((kernel (strip-mount-point device-mount-point kernel)) + (initrd (strip-mount-point device-mount-point initrd))) + #~(format port "menuentry ~s { ~a linux ~a ~a initrd ~a + ~a +}~%" + #$label + #$(grub-root-search device kernel) + #$kernel (string-join (list address@hidden)) + #$initrd + (string-join (list address@hidden) "\n"))) + #~(format port "menuentry ~s { + ~a + ~a }~%" - #$label - #$(grub-root-search device kernel) - #$kernel (string-join (list address@hidden)) - #$initrd)))) + #$label + #$(grub-root-search device kernel) + (string-join (list address@hidden) "\n"))))) (mlet %store-monad ((sugar (eye-candy config (menu-entry-device (first all-entries)) -- 2.15.1