installer: Check if ci.guix.gnu.org can be reached.

* gnu/installer.scm (installer-program): Add gnutls extension.
* gnu/installer/newt/network.scm (wait-service-online): Check if the CI server
can be reached.
This commit is contained in:
Mathieu Othacehe 2021-12-28 11:19:55 +01:00
parent c6910baf36
commit ee897e5f51
No known key found for this signature in database
GPG key ID: 8354763531769CA6
2 changed files with 21 additions and 3 deletions

View file

@ -44,6 +44,7 @@ (define-module (gnu installer)
#:use-module (gnu packages linux)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages package-management)
#:use-module (gnu packages tls)
#:use-module (gnu packages xorg)
#:use-module (gnu system locale)
#:use-module (ice-9 match)
@ -351,7 +352,7 @@ (define installer-builder
;; packages …), etc. modules.
(with-extensions (list guile-gcrypt guile-newt
guile-parted guile-bytestructures
guile-json-3 guile-git guix)
guile-json-3 guile-git guix gnutls)
(with-imported-modules `(,@(source-module-closure
`(,@modules
(gnu services herd)

View file

@ -30,6 +30,8 @@ (define-module (gnu installer newt network)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
#:use-module (ice-9 match)
#:use-module (web client)
#:use-module (web response)
#:use-module (newt)
#:export (run-network-page))
@ -119,8 +121,23 @@ (define (wait-technology-powered technology)
(define (wait-service-online)
"Display a newt scale until connman detects an Internet access. Do
FULL-VALUE tentatives, spaced by 1 second."
(define (ci-available?)
(dynamic-wind
(lambda ()
(sigaction SIGALRM
(lambda _ #f))
(alarm 3))
(lambda ()
(false-if-exception
(= (response-code
(http-request "https://ci.guix.gnu.org"))
200)))
(lambda ()
(alarm 0))))
(define (online?)
(or (connman-online?)
(or (and (connman-online?)
(ci-available?))
(file-exists? "/tmp/installer-assume-online")))
(let* ((full-value 5))
@ -137,7 +154,7 @@ (define (online?)
(unless (online?)
(run-error-page
(G_ "The selected network does not provide access to the \
Internet, please try again.")
Internet and the Guix substitute server, please try again.")
(G_ "Connection error"))
(raise
(condition