aboutsummaryrefslogtreecommitdiffstats
path: root/main/alpine-conf/0001-setup-apkrepos-exclude-faulty-mirrors-from-detection.patch
blob: c3015bee0fa33e28efb8cb698564249c7d34fe51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From 3f769dc941363dc1d4b4d3c898e6236003fddee8 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Wed, 8 Apr 2015 07:29:57 +0000
Subject: [PATCH] setup-apkrepos: exclude faulty mirrors from detection

ref #4017
---
 setup-apkrepos.in | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/setup-apkrepos.in b/setup-apkrepos.in
index 8bbb811..5e0131a 100644
--- a/setup-apkrepos.in
+++ b/setup-apkrepos.in
@@ -39,17 +39,20 @@ add_random_mirror() {
 time_cmd() {
 	local start=$(cut -d ' ' -f1 /proc/uptime)
 	$@ >&2
+	local ret=$?
 	awk -v start=$start -v end=$(cut -d ' ' -f1 /proc/uptime) \
 		'BEGIN {print end - start; exit}'
+	return $ret
 }
 
 find_fastest_mirror() {
 	export http_proxy=
 	local url=
 	for url in $MIRRORS; do
-		echo $(time_cmd apk update --quiet $apk_root_opt \
+		local time=$(time_cmd apk update --quiet $apk_root_opt \
 				--repository $url/edge/main \
-				--repositories-file /dev/null) $url
+				--repositories-file /dev/null) || continue
+		echo "$time $url"
 	done | awk ' {
 		if (!current) {
 			current=$1
-- 
2.4.0