diff options
author | Mathieu Othacehe <m.othacehe@gmail.com> | 2018-11-23 23:18:59 +0900 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-01-17 14:04:21 +0100 |
commit | a79617468e98c4c30ce2c972ae198feda4760c6e (patch) | |
tree | 91116eee8f43f3961d1b02443f7b3ddf9776d179 /gnu/installer | |
parent | 16006a05a1019c4d898ec22333bb2ba3d0784e96 (diff) |
gnu: installer: Launch the installer as kmscon login-program.
Source /etc/environment just before starting the installer. The login program
is supposed to load the environment variables of this file through PAM, but as
we replace it by the installer, they are no longer available. This is mostly
useful for the LANG environment variable.
* gnu/installer/build-installer.scm (installer-program-launcher): New exported
procedure.
* gnu/system/install.scm (%installation-services): Restore most of the origin
code. kmscon is only started on TTY1, and the graphical installer is the
login-program.
Diffstat (limited to 'gnu/installer')
-rw-r--r-- | gnu/installer/build-installer.scm | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/gnu/installer/build-installer.scm b/gnu/installer/build-installer.scm index 1a084bc3dc..c7f439b35f 100644 --- a/gnu/installer/build-installer.scm +++ b/gnu/installer/build-installer.scm @@ -37,7 +37,8 @@ #:use-module (gnu packages xorg) #:use-module (ice-9 match) #:use-module (srfi srfi-1) - #:export (installer-program)) + #:export (installer-program + installer-program-launcher)) (define not-config? ;; Select (guix …) and (gnu …) modules, except (guix config). @@ -288,3 +289,34 @@ selected keymap." #$(installer-exit installer))))) (program-file "installer" installer-builder)) + +;; We want the installer to honor the LANG environment variable, so that the +;; locale is correctly installed when the installer is launched, and the +;; welcome page is possibly translated. The /etc/environment file (containing +;; LANG) is supposed to be loaded using PAM by the login program. As the +;; installer replaces the login program, read this file and set all the +;; variables it contains before starting the installer. This is a dirty hack, +;; we might want to find a better way to do it in the future. +(define (installer-program-launcher installer) + "Return a file-like object that set the variables in /etc/environment and +run the given INSTALLER." + (define load-environment + #~(call-with-input-file "/etc/environment" + (lambda (port) + (let ((lines (read-lines port))) + (map (lambda (line) + (match (string-split line #\=) + ((name value) + (setenv name value)))) + lines))))) + + (define wrapper + (with-imported-modules '((gnu installer utils)) + #~(begin + (use-modules (gnu installer utils) + (ice-9 match)) + + #$load-environment + (system #$(installer-program installer))))) + + (program-file "installer-launcher" wrapper)) |