installer: Rename RUN-PARTIONING-PAGE.
[jackhill/guix/guix.git] / gnu / installer / newt.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu installer newt)
20 #:use-module (gnu installer record)
21 #:use-module (gnu installer utils)
22 #:use-module (gnu installer newt ethernet)
23 #:use-module (gnu installer newt final)
24 #:use-module (gnu installer newt parameters)
25 #:use-module (gnu installer newt hostname)
26 #:use-module (gnu installer newt keymap)
27 #:use-module (gnu installer newt locale)
28 #:use-module (gnu installer newt menu)
29 #:use-module (gnu installer newt network)
30 #:use-module (gnu installer newt page)
31 #:use-module (gnu installer newt partition)
32 #:use-module (gnu installer newt services)
33 #:use-module (gnu installer newt timezone)
34 #:use-module (gnu installer newt user)
35 #:use-module (gnu installer newt utils)
36 #:use-module (gnu installer newt welcome)
37 #:use-module (gnu installer newt wifi)
38 #:use-module (guix config)
39 #:use-module (guix discovery)
40 #:use-module (guix i18n)
41 #:use-module (srfi srfi-26)
42 #:use-module (newt)
43 #:export (newt-installer))
44
45 (define (init)
46 (newt-init)
47 (clear-screen)
48 (set-screen-size!)
49 (push-help-line
50 (format #f (G_ "Press <F1> for installation parameters."))))
51
52 (define (exit)
53 (newt-finish)
54 (clear-screen))
55
56 (define (exit-error file key args)
57 (newt-set-color COLORSET-ROOT "white" "red")
58 (let ((width (nearest-exact-integer
59 (* (screen-columns) 0.8)))
60 (height (nearest-exact-integer
61 (* (screen-rows) 0.7))))
62 (run-file-textbox-page
63 #:info-text (format #f (G_ "The installer has encountered an unexpected \
64 problem. The backtrace is displayed below. Please report it by email to \
65 <~a>.") %guix-bug-report-address)
66 #:title (G_ "Unexpected problem")
67 #:file file
68 #:exit-button? #f
69 #:info-textbox-width width
70 #:file-textbox-width width
71 #:file-textbox-height height))
72 (newt-set-color COLORSET-ROOT "white" "blue")
73 (newt-finish)
74 (clear-screen))
75
76 (define (final-page result prev-steps)
77 (run-final-page result prev-steps))
78
79 (define* (locale-page #:key
80 supported-locales
81 iso639-languages
82 iso3166-territories)
83 (run-locale-page
84 #:supported-locales supported-locales
85 #:iso639-languages iso639-languages
86 #:iso3166-territories iso3166-territories))
87
88 (define (timezone-page zonetab)
89 (run-timezone-page zonetab))
90
91 (define (welcome-page logo)
92 (run-welcome-page logo))
93
94 (define (menu-page steps)
95 (run-menu-page steps))
96
97 (define* (keymap-page layouts context)
98 (run-keymap-page layouts #:context context))
99
100 (define (network-page)
101 (run-network-page))
102
103 (define (hostname-page)
104 (run-hostname-page))
105
106 (define (user-page)
107 (run-user-page))
108
109 (define (partition-page)
110 (run-partitioning-page))
111
112 (define (services-page)
113 (run-services-page))
114
115 (define (parameters-menu menu-proc)
116 (newt-set-help-callback menu-proc))
117
118 (define (parameters-page keyboard-layout-selection)
119 (run-parameters-page keyboard-layout-selection))
120
121 (define newt-installer
122 (installer
123 (name 'newt)
124 (init init)
125 (exit exit)
126 (exit-error exit-error)
127 (final-page final-page)
128 (keymap-page keymap-page)
129 (locale-page locale-page)
130 (menu-page menu-page)
131 (network-page network-page)
132 (timezone-page timezone-page)
133 (hostname-page hostname-page)
134 (user-page user-page)
135 (partition-page partition-page)
136 (services-page services-page)
137 (welcome-page welcome-page)
138 (parameters-menu parameters-menu)
139 (parameters-page parameters-page)))