2018-12-05 06:30:16 +01:00
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
|
|
|
;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
|
|
|
|
;;;
|
|
|
|
;;; This file is part of GNU Guix.
|
|
|
|
;;;
|
|
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
|
|
|
;;; under the terms of the GNU General Public License as published by
|
|
|
|
;;; the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
;;; your option) any later version.
|
|
|
|
;;;
|
|
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
|
|
|
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;;; GNU General Public License for more details.
|
|
|
|
;;;
|
|
|
|
;;; You should have received a copy of the GNU General Public License
|
|
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
(define-module (gnu installer newt final)
|
|
|
|
#:use-module (gnu installer final)
|
|
|
|
#:use-module (gnu installer parted)
|
|
|
|
#:use-module (gnu installer steps)
|
|
|
|
#:use-module (gnu installer utils)
|
|
|
|
#:use-module (gnu installer newt page)
|
|
|
|
#:use-module (gnu installer newt utils)
|
|
|
|
#:use-module (guix i18n)
|
|
|
|
#:use-module (srfi srfi-34)
|
|
|
|
#:use-module (srfi srfi-35)
|
|
|
|
#:use-module (newt)
|
|
|
|
#:export (run-final-page))
|
|
|
|
|
|
|
|
(define (run-config-display-page)
|
|
|
|
(let ((width (%configuration-file-width))
|
|
|
|
(height (nearest-exact-integer
|
|
|
|
(/ (screen-rows) 2))))
|
|
|
|
(run-file-textbox-page
|
2019-01-16 18:01:38 +01:00
|
|
|
#:info-text (G_ "We're now ready to proceed with the installation! \
|
|
|
|
A system configuration file has been generated, it is displayed below. \
|
|
|
|
The new system will be created from this file once you've pressed OK. \
|
|
|
|
This will take a few minutes.")
|
2018-12-05 06:30:16 +01:00
|
|
|
#:title (G_ "Configuration file")
|
|
|
|
#:file (%installer-configuration-file)
|
|
|
|
#:info-textbox-width width
|
|
|
|
#:file-textbox-width width
|
|
|
|
#:file-textbox-height height
|
2018-12-05 11:50:17 +01:00
|
|
|
#:exit-button-callback-procedure
|
2018-12-05 06:30:16 +01:00
|
|
|
(lambda ()
|
|
|
|
(raise
|
|
|
|
(condition
|
|
|
|
(&installer-step-abort)))))))
|
|
|
|
|
|
|
|
(define (run-install-success-page)
|
|
|
|
(message-window
|
|
|
|
(G_ "Installation complete")
|
|
|
|
(G_ "Reboot")
|
2019-01-16 18:01:38 +01:00
|
|
|
(G_ "Congratulations! Installation is now complete. \
|
|
|
|
You may remove the device containing the installation image and \
|
|
|
|
press the button to reboot.")))
|
2018-12-05 06:30:16 +01:00
|
|
|
|
|
|
|
(define (run-install-failed-page)
|
|
|
|
(choice-window
|
|
|
|
(G_ "Installation failed")
|
|
|
|
(G_ "Restart installer")
|
|
|
|
(G_ "Retry system install")
|
2019-01-16 18:01:38 +01:00
|
|
|
(G_ "The final system installation step failed. You can retry the \
|
2018-12-05 06:30:16 +01:00
|
|
|
last step, or restart the installer.")))
|
|
|
|
|
2019-04-23 00:08:54 +02:00
|
|
|
(define (run-install-shell locale)
|
2018-12-05 06:30:16 +01:00
|
|
|
(clear-screen)
|
|
|
|
(newt-suspend)
|
2019-04-23 00:08:54 +02:00
|
|
|
(let ((install-ok? (install-system locale)))
|
2018-12-05 06:30:16 +01:00
|
|
|
(newt-resume)
|
|
|
|
install-ok?))
|
|
|
|
|
|
|
|
(define (run-final-page result prev-steps)
|
2019-04-23 00:08:54 +02:00
|
|
|
(let* ((configuration (format-configuration prev-steps result))
|
2018-12-05 06:30:16 +01:00
|
|
|
(user-partitions (result-step result 'partition))
|
2019-04-23 00:08:54 +02:00
|
|
|
(locale (result-step result 'locale))
|
2018-12-05 06:30:16 +01:00
|
|
|
(install-ok?
|
|
|
|
(with-mounted-partitions
|
|
|
|
user-partitions
|
|
|
|
(configuration->file configuration)
|
|
|
|
(run-config-display-page)
|
2019-04-23 00:08:54 +02:00
|
|
|
(run-install-shell locale))))
|
2018-12-05 06:30:16 +01:00
|
|
|
(if install-ok?
|
|
|
|
(run-install-success-page)
|
|
|
|
(run-install-failed-page))))
|