system: Generate grub locale directory for grub.cfg.
* gnu/bootloader/grub.scm (grub-locale-directory): New function. (grub-configuration-file)[locale-config]: Use grub-locale-directory and avoid the extra search when eye-candy have performed it.
This commit is contained in:
parent
70876b0793
commit
f445bc6576
@ -142,6 +142,24 @@ file with the resolution provided in CONFIG."
|
|||||||
(image->png image #:width width #:height height))
|
(image->png image #:width width #:height height))
|
||||||
(_ #f)))))
|
(_ #f)))))
|
||||||
|
|
||||||
|
(define (grub-locale-directory grub)
|
||||||
|
"Generate a directory with the locales from GRUB."
|
||||||
|
(define builder
|
||||||
|
#~(begin
|
||||||
|
(use-modules (ice-9 ftw))
|
||||||
|
(let ((locale (string-append #$grub "/share/locale"))
|
||||||
|
(out #$output))
|
||||||
|
(mkdir out)
|
||||||
|
(chdir out)
|
||||||
|
(for-each (lambda (lang)
|
||||||
|
(let ((file (string-append locale "/" lang
|
||||||
|
"/LC_MESSAGES/grub.mo"))
|
||||||
|
(dest (string-append lang ".mo")))
|
||||||
|
(when (file-exists? file)
|
||||||
|
(copy-file file dest))))
|
||||||
|
(scandir locale)))))
|
||||||
|
(computed-file "grub-locales" builder))
|
||||||
|
|
||||||
(define* (eye-candy config store-device store-mount-point
|
(define* (eye-candy config store-device store-mount-point
|
||||||
#:key store-directory-prefix port)
|
#:key store-directory-prefix port)
|
||||||
"Return a gexp that writes to PORT (a port-valued gexp) the 'grub.cfg' part
|
"Return a gexp that writes to PORT (a port-valued gexp) the 'grub.cfg' part
|
||||||
@ -404,18 +422,33 @@ menuentry ~s {
|
|||||||
#:port #~port)))
|
#:port #~port)))
|
||||||
|
|
||||||
(define locale-config
|
(define locale-config
|
||||||
#~(let ((locale #$(and locale
|
(let* ((entry (first all-entries))
|
||||||
(locale-definition-source
|
(device (menu-entry-device entry))
|
||||||
(locale-name->definition locale)))))
|
(mount-point (menu-entry-device-mount-point entry))
|
||||||
(when locale
|
(bootloader (bootloader-configuration-bootloader config))
|
||||||
(format port "\
|
(grub (bootloader-package bootloader)))
|
||||||
|
#~(let ((locale #$(and locale
|
||||||
|
(locale-definition-source
|
||||||
|
(locale-name->definition locale))))
|
||||||
|
(locales #$(and locale
|
||||||
|
(normalize-file (grub-locale-directory grub)
|
||||||
|
mount-point
|
||||||
|
store-directory-prefix))))
|
||||||
|
(when locale
|
||||||
|
(format port "\
|
||||||
# Localization configuration.
|
# Localization configuration.
|
||||||
if search --file --set boot_partition /grub/grub.cfg; then
|
~asearch --file --set ~a/en@quot.mo
|
||||||
set locale_dir=(${boot_partition})/grub/locale
|
set locale_dir=~a
|
||||||
else
|
set lang=~a~%"
|
||||||
set locale_dir=/boot/grub/locale
|
;; Skip the search if there is an image, as it has already
|
||||||
fi
|
;; been performed by eye-candy and traversing the store is
|
||||||
set lang=~a~%" locale))))
|
;; an expensive operation.
|
||||||
|
#$(if (grub-theme-image (bootloader-theme config))
|
||||||
|
"# "
|
||||||
|
"")
|
||||||
|
locales
|
||||||
|
locales
|
||||||
|
locale)))))
|
||||||
|
|
||||||
(define keyboard-layout-config
|
(define keyboard-layout-config
|
||||||
(let* ((layout (bootloader-configuration-keyboard-layout config))
|
(let* ((layout (bootloader-configuration-keyboard-layout config))
|
||||||
|
Loading…
Reference in New Issue
Block a user