Subject: [bug#35394] [PATCH 2/3] system: Provide locale information to the bootloader.

From: Miguel Arruga Vivas <[email-masked]>
Date: Mon, 21 Oct 2019 12:46:24 +0200

* gnu/bootloader/depthcharge.scm (depthcharge-configuration-file): Add
locale keyword.
* gnu/bootloader/extlinux.scm (extlinux-configuration-file): Likewise.
* gnu/bootloader/grub.scm (grub-configuration-file): Likewise.
* gnu/system.scm (operating-system-bootcfg): Provide locale information
to the bootloader.
* guix/system/script.scm (reinstall-bootloader): Use locale information
from boot-parameters.
---
 gnu/bootloader/depthcharge.scm | 3 ++-
 gnu/bootloader/extlinux.scm    | 3 ++-
 gnu/bootloader/grub.scm        | 3 ++-
 gnu/system.scm                 | 4 +++-
 guix/scripts/system.scm        | 4 +++-
 5 files changed, 12 insertions(+), 5 deletions(-)
>From 4b3e52ff532b93611893a60a02d3fe21dca98276 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
 <[email-masked]>
Date: Mon, 22 Apr 2019 14:44:22 +0200
Subject: [PATCH 2/3] system: Provide locale information to the bootloader.

* gnu/bootloader/depthcharge.scm (depthcharge-configuration-file): Add
locale keyword.
* gnu/bootloader/extlinux.scm (extlinux-configuration-file): Likewise.
* gnu/bootloader/grub.scm (grub-configuration-file): Likewise.
* gnu/system.scm (operating-system-bootcfg): Provide locale information
to the bootloader.
* guix/system/script.scm (reinstall-bootloader): Use locale information
from boot-parameters.
---
 gnu/bootloader/depthcharge.scm | 3 ++-
 gnu/bootloader/extlinux.scm    | 3 ++-
 gnu/bootloader/grub.scm        | 3 ++-
 gnu/system.scm                 | 4 +++-
 guix/scripts/system.scm        | 4 +++-
 5 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/gnu/bootloader/depthcharge.scm b/gnu/bootloader/depthcharge.scm
index 58cc3f3932..0e0c17a255 100644
--- a/gnu/bootloader/depthcharge.scm
+++ b/gnu/bootloader/depthcharge.scm
@@ -82,7 +82,8 @@
 (define* (depthcharge-configuration-file config entries
                                          #:key
                                          (system (%current-system))
-                                         (old-entries '()))
+                                         (old-entries '())
+                                         (locale #f))
   (match entries
     ((entry)
      (let ((kernel (menu-entry-linux entry))
diff --git a/gnu/bootloader/extlinux.scm b/gnu/bootloader/extlinux.scm
index 40108584a8..e4ccc47484 100644
--- a/gnu/bootloader/extlinux.scm
+++ b/gnu/bootloader/extlinux.scm
@@ -28,7 +28,8 @@
 (define* (extlinux-configuration-file config entries
                                       #:key
                                       (system (%current-system))
-                                      (old-entries '()))
+                                      (old-entries '())
+                                      (locale #f))
   "Return the U-Boot configuration file corresponding to CONFIG, a
 <u-boot-configuration> object, and where the store is available at STORE-FS, a
 <file-system> object.  OLD-ENTRIES is taken to be a list of menu entries
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index d984d5f5e3..a0d068d1bd 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -316,7 +316,8 @@ code."
 (define* (grub-configuration-file config entries
                                   #:key
                                   (system (%current-system))
-                                  (old-entries '()))
+                                  (old-entries '())
+                                  (locale #f))
   "Return the GRUB configuration file corresponding to CONFIG, a
 <bootloader-configuration> object, and where the store is available at
 STORE-FS, a <file-system> object.  OLD-ENTRIES is taken to be a list of menu
diff --git a/gnu/system.scm b/gnu/system.scm
index be49724bc3..00f24f2e39 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -997,6 +997,7 @@ entry."
 a list of <menu-entry>, to populate the \"old entries\" menu."
   (let* ((root-fs         (operating-system-root-file-system os))
          (root-device     (file-system-device root-fs))
+         (locale          (operating-system-locale os))
          (params          (operating-system-boot-parameters
                            os root-device
                            #:system-kernel-arguments? #t))
@@ -1007,7 +1008,8 @@ a list of <menu-entry>, to populate the \"old entries\" menu."
        (bootloader-configuration-bootloader bootloader-conf)))
 
     (generate-config-file bootloader-conf (list entry)
-                          #:old-entries old-entries)))
+                          #:old-entries old-entries
+                          #:locale locale)))
 
 (define* (operating-system-boot-parameters os root-device
                                            #:key system-kernel-arguments?)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 27b014db68..f008405115 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -386,6 +386,7 @@ STORE is an open connection to the store."
          ;; Make the specified system generation the default entry.
          (params (first (profile-boot-parameters %system-profile
                                                  (list number))))
+         (locale (boot-parameters-locale params))
          (old-generations
           (delv number (reverse (generation-numbers %system-profile))))
          (old-params (profile-boot-parameters
@@ -398,7 +399,8 @@ STORE is an open connection to the store."
           ((bootcfg (lower-object
                      ((bootloader-configuration-file-generator bootloader)
                       bootloader-config entries
-                      #:old-entries old-entries)))
+                      #:old-entries old-entries
+                      #:locale locale)))
            (drvs -> (list bootcfg)))
         (mbegin %store-monad
           (show-what-to-build* drvs)
-- 
2.23.0