From a79617468e98c4c30ce2c972ae198feda4760c6e Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Fri, 23 Nov 2018 23:18:59 +0900 Subject: 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. --- gnu/installer/build-installer.scm | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'gnu/installer') 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)) -- cgit v1.2.3