newt.scm 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. (define-module (gnu installer newt)
  19. #:use-module (gnu installer record)
  20. #:use-module (gnu installer utils)
  21. #:use-module (gnu installer newt ethernet)
  22. #:use-module (gnu installer newt final)
  23. #:use-module (gnu installer newt parameters)
  24. #:use-module (gnu installer newt hostname)
  25. #:use-module (gnu installer newt keymap)
  26. #:use-module (gnu installer newt locale)
  27. #:use-module (gnu installer newt menu)
  28. #:use-module (gnu installer newt network)
  29. #:use-module (gnu installer newt page)
  30. #:use-module (gnu installer newt partition)
  31. #:use-module (gnu installer newt services)
  32. #:use-module (gnu installer newt substitutes)
  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. (define (init)
  45. (newt-init)
  46. (clear-screen)
  47. (set-screen-size!)
  48. (syslog "Display is ~ax~a.~%" (screen-columns) (screen-rows))
  49. (push-help-line
  50. (format #f (G_ "Press <F1> for installation parameters."))))
  51. (define (exit)
  52. (newt-finish)
  53. (clear-screen))
  54. (define (exit-error file key args)
  55. (newt-set-color COLORSET-ROOT "white" "red")
  56. (let ((width (nearest-exact-integer
  57. (* (screen-columns) 0.8)))
  58. (height (nearest-exact-integer
  59. (* (screen-rows) 0.7))))
  60. (run-file-textbox-page
  61. #:info-text (format #f (G_ "The installer has encountered an unexpected \
  62. problem. The backtrace is displayed below. Please report it by email to \
  63. <~a>.") %guix-bug-report-address)
  64. #:title (G_ "Unexpected problem")
  65. #:file file
  66. #:exit-button? #f
  67. #:info-textbox-width width
  68. #:file-textbox-width width
  69. #:file-textbox-height height))
  70. (newt-set-color COLORSET-ROOT "white" "blue")
  71. (newt-finish)
  72. (clear-screen))
  73. (define (final-page result prev-steps)
  74. (run-final-page result prev-steps))
  75. (define* (locale-page #:key
  76. supported-locales
  77. iso639-languages
  78. iso3166-territories)
  79. (run-locale-page
  80. #:supported-locales supported-locales
  81. #:iso639-languages iso639-languages
  82. #:iso3166-territories iso3166-territories))
  83. (define (timezone-page zonetab)
  84. (run-timezone-page zonetab))
  85. (define (welcome-page logo)
  86. (run-welcome-page logo))
  87. (define (menu-page steps)
  88. (run-menu-page steps))
  89. (define* (keymap-page layouts context)
  90. (run-keymap-page layouts #:context context))
  91. (define (network-page)
  92. (run-network-page))
  93. (define (substitutes-page)
  94. (run-substitutes-page))
  95. (define (hostname-page)
  96. (run-hostname-page))
  97. (define (user-page)
  98. (run-user-page))
  99. (define (partition-page)
  100. (run-partitioning-page))
  101. (define (services-page)
  102. (run-services-page))
  103. (define (parameters-menu menu-proc)
  104. (newt-set-help-callback menu-proc))
  105. (define (parameters-page keyboard-layout-selection)
  106. (run-parameters-page keyboard-layout-selection))
  107. (define newt-installer
  108. (installer
  109. (name 'newt)
  110. (init init)
  111. (exit exit)
  112. (exit-error exit-error)
  113. (final-page final-page)
  114. (keymap-page keymap-page)
  115. (locale-page locale-page)
  116. (menu-page menu-page)
  117. (network-page network-page)
  118. (substitutes-page substitutes-page)
  119. (timezone-page timezone-page)
  120. (hostname-page hostname-page)
  121. (user-page user-page)
  122. (partition-page partition-page)
  123. (services-page services-page)
  124. (welcome-page welcome-page)
  125. (parameters-menu parameters-menu)
  126. (parameters-page parameters-page)))