aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-12-15 12:34:14 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2015-12-15 12:34:14 +0000
commit559ab612b8e6f2e0bd7925d3311e5c48674622d8 (patch)
tree0927201056e17237c4ec507cf3c22ff6df156bcc
parent94988675758fa746e0b5931a49e76cb52a992758 (diff)
downloadalpine-conf-559ab612b8e6f2e0bd7925d3311e5c48674622d8.tar.bz2
alpine-conf-559ab612b8e6f2e0bd7925d3311e5c48674622d8.tar.xz
setup-apkrepos: use wget spider mode to find fastest mirror
we also try warm up the dns cache before we measure the time
-rw-r--r--setup-apkrepos.in8
1 files changed, 5 insertions, 3 deletions
diff --git a/setup-apkrepos.in b/setup-apkrepos.in
index 1bbccca..e798a63 100644
--- a/setup-apkrepos.in
+++ b/setup-apkrepos.in
@@ -46,10 +46,12 @@ time_cmd() {
find_fastest_mirror() {
export http_proxy=
local url=
+ local arch=$(apk --print-arch)
for url in $MIRRORS; do
- local time=$(time_cmd apk update --quiet $apk_root_opt \
- --repository ${url%/}/edge/main \
- --repositories-file /dev/null)
+ # warm up the dns cache
+ nslookup $(get_hostname_from_url $url) >/dev/null 2>&1
+ local time=$(time_cmd wget -q -s -T 5 \
+ ${url%/}/edge/main/$arch/APKINDEX.tar.gz)
if [ -n "$time" ]; then
echo "$time $url"
fi