diff --git a/scripts/install.sh b/scripts/install.sh index 3303f7c78fb5e..119e99dc2298d 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -949,12 +949,33 @@ check_network_prerequisites() { return 0 fi + # Run the probes in parallel — serially, two blocked probes cost + # 2 × --max-time (16 s) before the user sees any useful error; in + # parallel the worst case is one --max-time (8 s). + local pids=() + local tmpdir + tmpdir=$(mktemp -d) + local i=0 for url in "${checks[@]}"; do - if ! curl -fsSI --max-time 8 "$url" >/dev/null 2>&1; then + ( + if curl -fsSI --max-time 8 "$url" >/dev/null 2>&1; then + : > "$tmpdir/ok_$i" + fi + ) & + pids+=($!) + i=$((i + 1)) + done + wait "${pids[@]}" 2>/dev/null + + i=0 + for url in "${checks[@]}"; do + if [ ! -e "$tmpdir/ok_$i" ]; then failed=true log_warn "Could not reach $url" fi + i=$((i + 1)) done + rm -rf "$tmpdir" if [ "$failed" = false ]; then log_success "Internet connectivity looks good"