unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Miguel <rosen644835@gmail.com>
To: 35394@debbugs.gnu.org
Subject: [bug#35394] [PATCH 3/3] system: Use locale information in grub.cfg.
Date: Tue, 23 Apr 2019 15:26:35 +0200	[thread overview]
Message-ID: <20190423152635.12dbc536@gmail.com> (raw)
In-Reply-To: <20190423151702.05258473@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

system: Use locale information in grub.cfg.

* gnu/bootloader/grub.scm (locale-config-entries): New procedure.
(grub-configuration-file): Use locale-config-entries.
---
 gnu/bootloader/grub.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-system-Use-locale-information-in-grub.cfg.patch --]
[-- Type: text/x-patch, Size: 3361 bytes --]

From 762b00327be7a21ac3e04b10610666b0d323104b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
 <rosen644835@gmail.com>
Date: Tue, 23 Apr 2019 15:03:58 +0200
Subject: [PATCH 3/3] system: Use locale information in grub.cfg.

* gnu/bootloader/grub.scm (locale-config-entries): New procedure.
(grub-configuration-file): Use locale-config-entries.
---
 gnu/bootloader/grub.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 446f90157c..81c4e31e28 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)
@@ -216,6 +218,36 @@ fi~%"
                  #$(theme-colors grub-theme-color-normal)
                  #$(theme-colors grub-theme-color-highlight))))
 
+(define* (locale-config-entries config store-device store-mount-point
+                                #:key locale port)
+  "Return a gexp that writes to PORT (a port-valued gexp) the
+'grub.cfg' part concerned with locale configuration."
+  ;; FIXME: /boot in a separate partition is not suported.  The prefix must
+  ;; be removed in order to make it work.  GRUB EFI installation contains an
+  ;; usable /boot/efi/grub/locale/ folder too, but it is not used, for the
+  ;; same reason.
+  (define grub-locale-dir "/boot/grub/locale")
+  (define (grub-lang-id)
+    (let ((definition (locale-name->definition locale)))
+      (locale-definition-source definition)))
+  (define (grub-locale-file)
+    (string-append grub-locale-dir "/" (grub-lang-id) ".mo"))
+
+  (and locale
+       #~(format #$port "# Configure GRUB with the selected locale.
+
+# Set the root for the locale file
+~a
+
+if [ -d ~a ]; then
+  set locale_dir=~a
+  set lang=~a
+fi~%"
+                 #$(grub-root-search store-device (grub-locale-file))
+                 #$grub-locale-dir
+                 #$grub-locale-dir
+                 #$(grub-lang-id))))
+
 \f
 ;;;
 ;;; Configuration file.
@@ -364,6 +396,10 @@ entries corresponding to old generations of the system."
 terminal_input at_keyboard
 insmod keylayouts
 keymap ~a~%" keymap)))))
+  (define locale-config
+    (locale-config-entries config (menu-entry-device (first all-entries))
+                           (menu-entry-device-mount-point (first all-entries))
+                           #:locale locale #:port #~port))
 
   (define builder
     #~(call-with-output-file #$output
@@ -374,6 +410,7 @@ keymap ~a~%" keymap)))))
 ")
           #$sugar
           #$keyboard-layout-config
+          #$locale-config
           (format port "
 set default=~a
 set timeout=~a~%"
-- 
2.21.0


  parent reply	other threads:[~2019-04-23 13:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23 13:17 [bug#35394] [PATCH 0/3] Bootloader localization Miguel
2019-04-23 13:26 ` [bug#35394] [PATCH 1/3] system: Add locale to boot-parameters Miguel
2019-04-23 13:26 ` [bug#35394] [PATCH 2/3] system: Provide locale information to the bootloader Miguel
2019-04-23 13:26 ` Miguel [this message]
2019-04-26 10:50 ` [bug#35394] [PATCH 3/4] gnu: grub: Add locale output for bootloading Miguel
2019-05-03 12:27   ` Miguel
2019-04-26 10:51 ` [bug#35394] [PATCH 4/4] system: Use locale information in grub.cfg Miguel
2019-05-03 12:27   ` Miguel
2019-04-29  7:56 ` [bug#35394] [PATCH 0/3] Bootloader localization Ludovic Courtès
     [not found]   ` <20191021124035.531bed75@gmail.com>
2019-10-21 10:46     ` [bug#35394] [PATCH 1/3] system: Add locale to boot-parameters Miguel Arruga Vivas
2019-10-21 10:46     ` [bug#35394] [PATCH 2/3] system: Provide locale information to the bootloader Miguel Arruga Vivas
2019-10-21 10:46     ` [bug#35394] [PATCH 3/3] system: Use locale information in grub.cfg Miguel Arruga Vivas
2020-10-11 14:18 ` [bug#35394] [PATCH 1/1 v4] Grub i18n Miguel Ángel Arruga Vivas
2020-10-17 16:32   ` Ludovic Courtès
2020-10-18 15:09     ` [bug#35394] [PATCH 4/4 " Miguel Ángel Arruga Vivas
2020-10-18 15:43       ` Miguel Ángel Arruga Vivas
2020-10-19  8:50         ` Ludovic Courtès
2020-10-19 11:41           ` Miguel Ángel Arruga Vivas
2020-10-19 13:21             ` Ludovic Courtès
2020-10-19 13:44               ` Miguel Ángel Arruga Vivas
2020-10-20 20:50                 ` Ludovic Courtès
2020-10-20 21:19                   ` bug#35394: " Miguel Ángel Arruga Vivas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190423152635.12dbc536@gmail.com \
    --to=rosen644835@gmail.com \
    --cc=35394@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).