guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/03: system: Use locale information in grub.cfg.


From: guix-commits
Subject: 03/03: system: Use locale information in grub.cfg.
Date: Sun, 18 Oct 2020 11:40:27 -0400 (EDT)

m1gu3l pushed a commit to branch master
in repository guix.

commit cfe9c7eceb00d6975b8d7ba8286ba03f0a7e64b5
Author: Miguel Ángel Arruga Vivas <rosen644835@gmail.com>
AuthorDate: Sat Nov 2 18:18:45 2019 +0100

    system: Use locale information in grub.cfg.
    
    * gnu/bootloader/grub.scm (define-module): Add new dependency.
    (grub-configuration-file): Add locale keyword.
    (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 | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 516a7d4..611580a 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2019 Miguel Ángel Arruga Vivas <rosen644835@gmail.com>
 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2020 Stefan <stefan-guix@vodafonemail.de>
 ;;;
@@ -33,6 +34,7 @@
   #:use-module (gnu system uuid)
   #:use-module (gnu system file-systems)
   #:use-module (gnu system keyboard)
+  #:use-module (gnu system locale)
   #:use-module (gnu packages bootloaders)
   #:autoload   (gnu packages gtk) (guile-cairo guile-rsvg)
   #:autoload   (gnu packages xorg) (xkeyboard-config)
@@ -334,6 +336,7 @@ code."
 
 (define* (grub-configuration-file config entries
                                   #:key
+                                  (locale #f)
                                   (system (%current-system))
                                   (old-entries '())
                                   store-directory-prefix)
@@ -398,6 +401,20 @@ menuentry ~s {
                  #:store-directory-prefix store-directory-prefix
                  #: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
@@ -422,6 +439,7 @@ keymap ~a~%" #$keymap))))
 # will be lost upon reconfiguration.
 ")
           #$(sugar)
+          #$locale-config
           #$keyboard-layout-config
           (format port "
 set default=~a



reply via email to

[Prev in Thread] Current Thread [Next in Thread]