system: Add 'label' field to <operating-system>.

* gnu/system.scm (<operating-system>)[label]: New field.
(operating-system-default-label): New procedure.
(operating-system-boot-parameters): Use it instead of
'kernel->boot-label'.
* doc/guix.texi (operating-system Reference): Document it.
This commit is contained in:
Ludovic Courtès 2019-04-15 11:30:50 +02:00
parent 2c6c002ab7
commit 3f03a198b2
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 15 additions and 1 deletions

View File

@ -10436,6 +10436,10 @@ the command-line of the kernel---e.g., @code{("console=ttyS0")}.
@item @code{bootloader} @item @code{bootloader}
The system bootloader configuration object. @xref{Bootloader Configuration}. The system bootloader configuration object. @xref{Bootloader Configuration}.
@item @code{label}
This is the label (a string) as it appears in the bootloader's menu entry.
The default label includes the kernel name and version.
@item @code{keyboard-layout} (default: @code{#f}) @item @code{keyboard-layout} (default: @code{#f})
This field specifies the keyboard layout to use in the console. It can be This field specifies the keyboard layout to use in the console. It can be
either @code{#f}, in which case the default keyboard layout is used (usually either @code{#f}, in which case the default keyboard layout is used (usually

View File

@ -78,6 +78,8 @@
operating-system-kernel operating-system-kernel
operating-system-kernel-file operating-system-kernel-file
operating-system-kernel-arguments operating-system-kernel-arguments
operating-system-label
operating-system-default-label
operating-system-initrd-modules operating-system-initrd-modules
operating-system-initrd operating-system-initrd
operating-system-users operating-system-users
@ -160,6 +162,9 @@
(kernel-arguments operating-system-user-kernel-arguments (kernel-arguments operating-system-user-kernel-arguments
(default '())) ; list of gexps/strings (default '())) ; list of gexps/strings
(bootloader operating-system-bootloader) ; <bootloader-configuration> (bootloader operating-system-bootloader) ; <bootloader-configuration>
(label operating-system-label ; string
(thunked)
(default (operating-system-default-label this-operating-system)))
(keyboard-layout operating-system-keyboard-layout ;#f | <keyboard-layout> (keyboard-layout operating-system-keyboard-layout ;#f | <keyboard-layout>
(default #f)) (default #f))
@ -918,6 +923,11 @@ listed in OS. The C library expects to find it under
(inferior-package-version kernel))) (inferior-package-version kernel)))
(else "GNU"))) (else "GNU")))
(define (operating-system-default-label os)
"Return the default label for OS, as it will appear in the bootloader menu
entry."
(kernel->boot-label (operating-system-kernel os)))
(define (store-file-system file-systems) (define (store-file-system file-systems)
"Return the file system object among FILE-SYSTEMS that contains the store." "Return the file system object among FILE-SYSTEMS that contains the store."
(match (filter (lambda (fs) (match (filter (lambda (fs)
@ -966,7 +976,7 @@ such as '--root' and '--load' to <boot-parameters>."
(bootloader (bootloader-configuration-bootloader (bootloader (bootloader-configuration-bootloader
(operating-system-bootloader os))) (operating-system-bootloader os)))
(bootloader-name (bootloader-name bootloader)) (bootloader-name (bootloader-name bootloader))
(label (kernel->boot-label (operating-system-kernel os)))) (label (operating-system-label os)))
(boot-parameters (boot-parameters
(label label) (label label)
(root-device root-device) (root-device root-device)