From 3191b5f6ba5ebbb59a7448facd999ad7f7aeae79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 25 Mar 2019 23:21:08 +0100 Subject: installer: Set the system's 'keyboard-layout' field. * gnu/installer/newt/keymap.scm (keyboard-layout->configuration): New procedure. * gnu/installer.scm (compute-keymap-step): Return RESULT. (installer-steps) <'keymap>: Add 'configuration-formatter' field. (installer-program): Use (gnu installer newt keymap). * gnu/installer/parted.scm (bootloader-configuration): Set 'keyboard-layout'. --- gnu/installer.scm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'gnu/installer.scm') diff --git a/gnu/installer.scm b/gnu/installer.scm index 479d940b4a..02f26eead3 100644 --- a/gnu/installer.scm +++ b/gnu/installer.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018 Mathieu Othacehe +;;; Copyright © 2019 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -156,7 +157,8 @@ selected keymap." (lambda (models layouts) ((installer-keymap-page current-installer) layouts))))) - (#$apply-keymap result)))) + (#$apply-keymap result) + result))) (define (installer-steps) (let ((locale-step (compute-locale-step @@ -208,7 +210,8 @@ selected keymap." (id 'keymap) (description (G_ "Keyboard mapping selection")) (compute (lambda _ - (#$keymap-step current-installer)))) + (#$keymap-step current-installer))) + (configuration-formatter keyboard-layout->configuration)) ;; Run a partitioning tool allowing the user to modify ;; partition tables, partitions and their mount points. @@ -313,6 +316,8 @@ selected keymap." (gnu installer timezone) (gnu installer user) (gnu installer newt) + ((gnu installer newt keymap) + #:select (keyboard-layout->configuration)) (guix i18n) (guix build utils) (ice-9 match)) -- cgit v1.2.3 From 50247be5f4633a4c3446cddbd3515d027853ec0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 26 Mar 2019 23:06:51 +0100 Subject: installer: Produce an 'initrd-modules' field if needed. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/installer/parted.scm (root-user-partition?): New procedure. (bootloader-configuration): Use it. (user-partition-missing-modules, initrd-configuration): New procedures. (user-partitions->configuration): Call 'initrd-configuration'.o * gnu/installer.scm (not-config?): Rename to... (module-to-import?): ... this. Add cases to exclude non-installer and non-build (gnu …) modules. (installer-program)[installer-builder]: Add GUIX to the extension list. --- gnu/installer.scm | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'gnu/installer.scm') diff --git a/gnu/installer.scm b/gnu/installer.scm index 02f26eead3..584ca3842f 100644 --- a/gnu/installer.scm +++ b/gnu/installer.scm @@ -43,13 +43,17 @@ #:use-module (srfi srfi-1) #:export (installer-program)) -(define not-config? - ;; Select (guix …) and (gnu …) modules, except (guix config). +(define module-to-import? + ;; Return true for modules that should be imported. For (gnu system …) and + ;; (gnu packages …) modules, we simply add the whole 'guix' package via + ;; 'with-extensions' (to avoid having to rebuild it all), which is why these + ;; modules are excluded here. (match-lambda (('guix 'config) #f) - (('guix rest ...) #t) - (('gnu rest ...) #t) - (rest #f))) + (('gnu 'installer _ ...) #t) + (('gnu 'build _ ...) #t) + (('guix 'build _ ...) #t) + (_ #f))) (define* (build-compiled-file name locale-builder) "Return a file-like object that evalutes the gexp LOCALE-BUILDER and store @@ -296,13 +300,15 @@ selected keymap." "gnu/installer")) (define installer-builder + ;; Note: Include GUIX as an extension to get all the (gnu system …), (gnu + ;; packages …), etc. modules. (with-extensions (list guile-gcrypt guile-newt guile-parted guile-bytestructures - guile-json) + guile-json guile-git guix) (with-imported-modules `(,@(source-module-closure `(,@modules (guix build utils)) - #:select? not-config?) + #:select? module-to-import?) ((guix config) => ,(make-config.scm))) #~(begin (use-modules (gnu installer record) -- cgit v1.2.3 From 850ddf94e86a1711328e39872c7830ad6d5020b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 7 Apr 2019 16:16:14 +0200 Subject: installer: Move the 'locale' step before the 'welcome' step. * gnu/installer.scm (installer-steps): Move the 'locale step before 'welcome. --- gnu/installer.scm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'gnu/installer.scm') diff --git a/gnu/installer.scm b/gnu/installer.scm index 584ca3842f..5694cef66f 100644 --- a/gnu/installer.scm +++ b/gnu/installer.scm @@ -174,14 +174,6 @@ selected keymap." "/share/zoneinfo/zone.tab"))) #~(lambda (current-installer) (list - ;; Welcome the user and ask him to choose between manual - ;; installation and graphical install. - (installer-step - (id 'welcome) - (compute (lambda _ - ((installer-welcome-page current-installer) - #$(local-file "installer/aux-files/logo.txt"))))) - ;; Ask the user to choose a locale among those supported by ;; the glibc. Install the selected locale right away, so that ;; the user may benefit from any available translation for the @@ -193,6 +185,14 @@ selected keymap." (#$locale-step current-installer))) (configuration-formatter locale->configuration)) + ;; Welcome the user and ask them to choose between manual + ;; installation and graphical install. + (installer-step + (id 'welcome) + (compute (lambda _ + ((installer-welcome-page current-installer) + #$(local-file "installer/aux-files/logo.txt"))))) + ;; Ask the user to select a timezone under glibc format. (installer-step (id 'timezone) -- cgit v1.2.3 From 75988317b22efee2b2719e7d559fa9ff01a9db9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 7 Apr 2019 17:15:06 +0200 Subject: installer: Generalize desktop environments to system services. * gnu/installer/services.scm (): Rename to... (): ... this. Add a 'type' field. (%desktop-environments): Rename to... (%system-services): ... this. (desktop-system-service?): New procedure. (desktop-environments->configuration): Rename to... (system-services->configuration): ... this. Determine the base list of services based on whether SERVICES contains at least one "desktop" service. * gnu/installer/newt/services.scm (run-desktop-environments-cbt-page): Adjust accordingly. * gnu/installer.scm (installer-steps): Likewise. --- gnu/installer.scm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gnu/installer.scm') diff --git a/gnu/installer.scm b/gnu/installer.scm index 5694cef66f..50e2e7d85e 100644 --- a/gnu/installer.scm +++ b/gnu/installer.scm @@ -256,8 +256,7 @@ selected keymap." (description (G_ "Services")) (compute (lambda _ ((installer-services-page current-installer)))) - (configuration-formatter - desktop-environments->configuration)) + (configuration-formatter system-services->configuration)) (installer-step (id 'final) -- cgit v1.2.3 From c7dc604253631588c659c1022256af98ec9262af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 12 Apr 2019 17:13:26 +0200 Subject: installer: Choosing a locale opens the translated manual on tty2. Suggested by Florian Pelz. * gnu/system/install.scm (%installation-node-names): New variable. (log-to-info): Expect the chosen locale as an argument. Compute the language, Info file name, and node name. Install the locale. (documentation-shepherd-service): Add 'locale' parameter to the 'start' action and honor it. Set GUIX_LOCPATH and TERM as environment variables for the process. * gnu/installer.scm (apply-locale): Use (gnu services herd). Call 'stop-service' and 'start-service' with the chosen locale. --- gnu/installer.scm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'gnu/installer.scm') diff --git a/gnu/installer.scm b/gnu/installer.scm index 50e2e7d85e..6a7a556271 100644 --- a/gnu/installer.scm +++ b/gnu/installer.scm @@ -91,9 +91,17 @@ version of this file." (define apply-locale ;; Install the specified locale. - #~(lambda (locale-name) - (false-if-exception - (setlocale LC_ALL locale-name)))) + (with-imported-modules (source-module-closure '((gnu services herd))) + #~(lambda (locale) + (false-if-exception + (setlocale LC_ALL locale)) + + ;; Restart the documentation viewer so it displays the manual in + ;; language that corresponds to LOCALE. + (with-error-to-port (%make-void-port "w") + (lambda () + (stop-service 'term-tty2) + (start-service 'term-tty2 (list locale))))))) (define* (compute-locale-step #:key locales-name @@ -323,6 +331,7 @@ selected keymap." (gnu installer newt) ((gnu installer newt keymap) #:select (keyboard-layout->configuration)) + (gnu services herd) (guix i18n) (guix build utils) (ice-9 match)) -- cgit v1.2.3 From 7837a57241775fed221c9e03700af73263e222ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 17 Apr 2019 11:07:21 +0200 Subject: installer: Display language and territory names natively. * gnu/installer.scm (installer-program): Add calls to 'bindtextdomain'. * gnu/installer/newt/locale.scm (run-locale-page) : Add calls to 'gettext'. --- gnu/installer.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gnu/installer.scm') diff --git a/gnu/installer.scm b/gnu/installer.scm index 6a7a556271..5baead8137 100644 --- a/gnu/installer.scm +++ b/gnu/installer.scm @@ -343,6 +343,16 @@ selected keymap." ;; Add some binaries used by the installers to PATH. #$set-installer-path + ;; Arrange for language and territory name translations to be + ;; available. We need them at run time, not just compile time, + ;; because some territories have several corresponding languages + ;; (e.g., "French" is always displayed as "français", but + ;; "Belgium" could be translated to Dutch, French, or German.) + (bindtextdomain "iso_639-3" ;languages + #+(file-append iso-codes "/share/locale")) + (bindtextdomain "iso_3166-1" ;territories + #+(file-append iso-codes "/share/locale")) + (let* ((current-installer newt-installer) (steps (#$steps current-installer))) ((installer-init current-installer)) -- cgit v1.2.3 From feaa83a377966b6cec982f0bbaba1ea15c28d52e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 17 Apr 2019 15:11:21 +0200 Subject: installer: Translate keyboard layout names. * gnu/installer.scm (installer-program)[installer-builder]: Call 'bindtextdomain' for "xkeyboard-config". * gnu/installer/newt/keymap.scm (run-keymap-page): Add calls to 'gettext'. --- gnu/installer.scm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gnu/installer.scm') diff --git a/gnu/installer.scm b/gnu/installer.scm index 5baead8137..881c40ee9b 100644 --- a/gnu/installer.scm +++ b/gnu/installer.scm @@ -353,6 +353,10 @@ selected keymap." (bindtextdomain "iso_3166-1" ;territories #+(file-append iso-codes "/share/locale")) + ;; Likewise for XKB keyboard layout names. + (bindtextdomain "xkeyboard-config" + #+(file-append xkeyboard-config "/share/locale")) + (let* ((current-installer newt-installer) (steps (#$steps current-installer))) ((installer-init current-installer)) -- cgit v1.2.3 From 6c849cdb988d403fec11ace82704535723de9e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 26 Apr 2019 12:07:31 +0200 Subject: installer: Run wrapped program with 'execl', not 'system'. 'system' invokes /bin/sh, which is certainly not needed here. * gnu/installer.scm (installer-program): Use 'execl', not 'system'. --- gnu/installer.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gnu/installer.scm') diff --git a/gnu/installer.scm b/gnu/installer.scm index 881c40ee9b..dfb0c9d0db 100644 --- a/gnu/installer.scm +++ b/gnu/installer.scm @@ -389,4 +389,5 @@ selected keymap." ;; some reason, unicode support is not correctly installed ;; when calling this in 'installer-builder'. (setenv "LANG" "en_US.UTF-8") - (system #$(program-file "installer-real" installer-builder))))) + (execl #$(program-file "installer-real" installer-builder) + "installer-real")))) -- cgit v1.2.3 From 98f035482fcb32683429a474f4071bd530c3c1b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 26 Apr 2019 14:08:39 +0200 Subject: installer: Actually reboot when the user presses "Reboot." * gnu/installer/newt/final.scm (run-install-success-page): Return 'success. * gnu/installer.scm (installer-program): Check the result of the 'final step and reboot upon success. --- gnu/installer.scm | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'gnu/installer.scm') diff --git a/gnu/installer.scm b/gnu/installer.scm index dfb0c9d0db..fe2841397e 100644 --- a/gnu/installer.scm +++ b/gnu/installer.scm @@ -314,6 +314,7 @@ selected keymap." guile-json guile-git guix) (with-imported-modules `(,@(source-module-closure `(,@modules + (gnu services herd) (guix build utils)) #:select? module-to-import?) ((guix config) => ,(make-config.scm))) @@ -363,10 +364,20 @@ selected keymap." (catch #t (lambda () - (run-installer-steps - #:rewind-strategy 'menu - #:menu-proc (installer-menu-page current-installer) - #:steps steps)) + (define results + (run-installer-steps + #:rewind-strategy 'menu + #:menu-proc (installer-menu-page current-installer) + #:steps steps)) + + (match (result-step results 'final) + ('success + ;; We did it! Let's reboot! + (sync) + (stop-service 'root)) + (_ ;installation failed + ;; TODO: Honor the result of 'run-install-failed-page'. + #f))) (const #f) (lambda (key . args) (let ((error-file "/tmp/last-installer-error")) -- cgit v1.2.3