diff mbox series

[bug#35394,3/3] system: Use locale information in grub.cfg.

Message ID 20191021124632.7d050b48@gmail.com
State Accepted
Headers show
Series [bug#35394,1/3] system: Add locale to boot-parameters. | expand

Commit Message

Miguel Arruga Vivas Oct. 21, 2019, 10:46 a.m. UTC
* gnu/bootloader/grub.scm (define-module): Add new dependency.
(grub-configuration-file)[locale-config]: New variable with generated
locale configuration when locale parameter has been provided.
[builder]: Add locale-config.
---
 gnu/bootloader/grub.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
diff mbox series

Patch

From c5f4f7d0d3564731dc29f563b70a05ab83eec061 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
 <rosen644835@gmail.com>
Date: Sat, 19 Oct 2019 13:28:48 +0200
Subject: [PATCH 3/3] system: Use locale information in grub.cfg.

* gnu/bootloader/grub.scm (define-module): Add new dependency.
(grub-configuration-file)[locale-config]: New variable with generated
locale configuration when locale parameter has been provided.
[builder]: Add locale-config.
---
 gnu/bootloader/grub.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index a0d068d1bd..8c3bab6fa7 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -3,6 +3,7 @@ 
 ;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2019 Miguel Ángel Arruga Vivas <rosen644835@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -28,6 +29,7 @@ 
   #:use-module (gnu system uuid)
   #:use-module (gnu system file-systems)
   #:use-module (gnu system keyboard)
+  #:use-module (gnu system locale)
   #:autoload   (gnu packages bootloaders) (grub)
   #:autoload   (gnu packages gtk) (guile-cairo guile-rsvg)
   #:autoload   (gnu packages xorg) (xkeyboard-config)
@@ -353,6 +355,20 @@  entries corresponding to old generations of the system."
                #:system system
                #:port #~port))
 
+  (define locale-config
+    #~(let ((locale #$(and locale
+                           (locale-definition-source
+                            (locale-name->definition locale)))))
+        (when locale
+          (format port "\
+# Localization configuration.
+if search --file --set boot_partition /grub/grub.cfg; then
+    set locale_dir=(${boot_partition})/grub/locale
+else
+    set locale_dir=/boot/grub/locale
+fi
+set lang=~a~%" locale))))
+
   (define keyboard-layout-config
     (let ((layout (bootloader-configuration-keyboard-layout config))
           (grub   (bootloader-package
@@ -372,6 +388,7 @@  keymap ~a~%" keymap)))))
 # will be lost upon reconfiguration.
 ")
           #$sugar
+          #$locale-config
           #$keyboard-layout-config
           (format port "
 set default=~a
-- 
2.23.0