mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
installer: Install the locale before mounting the cow-store.
Fixes: <https://issues.guix.gnu.org/52831>. Make sure to install the en_US.utf8 fallback locale if the selected locale is not supported. * gnu/installer/final.scm (install-locale): New procedure. (install-system): Call it.
This commit is contained in:
parent
0c9693d8b3
commit
e92723452d
1 changed files with 26 additions and 0 deletions
|
@ -119,6 +119,28 @@ (define (call-with-mnt-container thunk)
|
|||
(match (waitpid pid)
|
||||
((_ . status) status))))
|
||||
|
||||
(define (install-locale locale)
|
||||
"Install the given LOCALE or the en_US.utf8 locale as a fallback."
|
||||
(let ((supported? (false-if-exception
|
||||
(setlocale LC_ALL locale))))
|
||||
(if supported?
|
||||
(begin
|
||||
(syslog "install supported locale ~a~%." locale)
|
||||
(setenv "LC_ALL" locale))
|
||||
(begin
|
||||
;; If the selected locale is not supported, install a default UTF-8
|
||||
;; locale. This is required to copy some files with UTF-8
|
||||
;; characters, in the nss-certs package notably. Set LANGUAGE
|
||||
;; anyways, to have translated messages if possible.
|
||||
(syslog "~a locale is not supported, installating en_US.utf8 \
|
||||
locale instead.~%" locale)
|
||||
(setlocale LC_ALL "en_US.utf8")
|
||||
(setenv "LC_ALL" "en_US.utf8")
|
||||
(setenv "LANGUAGE"
|
||||
(string-take locale
|
||||
(or (string-index locale #\_)
|
||||
(string-length locale))))))))
|
||||
|
||||
(define* (install-system locale #:key (users '()))
|
||||
"Create /etc/shadow and /etc/passwd on the installation target for USERS.
|
||||
Start COW-STORE service on target directory and launch guix install command in
|
||||
|
@ -169,6 +191,10 @@ (define (assert-exit x)
|
|||
(lambda ()
|
||||
(dynamic-wind
|
||||
(lambda ()
|
||||
;; Install the locale before mounting the cow-store, otherwise
|
||||
;; the loaded cow-store locale files will prevent umounting.
|
||||
(install-locale locale)
|
||||
|
||||
;; Save the database, so that it can be restored once the
|
||||
;; cow-store is umounted.
|
||||
(copy-file database-file saved-database)
|
||||
|
|
Loading…
Reference in a new issue