diff options
| author | Mathieu Othacehe <othacehe@gnu.org> | 2021-12-30 11:33:37 +0100 |
|---|---|---|
| committer | Mathieu Othacehe <othacehe@gnu.org> | 2022-01-14 14:29:19 +0100 |
| commit | e92723452d2f1e7639579ea327d3fff6fa25ef4c (patch) | |
| tree | 7c2fb7493b723e334fb402db714eab74a26e7b1b | |
| parent | 0c9693d8b3f9ecd40732ec86b732bbf99f8e8b4d (diff) | |
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.
| -rw-r--r-- | gnu/installer/final.scm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gnu/installer/final.scm b/gnu/installer/final.scm index bef5f9fd525..276af908f71 100644 --- a/gnu/installer/final.scm +++ b/gnu/installer/final.scm | |||
| @@ -119,6 +119,28 @@ it can interact with the rest of the system." | |||
| 119 | (match (waitpid pid) | 119 | (match (waitpid pid) |
| 120 | ((_ . status) status)))) | 120 | ((_ . status) status)))) |
| 121 | 121 | ||
| 122 | (define (install-locale locale) | ||
| 123 | "Install the given LOCALE or the en_US.utf8 locale as a fallback." | ||
| 124 | (let ((supported? (false-if-exception | ||
| 125 | (setlocale LC_ALL locale)))) | ||
| 126 | (if supported? | ||
| 127 | (begin | ||
| 128 | (syslog "install supported locale ~a~%." locale) | ||
| 129 | (setenv "LC_ALL" locale)) | ||
| 130 | (begin | ||
| 131 | ;; If the selected locale is not supported, install a default UTF-8 | ||
| 132 | ;; locale. This is required to copy some files with UTF-8 | ||
| 133 | ;; characters, in the nss-certs package notably. Set LANGUAGE | ||
| 134 | ;; anyways, to have translated messages if possible. | ||
| 135 | (syslog "~a locale is not supported, installating en_US.utf8 \ | ||
| 136 | locale instead.~%" locale) | ||
| 137 | (setlocale LC_ALL "en_US.utf8") | ||
| 138 | (setenv "LC_ALL" "en_US.utf8") | ||
| 139 | (setenv "LANGUAGE" | ||
| 140 | (string-take locale | ||
| 141 | (or (string-index locale #\_) | ||
| 142 | (string-length locale)))))))) | ||
| 143 | |||
| 122 | (define* (install-system locale #:key (users '())) | 144 | (define* (install-system locale #:key (users '())) |
| 123 | "Create /etc/shadow and /etc/passwd on the installation target for USERS. | 145 | "Create /etc/shadow and /etc/passwd on the installation target for USERS. |
| 124 | Start COW-STORE service on target directory and launch guix install command in | 146 | Start COW-STORE service on target directory and launch guix install command in |
| @@ -169,6 +191,10 @@ or #f. Return #t on success and #f on failure." | |||
| 169 | (lambda () | 191 | (lambda () |
| 170 | (dynamic-wind | 192 | (dynamic-wind |
| 171 | (lambda () | 193 | (lambda () |
| 194 | ;; Install the locale before mounting the cow-store, otherwise | ||
| 195 | ;; the loaded cow-store locale files will prevent umounting. | ||
| 196 | (install-locale locale) | ||
| 197 | |||
| 172 | ;; Save the database, so that it can be restored once the | 198 | ;; Save the database, so that it can be restored once the |
| 173 | ;; cow-store is umounted. | 199 | ;; cow-store is umounted. |
| 174 | (copy-file database-file saved-database) | 200 | (copy-file database-file saved-database) |
