installer: Factorize url-alive? in internet check.
* gnu/installer/newt/network.scm (wait-service-online): Factorize url-alive? in internet check.
parent
3ab14386cd
commit
883fb8f41b
|
@ -115,6 +115,11 @@ network devices were found. Do you want to continue anyway?"))
|
||||||
(define (wait-service-online)
|
(define (wait-service-online)
|
||||||
"Display a newt scale until connman detects an Internet access. Do
|
"Display a newt scale until connman detects an Internet access. Do
|
||||||
FULL-VALUE tentatives, spaced by 1 second."
|
FULL-VALUE tentatives, spaced by 1 second."
|
||||||
|
(define (url-alive? url)
|
||||||
|
(false-if-exception
|
||||||
|
(= (response-code (http-request url))
|
||||||
|
200)))
|
||||||
|
|
||||||
(define (ci-available?)
|
(define (ci-available?)
|
||||||
(dynamic-wind
|
(dynamic-wind
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
@ -122,15 +127,8 @@ FULL-VALUE tentatives, spaced by 1 second."
|
||||||
(lambda _ #f))
|
(lambda _ #f))
|
||||||
(alarm 3))
|
(alarm 3))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(or
|
(or (url-alive? "https://ci.guix.gnu.org")
|
||||||
(false-if-exception
|
(url-alive? "https://bordeaux.guix.gnu.org")))
|
||||||
(= (response-code
|
|
||||||
(http-request "https://ci.guix.gnu.org"))
|
|
||||||
200))
|
|
||||||
(false-if-exception
|
|
||||||
(= (response-code
|
|
||||||
(http-request "https://bordeaux.guix.gnu.org"))
|
|
||||||
200))))
|
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(alarm 0))))
|
(alarm 0))))
|
||||||
|
|
||||||
|
|
Reference in New Issue