aboutsummaryrefslogtreecommitdiff
path: root/gnu/installer
diff options
context:
space:
mode:
authorAndrew Tropin <andrew@trop.in>2022-10-17 16:26:19 +0400
committerAndrew Tropin <andrew@trop.in>2022-10-17 16:34:07 +0400
commit883fb8f41b08a8455f16c736a83fb1ae8a3df0a1 (patch)
treea04603a03aae2e30a666ab1e80714e9e434f0bd0 /gnu/installer
parent3ab14386cd2a3fc4bacf2291ee585a0685aceb17 (diff)
downloadguix-883fb8f41b08a8455f16c736a83fb1ae8a3df0a1.tar
guix-883fb8f41b08a8455f16c736a83fb1ae8a3df0a1.tar.gz
installer: Factorize url-alive? in internet check.
* gnu/installer/newt/network.scm (wait-service-online): Factorize url-alive? in internet check.
Diffstat (limited to 'gnu/installer')
-rw-r--r--gnu/installer/newt/network.scm16
1 files changed, 7 insertions, 9 deletions
diff --git a/gnu/installer/newt/network.scm b/gnu/installer/newt/network.scm
index b11a55cb1f..ba26fc7c76 100644
--- a/gnu/installer/newt/network.scm
+++ b/gnu/installer/newt/network.scm
@@ -115,6 +115,11 @@ network devices were found. Do you want to continue anyway?"))
(define (wait-service-online)
"Display a newt scale until connman detects an Internet access. Do
FULL-VALUE tentatives, spaced by 1 second."
+ (define (url-alive? url)
+ (false-if-exception
+ (= (response-code (http-request url))
+ 200)))
+
(define (ci-available?)
(dynamic-wind
(lambda ()
@@ -122,15 +127,8 @@ FULL-VALUE tentatives, spaced by 1 second."
(lambda _ #f))
(alarm 3))
(lambda ()
- (or
- (false-if-exception
- (= (response-code
- (http-request "https://ci.guix.gnu.org"))
- 200))
- (false-if-exception
- (= (response-code
- (http-request "https://bordeaux.guix.gnu.org"))
- 200))))
+ (or (url-alive? "https://ci.guix.gnu.org")
+ (url-alive? "https://bordeaux.guix.gnu.org")))
(lambda ()
(alarm 0))))