From 3191b5f6ba5ebbb59a7448facd999ad7f7aeae79 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès 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/newt/keymap.scm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/keymap.scm b/gnu/installer/newt/keymap.scm index 3e765bfdd4..948b54783c 100644 --- a/gnu/installer/newt/keymap.scm +++ b/gnu/installer/newt/keymap.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. ;;; @@ -27,7 +28,9 @@ #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) - #:export (run-keymap-page)) + #:use-module (ice-9 match) + #:export (run-keymap-page + keyboard-layout->configuration)) (define (run-layout-page layouts layout->text) (let ((title (G_ "Layout"))) @@ -120,3 +123,11 @@ names of the selected keyboard layout and variant." (list layout (or variant "")))) (format-result (run-installer-steps #:steps keymap-steps))) + +(define (keyboard-layout->configuration keymap) + "Return the operating system configuration snippet to install KEYMAP." + (match keymap + ((name "") + `((keyboard-layout (keyboard-layout ,name)))) + ((name variant) + `((keyboard-layout (keyboard-layout ,name ,variant)))))) -- cgit v1.2.3 From c73e554c3fe609ee2d66628f7f09cf7fa6c8d4a6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 27 Mar 2019 09:50:24 +0100 Subject: installer: Ask for confirmation before formatting partitions. * gnu/installer/newt/page.scm (run-confirmation-page): New procedure. * gnu/installer/newt/partition.scm (draw-formatting-page): Call it. --- gnu/installer/newt/page.scm | 38 ++++++++++++++++++++++++++++++++++++++ gnu/installer/newt/partition.scm | 8 +++++++- 2 files changed, 45 insertions(+), 1 deletion(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/page.scm b/gnu/installer/newt/page.scm index 23fbfcce76..8b3fd488e9 100644 --- a/gnu/installer/newt/page.scm +++ b/gnu/installer/newt/page.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. ;;; @@ -29,6 +30,7 @@ draw-connecting-page run-input-page run-error-page + run-confirmation-page run-listbox-selection-page run-scale-page run-checkbox-tree-page @@ -141,6 +143,42 @@ of the page is set to TITLE." (newt-set-color COLORSET-ROOT "white" "blue") (destroy-form-and-pop form))) +(define* (run-confirmation-page text title + #:key (exit-button-procedure (const #f))) + "Run a page to inform the user of an error. The page contains the given TEXT +to explain the error and an \"OK\" button to acknowledge the error. The title +of the page is set to TITLE." + (let* ((text-box + (make-reflowed-textbox -1 -1 text 40 + #:flags FLAG-BORDER)) + (ok-button (make-button -1 -1 (G_ "Continue"))) + (exit-button (make-button -1 -1 (G_ "Exit"))) + (grid (vertically-stacked-grid + GRID-ELEMENT-COMPONENT text-box + GRID-ELEMENT-SUBGRID + (horizontal-stacked-grid + GRID-ELEMENT-COMPONENT ok-button + GRID-ELEMENT-COMPONENT exit-button))) + (form (make-form))) + + (add-form-to-grid grid form #t) + (make-wrapped-grid-window grid title) + + (receive (exit-reason argument) + (run-form form) + (dynamic-wind + (const #t) + (lambda () + (case exit-reason + ((exit-component) + (cond + ((components=? argument ok-button) + #t) + ((components=? argument exit-button) + (exit-button-procedure)))))) + (lambda () + (destroy-form-and-pop form)))))) + (define* (run-listbox-selection-page #:key info-text title diff --git a/gnu/installer/newt/partition.scm b/gnu/installer/newt/partition.scm index d4c91edc66..373aedd24c 100644 --- a/gnu/installer/newt/partition.scm +++ b/gnu/installer/newt/partition.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. ;;; @@ -53,7 +54,12 @@ (car result))) (define (draw-formatting-page) - "Draw a page to indicate partitions are being formated." + "Draw a page asking for confirmation, and then indicating that partitions +are being formatted." + (run-confirmation-page (G_ "We are about to format your hard disk. All \ +its data will be lost. Do you wish to continue?") + (G_ "Format disk?") + #:exit-button-procedure button-exit-action) (draw-info-page (format #f (G_ "Partition formatting is in progress, please wait.")) (G_ "Preparing partitions"))) -- cgit v1.2.3 From 04d0aa99059e4925dcfb55d4d9a550f225948612 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 7 Apr 2019 12:11:55 +0200 Subject: installer: Simplify locale dialogs. * gnu/installer/newt/locale.scm (run-language-page): Simplify text. (run-territory-page): Likewise. (run-codeset-page): Likewise. (run-locale-page): Don't call 'run-codeset-page' when "UTF-8" is among the codesets of LOCALES. --- gnu/installer/newt/locale.scm | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/locale.scm b/gnu/installer/newt/locale.scm index 4fa07df81e..b819d06691 100644 --- a/gnu/installer/newt/locale.scm +++ b/gnu/installer/newt/locale.scm @@ -33,14 +33,8 @@ (let ((title (G_ "Locale language"))) (run-listbox-selection-page #:title title - #:info-text (G_ "Choose the locale's language to be used for the \ -installation process. A locale is a regional variant of your language \ -encompassing number, date and currency format, among other details. - -Based on the language you choose, you will possibly be asked to \ -select a locale's territory, codeset and modifier in the next \ -steps. The locale will also be used as the default one for the \ -installed system.") + #:info-text (G_ "Choose the language to use for the \ +installation process and for the installed system.") #:info-textbox-width 70 #:listbox-items languages #:listbox-item->text language->text @@ -56,8 +50,7 @@ installed system.") (let ((title (G_ "Locale location"))) (run-listbox-selection-page #:title title - #:info-text (G_ "Choose your locale's location. This is a shortlist of \ -locations based on the language you selected.") + #:info-text (G_ "Choose a territory for this language.") #:listbox-items territories #:listbox-item->text territory->text #:button-text (G_ "Back") @@ -71,8 +64,7 @@ locations based on the language you selected.") (let ((title (G_ "Locale codeset"))) (run-listbox-selection-page #:title title - #:info-text (G_ "Choose your locale's codeset. If UTF-8 is available, \ - it should be preferred.") + #:info-text (G_ "Choose the locale encoding.") #:listbox-items codesets #:listbox-item->text identity #:listbox-default-item "UTF-8" @@ -191,9 +183,11 @@ glibc locale string and return it." ;; narrow down the search of a locale. (break-on-locale-found locales) - ;; Otherwise, ask for a codeset. - (run-codeset-page - (delete-duplicates (map locale-codeset locales))))))) + ;; Otherwise, choose a codeset. + (let ((codesets (delete-duplicates (map locale-codeset locales)))) + (if (member "UTF-8" codesets) + "UTF-8" ;don't even ask + (run-codeset-page codesets))))))) (installer-step (id 'modifier) (compute -- cgit v1.2.3 From d1557774522e6c56ce8fc42470f845763473eb83 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 7 Apr 2019 16:21:52 +0200 Subject: installer: Fix wording for "Internet access." * gnu/installer/newt/network.scm (run-technology-page): Fix wording for "Internet access." --- gnu/installer/newt/network.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/network.scm b/gnu/installer/newt/network.scm index f13176dc61..37a2a45411 100644 --- a/gnu/installer/newt/network.scm +++ b/gnu/installer/newt/network.scm @@ -59,7 +59,7 @@ Internet and return the selected technology. For now, only technologies with (G_ "Internet access") (G_ "Continue") (G_ "Exit") - (G_ "The install process requires an internet access, but no \ + (G_ "The install process requires Internet access but no \ network device were found. Do you want to continue anyway?")) ((1) (raise (condition @@ -68,7 +68,7 @@ network device were found. Do you want to continue anyway?")) (condition (&installer-step-abort))))) (run-listbox-selection-page - #:info-text (G_ "The install process requires an internet access.\ + #:info-text (G_ "The install process requires Internet access.\ Please select a network device.") #:title (G_ "Internet access") #:listbox-items items -- cgit v1.2.3 From e8aa4e9511e500ae23439b653e0b5e0f78c31159 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 7 Apr 2019 16:25:07 +0200 Subject: installer: Remove SLiM-specific instructions. * gnu/installer/newt/services.scm (run-desktop-environments-cbt-page): Remove "with F1". --- gnu/installer/newt/services.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/services.scm b/gnu/installer/newt/services.scm index 6bcb6244ae..adeb1d784a 100644 --- a/gnu/installer/newt/services.scm +++ b/gnu/installer/newt/services.scm @@ -33,7 +33,7 @@ environments." (run-checkbox-tree-page #:info-text (G_ "Please select the desktop(s) environment(s) you wish to \ install. If you select multiple desktops environments, we will be able to \ -choose the one to use on the log-in screen with F1.") +choose the one to use on the log-in screen.") #:title (G_ "Desktop environment") #:items %desktop-environments #:item->text desktop-environment-name -- cgit v1.2.3 From 75988317b22efee2b2719e7d559fa9ff01a9db9a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès 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 +- gnu/installer/newt/services.scm | 6 +-- gnu/installer/services.scm | 87 ++++++++++++++++++++++++----------------- 3 files changed, 55 insertions(+), 41 deletions(-) (limited to 'gnu/installer/newt') 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) diff --git a/gnu/installer/newt/services.scm b/gnu/installer/newt/services.scm index adeb1d784a..2cbfc5ca36 100644 --- a/gnu/installer/newt/services.scm +++ b/gnu/installer/newt/services.scm @@ -32,11 +32,11 @@ environments." (run-checkbox-tree-page #:info-text (G_ "Please select the desktop(s) environment(s) you wish to \ -install. If you select multiple desktops environments, we will be able to \ +install. If you select multiple desktops environments, you will be able to \ choose the one to use on the log-in screen.") #:title (G_ "Desktop environment") - #:items %desktop-environments - #:item->text desktop-environment-name + #:items (filter desktop-system-service? %system-services) + #:item->text system-service-name #:checkbox-tree-height 5 #:exit-button-callback-procedure (lambda () diff --git a/gnu/installer/services.scm b/gnu/installer/services.scm index 2b6625f6af..8e482b7246 100644 --- a/gnu/installer/services.scm +++ b/gnu/installer/services.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. ;;; @@ -18,44 +19,58 @@ (define-module (gnu installer services) #:use-module (guix records) - #:export ( - desktop-environment - make-desktop-environment - desktop-environment-name - desktop-environment-snippet + #:use-module (srfi srfi-1) + #:export (system-service? + system-service-name + system-service-type + system-service-snippet - %desktop-environments - desktop-environments->configuration)) + desktop-system-service? -(define-record-type* - desktop-environment make-desktop-environment - desktop-environment? - (name desktop-environment-name) ;string - (snippet desktop-environment-snippet)) ;symbol + %system-services + system-services->configuration)) + +(define-record-type* + system-service make-system-service + system-service? + (name system-service-name) ;string + (type system-service-type) ;symbol + (snippet system-service-snippet)) ;sexp ;; This is the list of desktop environments supported as services. -(define %desktop-environments - (list - (desktop-environment - (name "GNOME") - (snippet '(service gnome-desktop-service-type))) - (desktop-environment - (name "Xfce") - ;; TODO: Use 'xfce-desktop-service-type' when the 'guix' package provides - ;; it with a default value. - (snippet '(xfce-desktop-service))) - (desktop-environment - (name "MATE") - (snippet '(service mate-desktop-service-type))) - (desktop-environment - (name "Enlightenment") - (snippet '(service enlightenment-desktop-service-type))))) +(define %system-services + (let-syntax ((desktop-environment (syntax-rules () + ((_ fields ...) + (system-service + (type 'desktop) + fields ...))))) + (list + (desktop-environment + (name "GNOME") + (snippet '(service gnome-desktop-service-type))) + (desktop-environment + (name "Xfce") + ;; TODO: Use 'xfce-desktop-service-type' when the 'guix' package provides + ;; it with a default value. + (snippet '(xfce-desktop-service))) + (desktop-environment + (name "MATE") + (snippet '(service mate-desktop-service-type))) + (desktop-environment + (name "Enlightenment") + (snippet '(service enlightenment-desktop-service-type)))))) + +(define (desktop-system-service? service) + "Return true if SERVICE is a desktop environment service." + (eq? 'desktop (system-service-type service))) -(define (desktop-environments->configuration desktop-environments) - "Return the configuration field for DESKTOP-ENVIRONMENTS." - (let ((snippets - (map desktop-environment-snippet desktop-environments))) - `(,@(if (null? snippets) - '() - `((services (cons* ,@snippets - %desktop-services))))))) +(define (system-services->configuration services) + "Return the configuration field for SERVICES." + (let* ((snippets (map system-service-snippet services)) + (desktop? (find desktop-system-service? services)) + (base (if desktop? + '%desktop-services + '%base-services))) + (if (null? snippets) + `((services ,base)) + `((services (cons* ,@snippets ,base)))))) -- cgit v1.2.3 From 7d1030a63592aa2f94f6617786f22cfa83fb346f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 7 Apr 2019 18:02:39 +0200 Subject: installer: Add dialog to select networking services. * gnu/installer/newt/services.scm (run-networking-cbt-page): New procedure. (run-services-page): Call it. * gnu/installer/services.scm (%system-services): Add OpenSSH and Tor. (networking-system-service?): New procedure. * gnu/installer/steps.scm (format-configuration): Add 'networking' and 'ssh' to the service modules. --- gnu/installer/newt/services.scm | 19 ++++++++++++++++++- gnu/installer/services.scm | 19 +++++++++++++++++-- gnu/installer/steps.scm | 2 +- 3 files changed, 36 insertions(+), 4 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/services.scm b/gnu/installer/newt/services.scm index 2cbfc5ca36..e1faf4871d 100644 --- a/gnu/installer/newt/services.scm +++ b/gnu/installer/newt/services.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. ;;; @@ -44,5 +45,21 @@ choose the one to use on the log-in screen.") (condition (&installer-step-abort)))))) +(define (run-networking-cbt-page) + "Run a page allowing the user to select networking services." + (run-checkbox-tree-page + #:info-text (G_ "You can now select networking services to run on your +system.") + #:title (G_ "Network service") + #:items (filter networking-system-service? %system-services) + #:item->text system-service-name + #:checkbox-tree-height 5 + #:exit-button-callback-procedure + (lambda () + (raise + (condition + (&installer-step-abort)))))) + (define (run-services-page) - (run-desktop-environments-cbt-page)) + (append (run-desktop-environments-cbt-page) + (run-networking-cbt-page))) diff --git a/gnu/installer/services.scm b/gnu/installer/services.scm index 8e482b7246..cb1ddc8de8 100644 --- a/gnu/installer/services.scm +++ b/gnu/installer/services.scm @@ -26,6 +26,7 @@ system-service-snippet desktop-system-service? + networking-system-service? %system-services system-services->configuration)) @@ -34,7 +35,7 @@ system-service make-system-service system-service? (name system-service-name) ;string - (type system-service-type) ;symbol + (type system-service-type) ;'desktop | 'networking (snippet system-service-snippet)) ;sexp ;; This is the list of desktop environments supported as services. @@ -58,12 +59,26 @@ (snippet '(service mate-desktop-service-type))) (desktop-environment (name "Enlightenment") - (snippet '(service enlightenment-desktop-service-type)))))) + (snippet '(service enlightenment-desktop-service-type))) + + ;; Networking. + (system-service + (name "OpenSSH secure shell daemon (sshd)") + (type 'networking) + (snippet '(service openssh-service-type))) + (system-service + (name "Tor anonymous network router") + (type 'networking) + (snippet '(service tor-service-type)))))) (define (desktop-system-service? service) "Return true if SERVICE is a desktop environment service." (eq? 'desktop (system-service-type service))) +(define (networking-system-service? service) + "Return true if SERVICE is a desktop environment service." + (eq? 'networking (system-service-type service))) + (define (system-services->configuration services) "Return the configuration field for SERVICES." (let* ((snippets (map system-service-snippet services)) diff --git a/gnu/installer/steps.scm b/gnu/installer/steps.scm index 3f0bdad4f7..96cfdd03d1 100644 --- a/gnu/installer/steps.scm +++ b/gnu/installer/steps.scm @@ -215,7 +215,7 @@ found in RESULTS." '()))) steps)) (modules '((use-modules (gnu)) - (use-service-modules desktop)))) + (use-service-modules desktop networking ssh)))) `(,@modules () (operating-system ,@configuration)))) -- cgit v1.2.3 From 2e55f37c0c8fdfbc413edff61490161648a78dcc Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 7 Apr 2019 21:20:10 +0200 Subject: installer: Offer NM, Connman, and DHCP to non-desktop installs. * gnu/installer/services.scm (%system-services): Add NetworkManager, Connman, and the DHCP client. * gnu/installer/newt/services.scm (run-networking-cbt-page): Add 'network-management?' parameter and honor it. (run-services-page): Adjust call accordingly. --- gnu/installer/newt/services.scm | 22 ++++++++++++++++------ gnu/installer/services.scm | 16 +++++++++++++++- 2 files changed, 31 insertions(+), 7 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/services.scm b/gnu/installer/newt/services.scm index e1faf4871d..76db31d9ab 100644 --- a/gnu/installer/newt/services.scm +++ b/gnu/installer/newt/services.scm @@ -45,13 +45,20 @@ choose the one to use on the log-in screen.") (condition (&installer-step-abort)))))) -(define (run-networking-cbt-page) - "Run a page allowing the user to select networking services." +(define (run-networking-cbt-page network-management?) + "Run a page allowing the user to select networking services. When +NETWORK-MANAGEMENT? is true, include network management services like +NetworkManager." (run-checkbox-tree-page - #:info-text (G_ "You can now select networking services to run on your + #:info-text (G_ "You can now select networking services to run on your \ system.") #:title (G_ "Network service") - #:items (filter networking-system-service? %system-services) + #:items (filter (let ((types (if network-management? + '(network-management networking) + '(networking)))) + (lambda (service) + (memq (system-service-type service) types))) + %system-services) #:item->text system-service-name #:checkbox-tree-height 5 #:exit-button-callback-procedure @@ -61,5 +68,8 @@ system.") (&installer-step-abort)))))) (define (run-services-page) - (append (run-desktop-environments-cbt-page) - (run-networking-cbt-page))) + (let ((desktop (run-desktop-environments-cbt-page))) + ;; When the user did not select any desktop services, and thus didn't get + ;; '%desktop-services', offer network management services. + (append desktop + (run-networking-cbt-page (null? desktop))))) diff --git a/gnu/installer/services.scm b/gnu/installer/services.scm index cb1ddc8de8..b79c2dfdc9 100644 --- a/gnu/installer/services.scm +++ b/gnu/installer/services.scm @@ -69,7 +69,21 @@ (system-service (name "Tor anonymous network router") (type 'networking) - (snippet '(service tor-service-type)))))) + (snippet '(service tor-service-type))) + + ;; Network connectivity management. + (system-service + (name "NetworkManager network connection manager") + (type 'network-management) + (snippet '(service network-manager-service-type))) + (system-service + (name "Connman network connection manager") + (type 'network-management) + (snippet '(service connman-service-type))) + (system-service + (name "DHCP client") + (type 'network-management) + (snippet '(service dhcp-client-service)))))) (define (desktop-system-service? service) "Return true if SERVICE is a desktop environment service." -- cgit v1.2.3 From 62b0f044f14569ffcaeb7a068e879a9422fdecbd Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 7 Apr 2019 21:41:51 +0200 Subject: installer: Internationalize service "names". * gnu/installer/services.scm (%system-services): Mark networking service names with 'G_'. * gnu/installer/newt/services.scm (run-networking-cbt-page): Pass 'system-service-name' through 'G_'. --- gnu/installer/newt/services.scm | 4 ++-- gnu/installer/services.scm | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/services.scm b/gnu/installer/newt/services.scm index 76db31d9ab..10c19115ca 100644 --- a/gnu/installer/newt/services.scm +++ b/gnu/installer/newt/services.scm @@ -37,7 +37,7 @@ install. If you select multiple desktops environments, you will be able to \ choose the one to use on the log-in screen.") #:title (G_ "Desktop environment") #:items (filter desktop-system-service? %system-services) - #:item->text system-service-name + #:item->text system-service-name ;no i18n for DE names #:checkbox-tree-height 5 #:exit-button-callback-procedure (lambda () @@ -59,7 +59,7 @@ system.") (lambda (service) (memq (system-service-type service) types))) %system-services) - #:item->text system-service-name + #:item->text (compose G_ system-service-name) #:checkbox-tree-height 5 #:exit-button-callback-procedure (lambda () diff --git a/gnu/installer/services.scm b/gnu/installer/services.scm index b79c2dfdc9..46ade0f8fa 100644 --- a/gnu/installer/services.scm +++ b/gnu/installer/services.scm @@ -44,7 +44,9 @@ ((_ fields ...) (system-service (type 'desktop) - fields ...))))) + fields ...)))) + (G_ (syntax-rules () ;for xgettext + ((_ str) str)))) (list (desktop-environment (name "GNOME") @@ -63,25 +65,25 @@ ;; Networking. (system-service - (name "OpenSSH secure shell daemon (sshd)") + (name (G_ "OpenSSH secure shell daemon (sshd)")) (type 'networking) (snippet '(service openssh-service-type))) (system-service - (name "Tor anonymous network router") + (name (G_ "Tor anonymous network router")) (type 'networking) (snippet '(service tor-service-type))) ;; Network connectivity management. (system-service - (name "NetworkManager network connection manager") + (name (G_ "NetworkManager network connection manager")) (type 'network-management) (snippet '(service network-manager-service-type))) (system-service - (name "Connman network connection manager") + (name (G_ "Connman network connection manager")) (type 'network-management) (snippet '(service connman-service-type))) (system-service - (name "DHCP client") + (name (G_ "DHCP client (dynamic IP address assignment)")) (type 'network-management) (snippet '(service dhcp-client-service)))))) -- cgit v1.2.3 From a886eedfae6832afd52c65febaaffd1fbbd2dec6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 7 Apr 2019 22:00:22 +0200 Subject: installer: Adjust welcome page message. * gnu/installer/newt/welcome.scm (run-welcome-page): Make the message less scary. --- gnu/installer/newt/welcome.scm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/welcome.scm b/gnu/installer/newt/welcome.scm index b0b5429c0f..aec3e7a612 100644 --- a/gnu/installer/newt/welcome.scm +++ b/gnu/installer/newt/welcome.scm @@ -95,9 +95,11 @@ installation and reboot." (G_ "GNU Guix install") (G_ "Welcome to GNU Guix system installer! -Please note that the present graphical installer is still under heavy \ -development, so you might want to prefer using the shell based process. \ -The documentation is accessible at any time by pressing CTRL-ALT-F2.") +You will be guided through a graphical installation program. + +If you are familiar with GNU/Linux and you want tight control over \ +the installation process, you can instead choose manual installation. \ +Documentation is accessible at any time by pressing Ctrl-Alt-F2.") logo #:listbox-items `((,(G_ "Graphical install using a terminal based interface") -- cgit v1.2.3 From 7cd38788e6180eea64974c87a899d8e9613e3e9a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 14 Apr 2019 23:19:35 +0200 Subject: installer: Force user to choose exactly one network management method. Previously, for non-desktop configs, users could choose any number of network management methods, including 0, 2, or more. * gnu/installer/newt/services.scm (run-networking-cbt-page): Remove 'network-management?' parameter and select only 'networking services. (run-network-management-page): New procedure. (run-services-page): Call it when DESKTOP is the empty list. --- gnu/installer/newt/services.scm | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/services.scm b/gnu/installer/newt/services.scm index 10c19115ca..2a221790d2 100644 --- a/gnu/installer/newt/services.scm +++ b/gnu/installer/newt/services.scm @@ -45,19 +45,14 @@ choose the one to use on the log-in screen.") (condition (&installer-step-abort)))))) -(define (run-networking-cbt-page network-management?) - "Run a page allowing the user to select networking services. When -NETWORK-MANAGEMENT? is true, include network management services like -NetworkManager." +(define (run-networking-cbt-page) + "Run a page allowing the user to select networking services." (run-checkbox-tree-page #:info-text (G_ "You can now select networking services to run on your \ system.") #:title (G_ "Network service") - #:items (filter (let ((types (if network-management? - '(network-management networking) - '(networking)))) - (lambda (service) - (memq (system-service-type service) types))) + #:items (filter (lambda (service) + (eq? 'networking (system-service-type service))) %system-services) #:item->text (compose G_ system-service-name) #:checkbox-tree-height 5 @@ -67,9 +62,35 @@ system.") (condition (&installer-step-abort)))))) +(define (run-network-management-page) + "Run a page to select among several network management methods." + (let ((title (G_ "Network management"))) + (run-listbox-selection-page + #:title title + #:info-text (G_ "Choose the method to manage network connections. + +We recommend NetworkManager or Connman for a WiFi-capable laptop; the DHCP \ +client may be enough for a server.") + #:info-textbox-width 70 + #:listbox-items (filter (lambda (service) + (eq? 'network-management + (system-service-type service))) + %system-services) + #:listbox-item->text (compose G_ system-service-name) + #:sort-listbox-items? #f + #:button-text (G_ "Exit") + #:button-callback-procedure + (lambda _ + (raise + (condition + (&installer-step-abort))))))) + (define (run-services-page) (let ((desktop (run-desktop-environments-cbt-page))) ;; When the user did not select any desktop services, and thus didn't get ;; '%desktop-services', offer network management services. (append desktop - (run-networking-cbt-page (null? desktop))))) + (run-networking-cbt-page) + (if (null? desktop) + (list (run-network-management-page)) + '())))) -- cgit v1.2.3 From 2d5867a213c4d23882e463d599eb236032086250 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 17 Apr 2019 10:34:02 +0200 Subject: installer: Change language as soon as it has been chosen. Previously we'd call 'setlocale' only after the complete 'locale' step had finished. * gnu/installer/newt/locale.scm (run-language-page): Set the 'LANGUAGE' environment variable before returning. --- gnu/installer/newt/locale.scm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/locale.scm b/gnu/installer/newt/locale.scm index b819d06691..01bcf76025 100644 --- a/gnu/installer/newt/locale.scm +++ b/gnu/installer/newt/locale.scm @@ -30,9 +30,9 @@ #:export (run-locale-page)) (define (run-language-page languages language->text) - (let ((title (G_ "Locale language"))) + (define result (run-listbox-selection-page - #:title title + #:title (G_ "Locale language") #:info-text (G_ "Choose the language to use for the \ installation process and for the installed system.") #:info-textbox-width 70 @@ -44,7 +44,13 @@ installation process and for the installed system.") (lambda _ (raise (condition - (&installer-step-abort))))))) + (&installer-step-abort)))))) + + ;; Immediately install the chosen language so that the territory page that + ;; comes after (optionally) is displayed in the chosen language. + (setenv "LANGUAGE" result) + + result) (define (run-territory-page territories territory->text) (let ((title (G_ "Locale location"))) -- cgit v1.2.3 From 7837a57241775fed221c9e03700af73263e222ed Mon Sep 17 00:00:00 2001 From: Ludovic Courtès 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 ++++++++++ gnu/installer/newt/locale.scm | 18 +++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) (limited to 'gnu/installer/newt') 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)) diff --git a/gnu/installer/newt/locale.scm b/gnu/installer/newt/locale.scm index 01bcf76025..7108e2960b 100644 --- a/gnu/installer/newt/locale.scm +++ b/gnu/installer/newt/locale.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. ;;; @@ -161,7 +162,13 @@ glibc locale string and return it." (run-language-page (sort-languages (delete-duplicates (map locale-language supported-locales))) - (cut language-code->language-name iso639-languages <>))))) + (lambda (language) + (let ((english (language-code->language-name iso639-languages + language))) + (setenv "LANGUAGE" language) + (let ((native (gettext english "iso_639-3"))) + (unsetenv "LANGUAGE") + native))))))) (installer-step (id 'territory) (compute @@ -175,10 +182,11 @@ glibc locale string and return it." ;; supported by the previously selected language. (run-territory-page (delete-duplicates (map locale-territory locales)) - (lambda (territory-code) - (if territory-code - (territory-code->territory-name iso3166-territories - territory-code) + (lambda (territory) + (if territory + (let ((english (territory-code->territory-name + iso3166-territories territory))) + (gettext english "iso_3166-1")) (G_ "No location")))))))) (installer-step (id 'codeset) -- cgit v1.2.3 From 7cb7be17af77caa084c1b5ebf20748dd04f208fa Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 17 Apr 2019 11:41:52 +0200 Subject: installer: Look up timezone name translations in "iso_3166-1". * gnu/installer/newt/timezone.scm (run-timezone-page): Add call to 'gettext' for timezone names. --- gnu/installer/newt/timezone.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/timezone.scm b/gnu/installer/newt/timezone.scm index 63b44af729..67bf41ff84 100644 --- a/gnu/installer/newt/timezone.scm +++ b/gnu/installer/newt/timezone.scm @@ -50,12 +50,15 @@ returned." (define (run-page timezone-tree) (define (loop path) + ;; XXX: Translation of time zones isn't perfect here because the + ;; "iso_3166-1" domain contains translation for "territories" (like + ;; "Antarctic") but not for continents (like "Africa"). (let ((timezones (locate-children timezone-tree path))) (run-listbox-selection-page #:title (G_ "Timezone") #:info-text (G_ "Please select a timezone.") #:listbox-items timezones - #:listbox-item->text identity + #:listbox-item->text (cut gettext <> "iso_3166-1") #:button-text (if (null? path) (G_ "Exit") (G_ "Back")) -- cgit v1.2.3 From 14755829dc268a3983036908750f4ea40c5224b3 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 17 Apr 2019 11:51:31 +0200 Subject: installer: Sort items with 'string-locale key). It that case, a list containing the selected items will be returned. If SORT-LISTBOX-ITEMS? is set to #t, the listbox items are sorted using -'string<=' procedure (after being converted to text). +'string-locale key is pressed, otherwise nothing will happen. @@ -249,7 +250,7 @@ ITEM was inserted into LISTBOX." items)) (define (sort-listbox-items listbox-items) - "Return LISTBOX-ITEMS sorted using the 'string<=' procedure on the text + "Return LISTBOX-ITEMS sorted using the 'string-localetext item))) @@ -258,7 +259,7 @@ corresponding to each item in the list." (sort items (lambda (a b) (let ((text-a (cdr a)) (text-b (cdr b))) - (string<= text-a text-b)))))) + (string-locale 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 ++++ gnu/installer/newt/keymap.scm | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'gnu/installer/newt') 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)) diff --git a/gnu/installer/newt/keymap.scm b/gnu/installer/newt/keymap.scm index 948b54783c..623bfe079d 100644 --- a/gnu/installer/newt/keymap.scm +++ b/gnu/installer/newt/keymap.scm @@ -97,7 +97,8 @@ names of the selected keyboard layout and variant." (run-layout-page (sort-layouts layouts) (lambda (layout) - (x11-keymap-layout-description layout)))))) + (gettext (x11-keymap-layout-description layout) + "xkeyboard-config")))))) ;; Propose the user to select a variant among those supported by the ;; previously selected layout. (installer-step @@ -111,15 +112,16 @@ names of the selected keyboard layout and variant." (run-variant-page (sort-variants variants) (lambda (variant) - (x11-keymap-variant-description - variant)))))))))) + (gettext (x11-keymap-variant-description variant) + "xkeyboard-config")))))))))) (define (format-result result) (let ((layout (x11-keymap-layout-name (result-step result 'layout))) (variant (and=> (result-step result 'variant) (lambda (variant) - (x11-keymap-variant-name variant))))) + (gettext (x11-keymap-variant-name variant) + "xkeyboard-config"))))) (list layout (or variant "")))) (format-result (run-installer-steps #:steps keymap-steps))) -- cgit v1.2.3 From 9015e63996156dfaafecef182d20128f268c2719 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 17 Apr 2019 15:16:08 +0200 Subject: installer: Sort keyboard layouts according to language and translations. Previously, we would always (1) put English first, and (2) sort the other layouts based on their English description. This fixes both issues. * gnu/installer/newt/keymap.scm (sort-layouts)[layoutconfiguration)) @@ -64,14 +65,29 @@ (define (sort-layouts layouts) "Sort LAYOUTS list by putting the US layout ahead and return it." + (define (layout <>))) + (lambda (main others) + (append (sort main layout Date: Tue, 23 Apr 2019 00:08:54 +0200 Subject: installer: Run 'guix system init' with the right locale. * gnu/installer/utils.scm (run-shell-command): Add #:locale and honor it. * gnu/installer/newt/final.scm (run-install-shell): Add 'locale' parameter; pass it to 'install-system'. (run-final-page): Obtain locale from RESULT; pass it to 'run-install-shell'. * gnu/installer/final.scm (install-system): Add 'locale' parameter; pass it to 'run-shell-command'. --- gnu/installer/final.scm | 8 +++++--- gnu/installer/newt/final.scm | 9 +++++---- gnu/installer/utils.scm | 14 +++++++++++++- 3 files changed, 23 insertions(+), 8 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/final.scm b/gnu/installer/final.scm index e1c62f5ce0..07946f72c3 100644 --- a/gnu/installer/final.scm +++ b/gnu/installer/final.scm @@ -24,13 +24,15 @@ #:use-module (guix build utils) #:export (install-system)) -(define (install-system) +(define (install-system locale) "Start COW-STORE service on target directory and launch guix install command -in a subshell." +in a subshell. LOCALE must be the locale name under which that command will +run, or #f." (let ((install-command (format #f "guix system init ~a ~a" (%installer-configuration-file) (%installer-target-dir)))) (mkdir-p (%installer-target-dir)) (start-service 'cow-store (list (%installer-target-dir))) - (false-if-exception (run-shell-command install-command)))) + (false-if-exception (run-shell-command install-command + #:locale locale)))) diff --git a/gnu/installer/newt/final.scm b/gnu/installer/newt/final.scm index 645c1e8689..f492c5dbb7 100644 --- a/gnu/installer/newt/final.scm +++ b/gnu/installer/newt/final.scm @@ -65,22 +65,23 @@ press the button to reboot."))) (G_ "The final system installation step failed. You can retry the \ last step, or restart the installer."))) -(define (run-install-shell) +(define (run-install-shell locale) (clear-screen) (newt-suspend) - (let ((install-ok? (install-system))) + (let ((install-ok? (install-system locale))) (newt-resume) install-ok?)) (define (run-final-page result prev-steps) - (let* ((configuration (format-configuration prev-steps result)) + (let* ((configuration (format-configuration prev-steps result)) (user-partitions (result-step result 'partition)) + (locale (result-step result 'locale)) (install-ok? (with-mounted-partitions user-partitions (configuration->file configuration) (run-config-display-page) - (run-install-shell)))) + (run-install-shell locale)))) (if install-ok? (run-install-success-page) (run-install-failed-page)))) diff --git a/gnu/installer/utils.scm b/gnu/installer/utils.scm index e91f90a84d..256722729c 100644 --- a/gnu/installer/utils.scm +++ b/gnu/installer/utils.scm @@ -54,9 +54,21 @@ number. If no percentage is found, return #f" (and result (string->number (match:substring result 1))))) -(define (run-shell-command command) +(define* (run-shell-command command #:key locale) + "Run COMMAND, a string, with Bash, and in the given LOCALE." (call-with-temporary-output-file (lambda (file port) + (when locale + (let ((supported? (false-if-exception + (setlocale LC_ALL locale)))) + ;; If LOCALE is not supported, then set LANGUAGE, which might at + ;; least give us translated messages. + (if supported? + (format port "export LC_ALL=\"~a\"~%" locale) + (format port "export LANGUAGE=\"~a\"~%" + (string-take locale + (string-index locale #\_)))))) + (format port "~a~%" command) ;; (format port "exit~%") (close port) -- cgit v1.2.3 From 3cc033f2a86d44da44f63ee45602dca0cb0932b2 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 24 Apr 2019 16:20:56 +0200 Subject: installer: Add missing 'G_' for networking message. * gnu/installer/newt/network.scm (wait-technology-powered): Add missing 'G_'. --- gnu/installer/newt/network.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/network.scm b/gnu/installer/newt/network.scm index 37a2a45411..cf27a8cca2 100644 --- a/gnu/installer/newt/network.scm +++ b/gnu/installer/newt/network.scm @@ -93,7 +93,8 @@ network device were found. Do you want to continue anyway?")) (full-value 5)) (run-scale-page #:title (G_ "Powering technology") - #:info-text (format #f "Waiting for technology ~a to be powered." name) + #:info-text (format #f (G_ "Waiting for technology ~a to be powered.") + name) #:scale-full-value full-value #:scale-update-proc (lambda (value) -- cgit v1.2.3 From 898677ed17672130d20434cd88575d620c97c553 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 24 Apr 2019 17:59:06 +0200 Subject: installer: Ask for user password and initialize /etc/shadow. Partly fixes . * gnu/installer/user.scm ()[password]: New field. * gnu/installer/final.scm (%seed): New variable. (integer->alphanumeric-char, random-string) (create-user-database): New procedures. (install-system): Call 'create-user-database'. * gnu/installer/newt/final.scm (run-install-shell): Add #:users and pass it to 'install-system'. (run-final-page): Pass #:users to 'run-install-shell'. * gnu/installer/newt/user.scm (run-user-add-page): Add password entry. Pass its result as the 'password' field of . --- gnu/installer/final.scm | 84 +++++++++++++++++++++++++++++++++++++++++--- gnu/installer/newt/final.scm | 9 +++-- gnu/installer/newt/user.scm | 21 +++++++---- gnu/installer/user.scm | 2 ++ 4 files changed, 103 insertions(+), 13 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/final.scm b/gnu/installer/final.scm index 07946f72c3..4cf34d0457 100644 --- a/gnu/installer/final.scm +++ b/gnu/installer/final.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. ;;; @@ -20,19 +21,94 @@ #:use-module (gnu installer newt page) #:use-module (gnu installer steps) #:use-module (gnu installer utils) + #:use-module (gnu installer user) #:use-module (gnu services herd) #:use-module (guix build utils) + #:use-module (gnu build accounts) + #:use-module ((gnu system shadow) #:prefix sys:) + #:use-module (rnrs io ports) #:export (install-system)) -(define (install-system locale) - "Start COW-STORE service on target directory and launch guix install command -in a subshell. LOCALE must be the locale name under which that command will -run, or #f." +(define %seed + (seed->random-state + (logxor (getpid) (car (gettimeofday))))) + +(define (integer->alphanumeric-char n) + "Map N, an integer in the [0..62] range, to an alphanumeric character." + (cond ((< n 10) + (integer->char (+ (char->integer #\0) n))) + ((< n 36) + (integer->char (+ (char->integer #\A) (- n 10)))) + ((< n 62) + (integer->char (+ (char->integer #\a) (- n 36)))) + (else + (error "integer out of bounds" n)))) + +(define (random-string len) + "Compute a random string of size LEN where each character is alphanumeric." + (let loop ((chars '()) + (len len)) + (if (zero? len) + (list->string chars) + (let ((n (random 62 %seed))) + (loop (cons (integer->alphanumeric-char n) chars) + (- len 1)))))) + +(define (create-user-database users root) + "Create /etc/passwd, /etc/shadow, and /etc/group under ROOT for the given +USERS." + (define etc + (string-append root "/etc")) + + (define (salt) + ;; "$6" gives us a SHA512 password hash; the random string must be taken + ;; from the './0-9A-Za-z' alphabet (info "(libc) Passphrase Storage"). + (string-append "$6$" (random-string 10))) + + (define users* + (map (lambda (user) + (sys:user-account (name (user-name user)) + (group "users") + (home-directory + (user-home-directory user)) + (password (crypt (user-password user) + (salt))) + + ;; We need a string here, not a file-like, hence + ;; this choice. + (shell + "/run/current-system/profile/bin/bash"))) + users)) + + (define-values (group password shadow) + (user+group-databases users* sys:%base-groups + #:current-passwd '() + #:current-groups '() + #:current-shadow '())) + + (mkdir-p etc) + (write-group group (string-append etc "/group")) + (write-passwd password (string-append etc "/passwd")) + (write-shadow shadow (string-append etc "/shadow"))) + +(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 +a subshell. LOCALE must be the locale name under which that command will run, +or #f." (let ((install-command (format #f "guix system init ~a ~a" (%installer-configuration-file) (%installer-target-dir)))) (mkdir-p (%installer-target-dir)) + + ;; We want to initialize user passwords but we don't want to store them in + ;; the config file since the password hashes would end up world-readable + ;; in the store. Thus, create /etc/shadow & co. here such that, on the + ;; first boot, the activation snippet that creates accounts will reuse the + ;; passwords that we've put in there. + (create-user-database users (%installer-target-dir)) + (start-service 'cow-store (list (%installer-target-dir))) (false-if-exception (run-shell-command install-command #:locale locale)))) diff --git a/gnu/installer/newt/final.scm b/gnu/installer/newt/final.scm index f492c5dbb7..f470a90004 100644 --- a/gnu/installer/newt/final.scm +++ b/gnu/installer/newt/final.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. ;;; @@ -65,10 +66,11 @@ press the button to reboot."))) (G_ "The final system installation step failed. You can retry the \ last step, or restart the installer."))) -(define (run-install-shell locale) +(define* (run-install-shell locale + #:key (users '())) (clear-screen) (newt-suspend) - (let ((install-ok? (install-system locale))) + (let ((install-ok? (install-system locale #:users users))) (newt-resume) install-ok?)) @@ -76,12 +78,13 @@ last step, or restart the installer."))) (let* ((configuration (format-configuration prev-steps result)) (user-partitions (result-step result 'partition)) (locale (result-step result 'locale)) + (users (result-step result 'user)) (install-ok? (with-mounted-partitions user-partitions (configuration->file configuration) (run-config-display-page) - (run-install-shell locale)))) + (run-install-shell locale #:users users)))) (if install-ok? (run-install-success-page) (run-install-failed-page)))) diff --git a/gnu/installer/newt/user.scm b/gnu/installer/newt/user.scm index 59b1913cfc..032f9b9276 100644 --- a/gnu/installer/newt/user.scm +++ b/gnu/installer/newt/user.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. ;;; @@ -36,10 +37,14 @@ (make-label -1 -1 (pad-label (G_ "Name")))) (label-home-directory (make-label -1 -1 (pad-label (G_ "Home directory")))) + (label-password + (make-label -1 -1 (pad-label (G_ "Password")))) (entry-width 30) (entry-name (make-entry -1 -1 entry-width)) (entry-home-directory (make-entry -1 -1 entry-width)) - (entry-grid (make-grid 2 2)) + (entry-password (make-entry -1 -1 entry-width + #:flags FLAG-PASSWORD)) + (entry-grid (make-grid 3 4)) (button-grid (make-grid 1 1)) (ok-button (make-button -1 -1 (G_ "OK"))) (grid (make-grid 1 2)) @@ -52,6 +57,8 @@ (set-entry-grid-field 1 0 entry-name) (set-entry-grid-field 0 1 label-home-directory) (set-entry-grid-field 1 1 entry-home-directory) + (set-entry-grid-field 0 2 label-password) + (set-entry-grid-field 1 2 entry-password) (set-grid-field button-grid 0 0 GRID-ELEMENT-COMPONENT ok-button) @@ -62,8 +69,8 @@ (string-append "/home/" (entry-value entry-name))))) (add-components-to-form form - label-name label-home-directory - entry-name entry-home-directory + label-name label-home-directory label-password + entry-name entry-home-directory entry-password ok-button) (make-wrapped-grid-window (vertically-stacked-grid @@ -82,8 +89,9 @@ (when (eq? exit-reason 'exit-component) (cond ((components=? argument ok-button) - (let ((name (entry-value entry-name)) - (home-directory (entry-value entry-home-directory))) + (let ((name (entry-value entry-name)) + (home-directory (entry-value entry-home-directory)) + (password (entry-value entry-password))) (if (or (string=? name "") (string=? home-directory "")) (begin @@ -91,7 +99,8 @@ (run-user-add-page)) (user (name name) - (home-directory home-directory)))))))) + (home-directory home-directory) + (password password)))))))) (lambda () (destroy-form-and-pop form))))))) diff --git a/gnu/installer/user.scm b/gnu/installer/user.scm index 1f8d40a011..fe755ad2c6 100644 --- a/gnu/installer/user.scm +++ b/gnu/installer/user.scm @@ -24,6 +24,7 @@ user-name user-group user-home-directory + user-password users->configuration)) @@ -33,6 +34,7 @@ (name user-name) (group user-group (default "users")) + (password user-password) (home-directory user-home-directory)) (define (users->configuration users) -- cgit v1.2.3 From 399c31d40a918343c5513c3c4a0351f60ec5797b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 24 Apr 2019 20:03:57 +0200 Subject: installer: 'run-input-page' has a new #:input-flags parameter. * gnu/installer/newt/page.scm (run-input-page): Add #:input-flags and honor it. --- gnu/installer/newt/page.scm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/page.scm b/gnu/installer/newt/page.scm index 5c650652bd..e9514e110f 100644 --- a/gnu/installer/newt/page.scm +++ b/gnu/installer/newt/page.scm @@ -75,17 +75,20 @@ this page to TITLE." #:key (allow-empty-input? #f) (default-text #f) - (input-field-width 40)) + (input-field-width 40) + (input-flags 0)) "Run a page to prompt user for an input. The given TEXT will be displayed above the input field. The page title is set to TITLE. Unless allow-empty-input? is set to #t, an error page will be displayed if the user -enters an empty input." +enters an empty input. INPUT-FLAGS is a bitwise-or'd set of flags for the +input box, such as FLAG-PASSWORD." (let* ((text-box (make-reflowed-textbox -1 -1 text input-field-width #:flags FLAG-BORDER)) (grid (make-grid 1 3)) - (input-entry (make-entry -1 -1 20)) + (input-entry (make-entry -1 -1 20 + #:flags input-flags)) (ok-button (make-button -1 -1 (G_ "OK"))) (form (make-form))) -- cgit v1.2.3 From 91a7c4998fe4f5a2a63f2ddb4bfeeef81c68b6d7 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 24 Apr 2019 21:54:28 +0200 Subject: installer: Ask for the root account password. Fixes . * gnu/installer/newt/user.scm (run-root-password-page): New procedure. * gnu/installer/user.scm (users->configuration): Filter out the "root" account. * gnu/installer/final.scm (create-user-database): Set 'uid' field in 'user-account' form. --- gnu/installer/final.scm | 4 ++++ gnu/installer/newt/user.scm | 15 ++++++++++++++- gnu/installer/user.scm | 25 +++++++++++++++---------- 3 files changed, 33 insertions(+), 11 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/final.scm b/gnu/installer/final.scm index 4cf34d0457..bf68a5aa2c 100644 --- a/gnu/installer/final.scm +++ b/gnu/installer/final.scm @@ -67,8 +67,12 @@ USERS." (define users* (map (lambda (user) + (define root? + (string=? "root" (user-name user))) + (sys:user-account (name (user-name user)) (group "users") + (uid (if root? 0 #f)) (home-directory (user-home-directory user)) (password (crypt (user-password user) diff --git a/gnu/installer/newt/user.scm b/gnu/installer/newt/user.scm index 032f9b9276..327e294362 100644 --- a/gnu/installer/newt/user.scm +++ b/gnu/installer/newt/user.scm @@ -104,6 +104,14 @@ (lambda () (destroy-form-and-pop form))))))) +(define (run-root-password-page) + ;; TRANSLATORS: Leave "root" untranslated: it refers to the name of the + ;; system administrator account. + (run-input-page (G_ "Please choose a password for the system \ +administrator (\"root\").") + (G_ "System administrator password") + #:input-flags FLAG-PASSWORD)) + (define (run-user-page) (define (run users) (let* ((listbox (make-listbox @@ -181,4 +189,9 @@ users)))) (lambda () (destroy-form-and-pop form)))))) - (run '())) + + ;; Add a "root" user simply to convey the root password. + (cons (user (name "root") + (home-directory "/root") + (password (run-root-password-page))) + (run '()))) diff --git a/gnu/installer/user.scm b/gnu/installer/user.scm index fe755ad2c6..29fab6414e 100644 --- a/gnu/installer/user.scm +++ b/gnu/installer/user.scm @@ -18,6 +18,7 @@ (define-module (gnu installer user) #:use-module (guix records) + #:use-module (srfi srfi-1) #:export ( user make-user @@ -39,14 +40,18 @@ (define (users->configuration users) "Return the configuration field for USERS." + (define (user->sexp user) + `(user-account + (name ,(user-name user)) + (group ,(user-group user)) + (home-directory ,(user-home-directory user)) + (supplementary-groups '("wheel" "netdev" + "audio" "video")))) + `((users (cons* - ,@(map (lambda (user) - `(user-account - (name ,(user-name user)) - (group ,(user-group user)) - (home-directory ,(user-home-directory user)) - (supplementary-groups - (quote ("wheel" "netdev" - "audio" "video"))))) - users) - %base-user-accounts)))) + ,@(filter-map (lambda (user) + ;; Do not emit a 'user-account' form for "root". + (and (not (string=? (user-name user) "root")) + (user->sexp user))) + users) + %base-user-accounts)))) -- cgit v1.2.3 From e7c7b7332075fadbbea3a2e041e7290958ac2354 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 25 Apr 2019 00:43:00 +0200 Subject: installer: Preserve order of user accounts. * gnu/installer/newt/user.scm (run-user-page): Add call to 'reverse'. --- gnu/installer/newt/user.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/user.scm b/gnu/installer/newt/user.scm index 327e294362..76eb63b710 100644 --- a/gnu/installer/newt/user.scm +++ b/gnu/installer/newt/user.scm @@ -186,7 +186,7 @@ administrator (\"root\").") (run-error-page (G_ "Please create at least one user.") (G_ "No user")) (run users)) - users)))) + (reverse users))))) (lambda () (destroy-form-and-pop form)))))) -- cgit v1.2.3 From 453c976501bb4d5c4c6b832b7c0c1ec3d493b80f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 25 Apr 2019 10:32:03 +0200 Subject: installer: Use FLAG-PASSWORD for the encryption passphrase confirmation. * gnu/installer/newt/partition.scm (prompt-luks-passwords) : Pass #:input-flags to 'run-input-page'. --- gnu/installer/newt/partition.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/partition.scm b/gnu/installer/newt/partition.scm index 373aedd24c..5eaba7aea9 100644 --- a/gnu/installer/newt/partition.scm +++ b/gnu/installer/newt/partition.scm @@ -152,6 +152,10 @@ USER-PARTITIONS list. Return this list with password fields filled-in." (file-name (user-partition-file-name user-part)) (password-page (lambda () + ;; Note: Don't use FLAG-PASSWORD here because this is the + ;; first bit of text that the user types in, so it's + ;; probably safer if they can see that the keyboard layout + ;; they chose is in effect. (run-input-page (format #f (G_ "Please enter the password for the \ encryption of partition ~a (label: ~a).") file-name crypt-label) @@ -161,7 +165,8 @@ encryption of partition ~a (label: ~a).") file-name crypt-label) (run-input-page (format #f (G_ "Please confirm the password for the \ encryption of partition ~a (label: ~a).") file-name crypt-label) - (G_ "Password confirmation required"))))) + (G_ "Password confirmation required") + #:input-flags FLAG-PASSWORD)))) (if crypt-label (let loop () (let ((password (password-page)) -- cgit v1.2.3 From 8f2b7e3cb469e3e484547bb9f4ba3d0e3a7e9ed7 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 25 Apr 2019 11:17:31 +0200 Subject: installer: Ask for confirmation of the root password. * gnu/installer/newt/user.scm (confirm-password): New procedure. (run-root-password-page): Add call to 'confirm-password'. --- gnu/installer/newt/user.scm | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/user.scm b/gnu/installer/newt/user.scm index 76eb63b710..7493edf85e 100644 --- a/gnu/installer/newt/user.scm +++ b/gnu/installer/newt/user.scm @@ -104,13 +104,34 @@ (lambda () (destroy-form-and-pop form))))))) +(define (confirm-password password try-again) + "Ask the user to confirm PASSWORD, a possibly empty string. Call TRY-AGAIN, +a thunk, if the confirmation doesn't match PASSWORD. Return the confirmed +password." + (define confirmation + (run-input-page (G_ "Please confirm the password.") + (G_ "Password confirmation required") + #:allow-empty-input? #t + #:input-flags FLAG-PASSWORD)) + + (if (string=? password confirmation) + password + (begin + (run-error-page + (G_ "Password mismatch, please try again.") + (G_ "Password error")) + (try-again)))) + (define (run-root-password-page) ;; TRANSLATORS: Leave "root" untranslated: it refers to the name of the ;; system administrator account. - (run-input-page (G_ "Please choose a password for the system \ + (define password + (run-input-page (G_ "Please choose a password for the system \ administrator (\"root\").") - (G_ "System administrator password") - #:input-flags FLAG-PASSWORD)) + (G_ "System administrator password") + #:input-flags FLAG-PASSWORD)) + + (confirm-password password run-root-password-page)) (define (run-user-page) (define (run users) -- cgit v1.2.3 From 187122b90261088e264f2530df224e613cbcfb55 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 25 Apr 2019 11:43:44 +0200 Subject: installer: Ask for confirmation of the user passwords. * gnu/installer/newt/user.scm (run-user-add-page): Add #:name and #:home-directory and honor them. Add call to 'confirm-password'. --- gnu/installer/newt/user.scm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/user.scm b/gnu/installer/newt/user.scm index 7493edf85e..617d2d0bca 100644 --- a/gnu/installer/newt/user.scm +++ b/gnu/installer/newt/user.scm @@ -29,7 +29,9 @@ #:use-module (srfi srfi-26) #:export (run-user-page)) -(define (run-user-add-page) +(define* (run-user-add-page #:key (name "") (home-directory "")) + "Run a form to enter the user name, home directory, and password. Use NAME +and HOME-DIRECTORY as the initial values in the form." (define (pad-label label) (string-pad-right label 20)) @@ -40,8 +42,10 @@ (label-password (make-label -1 -1 (pad-label (G_ "Password")))) (entry-width 30) - (entry-name (make-entry -1 -1 entry-width)) - (entry-home-directory (make-entry -1 -1 entry-width)) + (entry-name (make-entry -1 -1 entry-width + #:initial-value name)) + (entry-home-directory (make-entry -1 -1 entry-width + #:initial-value home-directory)) (entry-password (make-entry -1 -1 entry-width #:flags FLAG-PASSWORD)) (entry-grid (make-grid 3 4)) @@ -100,7 +104,13 @@ (user (name name) (home-directory home-directory) - (password password)))))))) + (password + (confirm-password password + (lambda () + (run-user-add-page + #:name name + #:home-directory + home-directory))))))))))) (lambda () (destroy-form-and-pop form))))))) -- cgit v1.2.3 From 98f035482fcb32683429a474f4071bd530c3c1b8 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès 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 +++++++++++++++---- gnu/installer/newt/final.scm | 5 ++++- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'gnu/installer/newt') 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")) diff --git a/gnu/installer/newt/final.scm b/gnu/installer/newt/final.scm index f470a90004..e8d3c48a36 100644 --- a/gnu/installer/newt/final.scm +++ b/gnu/installer/newt/final.scm @@ -56,7 +56,10 @@ This will take a few minutes.") (G_ "Reboot") (G_ "Congratulations! Installation is now complete. \ You may remove the device containing the installation image and \ -press the button to reboot."))) +press the button to reboot.")) + + ;; Return success so that the installer happily reboots. + 'success) (define (run-install-failed-page) (choice-window -- cgit v1.2.3 From 7dbdbbfd6e323e4b2932a68a48988f2b60f75712 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 27 Apr 2019 19:30:22 +0200 Subject: installer: Add missing i18n in the partitioning pages. * gnu/installer/newt/partition.scm (run-scheme-page): Add missing 'G_' for ITEMS. (run-partioning-page): Likewise. (run-partition-page): Move misplaced call to 'G_'. --- gnu/installer/newt/partition.scm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/partition.scm b/gnu/installer/newt/partition.scm index 5eaba7aea9..8cce7da93b 100644 --- a/gnu/installer/newt/partition.scm +++ b/gnu/installer/newt/partition.scm @@ -42,8 +42,8 @@ (define (run-scheme-page) "Run a page asking the user for a partitioning scheme." (let* ((items - '((root . "Everything is one partition") - (root-home . "Separate /home partition"))) + `((root . ,(G_ "Everything is one partition")) + (root-home . ,(G_ "Separate /home partition")))) (result (run-listbox-selection-page #:info-text (G_ "Please select a partitioning scheme.") #:title (G_ "Partition scheme") @@ -429,10 +429,10 @@ partition. Leave this field empty if you don't want to set a mounting point.") (run-listbox-selection-page #:info-text (if creation? - (G_ (format #f "Creating ~a partition starting at ~a of ~a." - type-str start file-name)) - (G_ (format #f "You are currently editing partition ~a." - number-str))) + (format #f (G_ "Creating ~a partition starting at ~a of ~a.") + type-str start file-name) + (format #f (G_ "You are currently editing partition ~a.") + number-str)) #:title (if creation? (G_ "Partition creation") (G_ "Partition edit")) @@ -724,9 +724,9 @@ by pressing the Exit button.~%~%"))) "Run a page asking the user for a partitioning method." (define (run-page devices) (let* ((items - '((entire . "Guided - using the entire disk") - (entire-encrypted . "Guided - using the entire disk with encryption") - (manual . "Manual"))) + `((entire . ,(G_ "Guided - using the entire disk")) + (entire-encrypted . ,(G_ "Guided - using the entire disk with encryption")) + (manual . ,(G_ "Manual")))) (result (run-listbox-selection-page #:info-text (G_ "Please select a partitioning method.") #:title (G_ "Partitioning method") -- cgit v1.2.3 From 7253c2b6297f85ec94512a2cff39ab25df043ad9 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 28 Apr 2019 21:43:35 +0200 Subject: installer: Add #:selection parameter to 'run-checkbox-tree-page'. * gnu/installer/newt/page.scm (%none-selected): New variable. (run-checkbox-tree-page): Add #:selection. [fill-checkbox-tree]: Honor it. --- gnu/installer/newt/page.scm | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/page.scm b/gnu/installer/newt/page.scm index e9514e110f..3173d54737 100644 --- a/gnu/installer/newt/page.scm +++ b/gnu/installer/newt/page.scm @@ -437,10 +437,14 @@ error is raised if the MAX-SCALE-UPDATE limit is reached." (lambda () (destroy-form-and-pop form))))) +(define %none-selected + (circular-list #f)) + (define* (run-checkbox-tree-page #:key info-text title items + (selection %none-selected) item->text (info-textbox-width 50) (checkbox-tree-height 10) @@ -453,7 +457,8 @@ a checkbox list. The page contains vertically stacked from the top to the bottom, an informative text set to INFO-TEXT, the checkbox list and two buttons, 'Ok' and 'Exit'. The page title's is set to TITLE. ITEMS are converted to text using ITEM->TEXT before being displayed in the checkbox -list. +list. SELECTION is a list of Booleans of the same length as ITEMS that +specifies which items are initially checked. INFO-TEXTBOX-WIDTH is the width of the textbox where INFO-TEXT will be displayed. CHECKBOX-TREE-HEIGHT is the height of the checkbox list. @@ -465,12 +470,15 @@ pressed. This procedure returns the list of checked items in the checkbox list among ITEMS when 'Ok' is pressed." (define (fill-checkbox-tree checkbox-tree items) - (map - (lambda (item) - (let* ((item-text (item->text item)) - (key (add-entry-to-checkboxtree checkbox-tree item-text 0))) - (cons key item))) - items)) + (map (lambda (item selected?) + (let* ((item-text (item->text item)) + (key (add-entry-to-checkboxtree checkbox-tree item-text + (if selected? + FLAG-SELECTED + 0)))) + (cons key item))) + items + selection)) (let* ((checkbox-tree (make-checkboxtree -1 -1 -- cgit v1.2.3 From 1d9fcdacf90764cf168ecaad5f139e7d21a4d7c6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 28 Apr 2019 21:45:16 +0200 Subject: installer: Recommended services are pre-selected. * gnu/installer/services.scm ()[recommended?]: New field. * gnu/installer/newt/services.scm (run-desktop-environments-cbt-page): Pass #:selection to 'run-checkbox-tree-page', computed from the 'recommended?' field of each service. (run-networking-cbt-page): Likewise. --- gnu/installer/newt/services.scm | 52 ++++++++++++++++++++++------------------- gnu/installer/services.scm | 4 ++++ 2 files changed, 32 insertions(+), 24 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/services.scm b/gnu/installer/newt/services.scm index 2a221790d2..4f32d9077b 100644 --- a/gnu/installer/newt/services.scm +++ b/gnu/installer/newt/services.scm @@ -31,36 +31,40 @@ (define (run-desktop-environments-cbt-page) "Run a page allowing the user to choose between various desktop environments." - (run-checkbox-tree-page - #:info-text (G_ "Please select the desktop(s) environment(s) you wish to \ + (let ((items (filter desktop-system-service? %system-services))) + (run-checkbox-tree-page + #:info-text (G_ "Please select the desktop(s) environment(s) you wish to \ install. If you select multiple desktops environments, you will be able to \ choose the one to use on the log-in screen.") - #:title (G_ "Desktop environment") - #:items (filter desktop-system-service? %system-services) - #:item->text system-service-name ;no i18n for DE names - #:checkbox-tree-height 5 - #:exit-button-callback-procedure - (lambda () - (raise - (condition - (&installer-step-abort)))))) + #:title (G_ "Desktop environment") + #:items items + #:selection (map system-service-recommended? items) + #:item->text system-service-name ;no i18n for DE names + #:checkbox-tree-height 8 + #:exit-button-callback-procedure + (lambda () + (raise + (condition + (&installer-step-abort))))))) (define (run-networking-cbt-page) "Run a page allowing the user to select networking services." - (run-checkbox-tree-page - #:info-text (G_ "You can now select networking services to run on your \ + (let ((items (filter (lambda (service) + (eq? 'networking (system-service-type service))) + %system-services))) + (run-checkbox-tree-page + #:info-text (G_ "You can now select networking services to run on your \ system.") - #:title (G_ "Network service") - #:items (filter (lambda (service) - (eq? 'networking (system-service-type service))) - %system-services) - #:item->text (compose G_ system-service-name) - #:checkbox-tree-height 5 - #:exit-button-callback-procedure - (lambda () - (raise - (condition - (&installer-step-abort)))))) + #:title (G_ "Network service") + #:items items + #:selection (map system-service-recommended? items) + #:item->text (compose G_ system-service-name) + #:checkbox-tree-height 5 + #:exit-button-callback-procedure + (lambda () + (raise + (condition + (&installer-step-abort))))))) (define (run-network-management-page) "Run a page to select among several network management methods." diff --git a/gnu/installer/services.scm b/gnu/installer/services.scm index 6d9d65e8c5..0b46006add 100644 --- a/gnu/installer/services.scm +++ b/gnu/installer/services.scm @@ -23,7 +23,9 @@ #:export (system-service? system-service-name system-service-type + system-service-recommended? system-service-snippet + system-service-packages desktop-system-service? networking-system-service? @@ -36,6 +38,8 @@ system-service? (name system-service-name) ;string (type system-service-type) ;'desktop | 'networking + (recommended? system-service-recommended? ;Boolean + (default #f)) (snippet system-service-snippet ;list of sexps (default '())) (packages system-service-packages ;list of sexps -- cgit v1.2.3 From ed5a5d38cfd436c5893ccf1580012d3cbfbe0a70 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 28 Apr 2019 21:48:50 +0200 Subject: installer: Improve layout of the partitioning page. Previously the "listbox" would be unnecessarily high, leaving too little space for the German translation of the text above. * gnu/installer/newt/partition.scm (run-disk-page): Increase #:info-textbox-width and pass #:listbox-height. --- gnu/installer/newt/partition.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/partition.scm b/gnu/installer/newt/partition.scm index 8cce7da93b..2b22ac85b4 100644 --- a/gnu/installer/newt/partition.scm +++ b/gnu/installer/newt/partition.scm @@ -673,7 +673,8 @@ by pressing the Exit button.~%~%"))) #:title (if guided? (G_ "Guided partitioning") (G_ "Manual partitioning")) - #:info-textbox-width 70 + #:info-textbox-width 76 ;we need a lot of room for INFO-TEXT + #:listbox-height 12 #:listbox-items (disk-items) #:listbox-item->text cdr #:sort-listbox-items? #f -- cgit v1.2.3 From 0e8e963d73e61c7666f9ec4efa98c1a277c72af9 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 28 Apr 2019 22:28:51 +0200 Subject: installer: User accounts can now have a "real name." * gnu/installer/newt/user.scm (run-user-add-page): Add #:real-name. Add a label and entry for the real name and initialize the 'real-name' field of the record. * gnu/installer/final.scm (create-user-database): Set the 'comment' field of the record. --- gnu/installer/final.scm | 1 + gnu/installer/newt/user.scm | 38 +++++++++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 11 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/final.scm b/gnu/installer/final.scm index c41670c197..855b640030 100644 --- a/gnu/installer/final.scm +++ b/gnu/installer/final.scm @@ -71,6 +71,7 @@ USERS." (string=? "root" (user-name user))) (sys:user-account (name (user-name user)) + (comment (user-real-name user)) (group "users") (uid (if root? 0 #f)) (home-directory diff --git a/gnu/installer/newt/user.scm b/gnu/installer/newt/user.scm index 617d2d0bca..7c646c1ae8 100644 --- a/gnu/installer/newt/user.scm +++ b/gnu/installer/newt/user.scm @@ -29,14 +29,17 @@ #:use-module (srfi srfi-26) #:export (run-user-page)) -(define* (run-user-add-page #:key (name "") (home-directory "")) - "Run a form to enter the user name, home directory, and password. Use NAME -and HOME-DIRECTORY as the initial values in the form." +(define* (run-user-add-page #:key (name "") (real-name "") + (home-directory "")) + "Run a form to enter the user name, home directory, and password. Use NAME, +REAL-NAME, and HOME-DIRECTORY as the initial values in the form." (define (pad-label label) (string-pad-right label 20)) (let* ((label-name (make-label -1 -1 (pad-label (G_ "Name")))) + (label-real-name + (make-label -1 -1 (pad-label (G_ "Real name")))) (label-home-directory (make-label -1 -1 (pad-label (G_ "Home directory")))) (label-password @@ -44,11 +47,13 @@ and HOME-DIRECTORY as the initial values in the form." (entry-width 30) (entry-name (make-entry -1 -1 entry-width #:initial-value name)) + (entry-real-name (make-entry -1 -1 entry-width + #:initial-value real-name)) (entry-home-directory (make-entry -1 -1 entry-width #:initial-value home-directory)) (entry-password (make-entry -1 -1 entry-width #:flags FLAG-PASSWORD)) - (entry-grid (make-grid 3 4)) + (entry-grid (make-grid 2 5)) (button-grid (make-grid 1 1)) (ok-button (make-button -1 -1 (G_ "OK"))) (grid (make-grid 1 2)) @@ -59,10 +64,12 @@ and HOME-DIRECTORY as the initial values in the form." (set-entry-grid-field 0 0 label-name) (set-entry-grid-field 1 0 entry-name) - (set-entry-grid-field 0 1 label-home-directory) - (set-entry-grid-field 1 1 entry-home-directory) - (set-entry-grid-field 0 2 label-password) - (set-entry-grid-field 1 2 entry-password) + (set-entry-grid-field 0 1 label-real-name) + (set-entry-grid-field 1 1 entry-real-name) + (set-entry-grid-field 0 2 label-home-directory) + (set-entry-grid-field 1 2 entry-home-directory) + (set-entry-grid-field 0 3 label-password) + (set-entry-grid-field 1 3 entry-password) (set-grid-field button-grid 0 0 GRID-ELEMENT-COMPONENT ok-button) @@ -70,11 +77,17 @@ and HOME-DIRECTORY as the initial values in the form." entry-name (lambda (component) (set-entry-text entry-home-directory - (string-append "/home/" (entry-value entry-name))))) + (string-append "/home/" (entry-value entry-name))) + + (when (string-null? (entry-value entry-real-name)) + (set-entry-text entry-real-name + (string-titlecase (entry-value entry-name)))))) (add-components-to-form form - label-name label-home-directory label-password - entry-name entry-home-directory entry-password + label-name label-real-name + label-home-directory label-password + entry-name entry-real-name + entry-home-directory entry-password ok-button) (make-wrapped-grid-window (vertically-stacked-grid @@ -94,6 +107,7 @@ and HOME-DIRECTORY as the initial values in the form." (cond ((components=? argument ok-button) (let ((name (entry-value entry-name)) + (real-name (entry-value entry-real-name)) (home-directory (entry-value entry-home-directory)) (password (entry-value entry-password))) (if (or (string=? name "") @@ -103,12 +117,14 @@ and HOME-DIRECTORY as the initial values in the form." (run-user-add-page)) (user (name name) + (real-name real-name) (home-directory home-directory) (password (confirm-password password (lambda () (run-user-add-page #:name name + #:real-name real-name #:home-directory home-directory))))))))))) (lambda () -- cgit v1.2.3 From ada4aeb0681445b89459a202b5fa1a46f0a7950e Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 28 Apr 2019 22:42:21 +0200 Subject: installer: Fix handling of user password mismatches. Previously, if we had a password mismatch, the 'password' field would end up containing a record instead of the actual password. * gnu/installer/newt/user.scm (confirm-password): Make TRY-AGAIN optional and adjust docstring. (run-user-add-page): Move 'confirm-password' call one level higher. --- gnu/installer/newt/user.scm | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/user.scm b/gnu/installer/newt/user.scm index 7c646c1ae8..deab056e0c 100644 --- a/gnu/installer/newt/user.scm +++ b/gnu/installer/newt/user.scm @@ -115,25 +115,23 @@ REAL-NAME, and HOME-DIRECTORY as the initial values in the form." (begin (error-page) (run-user-add-page)) - (user - (name name) - (real-name real-name) - (home-directory home-directory) - (password - (confirm-password password - (lambda () - (run-user-add-page - #:name name - #:real-name real-name - #:home-directory - home-directory))))))))))) + (let ((password (confirm-password password))) + (if password + (user + (name name) + (real-name real-name) + (home-directory home-directory) + (password password)) + (run-user-add-page #:name name + #:real-name real-name + #:home-directory + home-directory))))))))) (lambda () (destroy-form-and-pop form))))))) -(define (confirm-password password try-again) +(define* (confirm-password password #:optional (try-again (const #f))) "Ask the user to confirm PASSWORD, a possibly empty string. Call TRY-AGAIN, -a thunk, if the confirmation doesn't match PASSWORD. Return the confirmed -password." +a thunk, if the confirmation doesn't match PASSWORD, and return its result." (define confirmation (run-input-page (G_ "Please confirm the password.") (G_ "Password confirmation required") -- cgit v1.2.3 From d779de18175fe99f4ed490bc8af2e80571389144 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 28 Apr 2019 22:55:01 +0200 Subject: installer: Tell the user where the config file is. * gnu/installer/newt/final.scm (strip-prefix): New procedure. (run-config-display-page): Add a sentence showing where the config file is stored. --- gnu/installer/newt/final.scm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/final.scm b/gnu/installer/newt/final.scm index e8d3c48a36..e375282613 100644 --- a/gnu/installer/newt/final.scm +++ b/gnu/installer/newt/final.scm @@ -30,15 +30,24 @@ #:use-module (newt) #:export (run-final-page)) +(define* (strip-prefix file #:optional (prefix (%installer-target-dir))) + "Strip PREFIX from FILE, if PREFIX actually is a prefix of FILE." + (if (string-prefix? prefix file) + (string-drop file (string-length prefix)) + file)) + (define (run-config-display-page) (let ((width (%configuration-file-width)) (height (nearest-exact-integer (/ (screen-rows) 2)))) (run-file-textbox-page - #:info-text (G_ "We're now ready to proceed with the installation! \ + #:info-text (format #f (G_ "\ +We're now ready to proceed with the installation! \ A system configuration file has been generated, it is displayed below. \ +This file will be available as '~a' on the installed system. \ The new system will be created from this file once you've pressed OK. \ This will take a few minutes.") + (strip-prefix (%installer-configuration-file))) #:title (G_ "Configuration file") #:file (%installer-configuration-file) #:info-textbox-width width -- cgit v1.2.3 From 772bcb1cf00720c150ea13303d5971afaaaca43a Mon Sep 17 00:00:00 2001 From: Meiyo Peng Date: Sat, 27 Apr 2019 15:40:51 +0800 Subject: installer: Fix typo in docstring. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/installer/newt/wifi.scm (draw-scanning-page): Fix typo in docstring. Signed-off-by: Ludovic Courtès --- gnu/installer/newt/wifi.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gnu/installer/newt') diff --git a/gnu/installer/newt/wifi.scm b/gnu/installer/newt/wifi.scm index 4cf5c128e7..da2f0b56d0 100644 --- a/gnu/installer/newt/wifi.scm +++ b/gnu/installer/newt/wifi.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018 Mathieu Othacehe +;;; Copyright © 2019 Meiyo Peng ;;; ;;; This file is part of GNU Guix. ;;; @@ -80,7 +81,7 @@ nmc_wifi_strength_bars." (message (G_ "Unable to find a wifi technology")))))))) (define (draw-scanning-page) - "Draw a page to indicate a wifi scan in in progress." + "Draw a page to indicate a wifi scan in progress." (draw-info-page (G_ "Scanning wifi for available networks, please wait.") (G_ "Scan in progress"))) -- cgit v1.2.3