From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:34000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIvRw-0003et-57 for guix-patches@gnu.org; Tue, 23 Apr 2019 09:27:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIvRv-0001yn-2w for guix-patches@gnu.org; Tue, 23 Apr 2019 09:27:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39208) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hIvRu-0001yf-U7 for guix-patches@gnu.org; Tue, 23 Apr 2019 09:27:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hIvRu-0007GQ-PW for guix-patches@gnu.org; Tue, 23 Apr 2019 09:27:02 -0400 Subject: [bug#35394] [PATCH 3/3] system: Use locale information in grub.cfg. References: <20190423151702.05258473@gmail.com> In-Reply-To: <20190423151702.05258473@gmail.com> Resent-Message-ID: Date: Tue, 23 Apr 2019 15:26:35 +0200 From: Miguel Message-ID: <20190423152635.12dbc536@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/KavW6jjP_1SFvJBMk1CS2iO" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 35394@debbugs.gnu.org --MP_/KavW6jjP_1SFvJBMk1CS2iO Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline 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(+) --MP_/KavW6jjP_1SFvJBMk1CS2iO Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0003-system-Use-locale-information-in-grub.cfg.patch =46rom 762b00327be7a21ac3e04b10610666b0d323104b Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Miguel=3D20=3DC3=3D81ngel=3D20Arruga=3D20Vivas?=3D 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 =C2=A9 2016 Chris Marusich ;;; Copyright =C2=A9 2017 Leo Famulari ;;; Copyright =C2=A9 2017 Mathieu Othacehe +;;; Copyright =C2=A9 2019 Miguel =C3=81ngel Arruga Vivas ;;; ;;; 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)))) =20 +(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=3D~a + set lang=3D~a +fi~%" + #$(grub-root-search store-device (grub-locale-file)) + #$grub-locale-dir + #$grub-locale-dir + #$(grub-lang-id)))) + =0C ;;; ;;; 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-entri= es)) + #:locale locale #:port #~port)) =20 (define builder #~(call-with-output-file #$output @@ -374,6 +410,7 @@ keymap ~a~%" keymap))))) ") #$sugar #$keyboard-layout-config + #$locale-config (format port " set default=3D~a set timeout=3D~a~%" --=20 2.21.0 --MP_/KavW6jjP_1SFvJBMk1CS2iO--