You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

112 lines
3.6 KiB

  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)
  19. #:use-module (guix discovery)
  20. #:use-module (guix records)
  21. #:use-module (guix ui)
  22. #:use-module (srfi srfi-1)
  23. #:export (<installer>
  24. installer
  25. make-installer
  26. installer?
  27. installer-name
  28. installer-modules
  29. installer-init
  30. installer-exit
  31. installer-exit-error
  32. installer-keymap-page
  33. installer-locale-page
  34. installer-menu-page
  35. installer-network-page
  36. installer-timezone-page
  37. installer-hostname-page
  38. installer-user-page
  39. installer-welcome-page
  40. %installers
  41. lookup-installer-by-name))
  42. ;;;
  43. ;;; Installer record.
  44. ;;;
  45. ;; The <installer> record contains pages that will be run to prompt the user
  46. ;; for the system configuration. The goal of the installer is to produce a
  47. ;; complete <operating-system> record and install it.
  48. (define-record-type* <installer>
  49. installer make-installer
  50. installer?
  51. ;; symbol
  52. (name installer-name)
  53. ;; list of installer modules
  54. (modules installer-modules)
  55. ;; procedure: void -> void
  56. (init installer-init)
  57. ;; procedure: void -> void
  58. (exit installer-exit)
  59. ;; procedure (key arguments) -> void
  60. (exit-error installer-exit-error)
  61. ;; procedure (#:key models layouts) -> (list model layout variant)
  62. (keymap-page installer-keymap-page)
  63. ;; procedure: (#:key supported-locales iso639-languages iso3166-territories)
  64. ;; -> glibc-locale
  65. (locale-page installer-locale-page)
  66. ;; procedure: (steps) -> step-id
  67. (menu-page installer-menu-page)
  68. ;; procedure void -> void
  69. (network-page installer-network-page)
  70. ;; procedure (zonetab) -> posix-timezone
  71. (timezone-page installer-timezone-page)
  72. ;; procedure void -> void
  73. (hostname-page installer-hostname-page)
  74. ;; procedure void -> void
  75. (user-page installer-user-page)
  76. ;; procedure (logo) -> void
  77. (welcome-page installer-welcome-page))
  78. ;;;
  79. ;;; Installers.
  80. ;;;
  81. (define (installer-top-modules)
  82. "Return the list of installer modules."
  83. (all-modules (map (lambda (entry)
  84. `(,entry . "gnu/installer"))
  85. %load-path)
  86. #:warn warn-about-load-error))
  87. (define %installers
  88. ;; The list of publically-known installers.
  89. (delay (fold-module-public-variables (lambda (obj result)
  90. (if (installer? obj)
  91. (cons obj result)
  92. result))
  93. '()
  94. (installer-top-modules))))
  95. (define (lookup-installer-by-name name)
  96. "Return the installer called NAME."
  97. (or (find (lambda (installer)
  98. (eq? name (installer-name installer)))
  99. (force %installers))
  100. (leave (G_ "~a: no such installer~%") name)))