newt.scm 4.2 KB

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