diff options
| author | tiantian <typ22@foxmail.com> | 2022-09-05 01:25:42 +0800 |
|---|---|---|
| committer | Julien Lepiller <julien@lepiller.eu> | 2022-09-08 22:30:43 +0200 |
| commit | 32da9bbc91d365f514ae41528587905b21c41825 (patch) | |
| tree | 743e3299fc5abbaa43fb7a3bf0d3cbeee0a5679e /gnu/bootloader.scm | |
| parent | 1fc20e4c86697e9d112b9fed8079334c818dd78e (diff) | |
gnu: bootloader: Report error in menu-entry.
* gnu/bootloader.scm (report-menu-entry-error): New procedure.
(menu-entry->sexp): Add a call to `report-menu-entry-error'.
Co-Authored-By: Julien Lepiller <julien@lepiller.eu>
Signed-off-by: Julien Lepiller <julien@lepiller.eu>
Diffstat (limited to 'gnu/bootloader.scm')
| -rw-r--r-- | gnu/bootloader.scm | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 9fe6b65212e..da65b9d5d5d 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm | |||
| @@ -34,6 +34,8 @@ | |||
| 34 | #:use-module (guix diagnostics) | 34 | #:use-module (guix diagnostics) |
| 35 | #:use-module (guix i18n) | 35 | #:use-module (guix i18n) |
| 36 | #:use-module (srfi srfi-1) | 36 | #:use-module (srfi srfi-1) |
| 37 | #:use-module (srfi srfi-34) | ||
| 38 | #:use-module (srfi srfi-35) | ||
| 37 | #:use-module (ice-9 match) | 39 | #:use-module (ice-9 match) |
| 38 | #:export (menu-entry | 40 | #:export (menu-entry |
| 39 | menu-entry? | 41 | menu-entry? |
| @@ -110,6 +112,23 @@ | |||
| 110 | (chain-loader menu-entry-chain-loader | 112 | (chain-loader menu-entry-chain-loader |
| 111 | (default #f))) ; string, path of efi file | 113 | (default #f))) ; string, path of efi file |
| 112 | 114 | ||
| 115 | (define (report-menu-entry-error menu-entry) | ||
| 116 | (raise | ||
| 117 | (condition | ||
| 118 | (&message | ||
| 119 | (message | ||
| 120 | (format #f (G_ "invalid menu-entry: ~a") menu-entry))) | ||
| 121 | (&fix-hint | ||
| 122 | (hint | ||
| 123 | (G_ "Please chose only one of: | ||
| 124 | @enumerate | ||
| 125 | @item direct boot by specifying fields @code{linux}, | ||
| 126 | @code{linux-arguments} and @code{linux-modules}, | ||
| 127 | @item multiboot by specifying fields @code{multiboot-kernel}, | ||
| 128 | @code{multiboot-arguments} and @code{multiboot-modules}, | ||
| 129 | @item chain-loader by specifying field @code{chain-loader}. | ||
| 130 | @end enumerate")))))) | ||
| 131 | |||
| 113 | (define (menu-entry->sexp entry) | 132 | (define (menu-entry->sexp entry) |
| 114 | "Return ENTRY serialized as an sexp." | 133 | "Return ENTRY serialized as an sexp." |
| 115 | (define (device->sexp device) | 134 | (define (device->sexp device) |
| @@ -146,7 +165,8 @@ | |||
| 146 | (label ,label) | 165 | (label ,label) |
| 147 | (device ,(device->sexp device)) | 166 | (device ,(device->sexp device)) |
| 148 | (device-mount-point ,mount-point) | 167 | (device-mount-point ,mount-point) |
| 149 | (chain-loader ,chain-loader))))) | 168 | (chain-loader ,chain-loader))) |
| 169 | (_ (report-menu-entry-error entry)))) | ||
| 150 | 170 | ||
| 151 | (define (sexp->menu-entry sexp) | 171 | (define (sexp->menu-entry sexp) |
| 152 | "Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry> | 172 | "Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry> |
