aboutsummaryrefslogtreecommitdiffstats
path: root/main/alpine-conf/0001-setup-apkrepos-fix-excluding-faulty-mirrors.patch
blob: 142c23e0f6f6ef08734e288bac1f13374da5e03a (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
41
42
43
44
45
46
From 9d4be42d567eeafa6e01deab22ce1ca1a5e87ff5 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 14 May 2015 10:07:24 +0200
Subject: [PATCH] setup-apkrepos: fix excluding faulty mirrors

This is a fix of commit 3f769dc (setup-apkrepos: exclude faulty mirrors
from detection)

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

diff --git a/setup-apkrepos.in b/setup-apkrepos.in
index 5e0131a..1956b19 100644
--- a/setup-apkrepos.in
+++ b/setup-apkrepos.in
@@ -38,11 +38,9 @@ add_random_mirror() {
 
 time_cmd() {
 	local start=$(cut -d ' ' -f1 /proc/uptime)
-	$@ >&2
-	local ret=$?
+	$@ >&2 || return
 	awk -v start=$start -v end=$(cut -d ' ' -f1 /proc/uptime) \
 		'BEGIN {print end - start; exit}'
-	return $ret
 }
 
 find_fastest_mirror() {
@@ -51,8 +49,10 @@ find_fastest_mirror() {
 	for url in $MIRRORS; do
 		local time=$(time_cmd apk update --quiet $apk_root_opt \
 				--repository $url/edge/main \
-				--repositories-file /dev/null) || continue
-		echo "$time $url"
+				--repositories-file /dev/null)
+		if [ -n "$time" ]; then
+			echo "$time $url"
+		fi
 	done | awk ' {
 		if (!current) {
 			current=$1
-- 
2.4.0