newt.scm 3.8 KB

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