| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 |
|
| 23 | (define-module (gnu installer newt services)
|
| 24 | #:use-module (gnu installer services)
|
| 25 | #:use-module (gnu installer steps)
|
| 26 | #:use-module (gnu installer newt page)
|
| 27 | #:use-module (gnu installer newt utils)
|
| 28 | #:use-module (guix i18n)
|
| 29 | #:use-module (guix utils)
|
| 30 | #:use-module (srfi srfi-34)
|
| 31 | #:use-module (srfi srfi-35)
|
| 32 | #:export (run-services-page))
|
| 33 |
|
| 34 | (define (run-desktop-environments-cbt-page)
|
| 35 | "Run a page allowing the user to choose between various desktop
|
| 36 | environments."
|
| 37 | (let ((items (filter desktop-system-service? (%system-services))))
|
| 38 | (run-checkbox-tree-page
|
| 39 | #:info-text (G_ "Please select the desktop environment(s) you wish to \
|
| 40 | install. If you select multiple desktop environments here, you will be able \
|
| 41 | to choose from them later when you log in.")
|
| 42 | #:title (G_ "Desktop environment")
|
| 43 | #:items items
|
| 44 | #:selection (map system-service-recommended? items)
|
| 45 | #:item->text system-service-name |
| 46 | #:checkbox-tree-height 9
|
| 47 | #:exit-button-callback-procedure
|
| 48 | (lambda ()
|
| 49 | (abort-to-prompt 'installer-step 'abort)))))
|
| 50 |
|
| 51 | |
| 52 | |
| 53 | |
| 54 | (define (run-desktop-environments-cbt-page/maybe)
|
| 55 | "Run page with desktop environments, as long as the user is on
|
| 56 | a system that supports them."
|
| 57 | (if (or (target-hurd?) (target-x86-32?))
|
| 58 | '()
|
| 59 | (run-desktop-environments-cbt-page)))
|
| 60 |
|
| 61 | (define (run-networking-cbt-page)
|
| 62 | "Run a page allowing the user to select networking services."
|
| 63 | (let ((items (filter (lambda (service)
|
| 64 | (eq? 'networking (system-service-type service)))
|
| 65 | (%system-services))))
|
| 66 | (run-checkbox-tree-page
|
| 67 | #:info-text (G_ "You can now select networking services to run on your \
|
| 68 | system.")
|
| 69 | #:title (G_ "Network service")
|
| 70 | #:items items
|
| 71 | #:selection (map system-service-recommended? items)
|
| 72 | #:item->text (compose G_ system-service-name)
|
| 73 | #:checkbox-tree-height 5
|
| 74 | #:exit-button-callback-procedure
|
| 75 | (lambda ()
|
| 76 | (abort-to-prompt 'installer-step 'abort)))))
|
| 77 |
|
| 78 | (define (run-printing-services-cbt-page)
|
| 79 | "Run a page allowing the user to select document services such as CUPS."
|
| 80 | (let ((items (filter (lambda (service)
|
| 81 | (eq? 'document
|
| 82 | (system-service-type service)))
|
| 83 | (%system-services))))
|
| 84 | (run-checkbox-tree-page
|
| 85 | #:info-text (G_ "You can now select the CUPS printing service to run on your \
|
| 86 | system.")
|
| 87 | #:title (G_ "Printing and document services")
|
| 88 | #:items items
|
| 89 | #:selection (map system-service-recommended? items)
|
| 90 | #:item->text (compose G_ system-service-name)
|
| 91 | #:checkbox-tree-height 9
|
| 92 | #:exit-button-callback-procedure
|
| 93 | (lambda ()
|
| 94 | (abort-to-prompt 'installer-step 'abort)))))
|
| 95 |
|
| 96 | (define (run-console-services-cbt-page)
|
| 97 | "Run a page to select various system administration services for non-graphical
|
| 98 | systems."
|
| 99 | (let ((items (filter (lambda (service)
|
| 100 | (eq? 'administration
|
| 101 | (system-service-type service)))
|
| 102 | (%system-services))))
|
| 103 | (run-checkbox-tree-page
|
| 104 | #:title (G_ "Console services")
|
| 105 | #:info-text (G_ "Select miscellaneous services to run on your \
|
| 106 | non-graphical system.")
|
| 107 | #:items items
|
| 108 | #:selection (map system-service-recommended? items)
|
| 109 | #:item->text (compose G_ system-service-name)
|
| 110 | #:checkbox-tree-height 5
|
| 111 | #:exit-button-callback-procedure
|
| 112 | (lambda _
|
| 113 | (abort-to-prompt 'installer-step 'abort)))))
|
| 114 |
|
| 115 | (define (run-network-management-page)
|
| 116 | "Run a page to select among several network management methods."
|
| 117 | (let ((title (G_ "Network management"))
|
| 118 | (items (filter (lambda (service)
|
| 119 | (eq? 'network-management
|
| 120 | (system-service-type service)))
|
| 121 | (%system-services))))
|
| 122 | (run-listbox-selection-page
|
| 123 | #:title title
|
| 124 | #:info-text (G_ "Choose the method to manage network connections.
|
| 125 |
|
| 126 | We recommend NetworkManager or Connman for a WiFi-capable laptop; the DHCP \
|
| 127 | client may be enough for a server.")
|
| 128 | #:info-textbox-width 70
|
| 129 | #:listbox-height 7
|
| 130 | #:listbox-items `(,@items
|
| 131 | ,@(if (target-hurd?)
|
| 132 | (list system-service-none)
|
| 133 | '()))
|
| 134 | #:listbox-item->text (compose G_ system-service-name)
|
| 135 | #:sort-listbox-items? #f
|
| 136 | #:button-text (G_ "Exit")
|
| 137 | #:button-callback-procedure
|
| 138 | (lambda _
|
| 139 | (abort-to-prompt 'installer-step 'abort)))))
|
| 140 |
|
| 141 | (define (run-services-page)
|
| 142 | (let ((desktop (run-desktop-environments-cbt-page/maybe)))
|
| 143 | |
| 144 | |
| 145 | (append desktop
|
| 146 | (run-networking-cbt-page)
|
| 147 | (if (null? desktop)
|
| 148 | (cons (run-network-management-page)
|
| 149 | (run-console-services-cbt-page))
|
| 150 | '())
|
| 151 | (run-printing-services-cbt-page))))
|