summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-05-14 10:07:24 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2015-05-14 10:10:09 +0200
commit9d4be42d567eeafa6e01deab22ce1ca1a5e87ff5 (patch)
tree13efa43e6dcc206b8d6c018b5076b621ec0e5d93
parentd5c11ff64cb280ddd1bc8b57e34508e2fa1d3c5c (diff)
downloadalpine-conf-9d4be42d567eeafa6e01deab22ce1ca1a5e87ff5.tar.bz2
alpine-conf-9d4be42d567eeafa6e01deab22ce1ca1a5e87ff5.tar.xz
setup-apkrepos: fix excluding faulty mirrors
This is a fix of commit 3f769dc (setup-apkrepos: exclude faulty mirrors from detection) ref #4017
-rw-r--r--setup-apkrepos.in10
1 files 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