diff options
author | Katie Holly <git@meo.ws> | 2018-05-15 22:06:12 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2018-06-12 14:36:49 +0000 |
commit | b36ecbc71027d23e01cab66a70565e788ffe017c (patch) | |
tree | 938dd58a34135f9e33bf7488332cd30a2cf49746 | |
parent | 50c34a98b9f9b3979a3d1a7be89fa9ec78534eb5 (diff) | |
download | alpine-conf-b36ecbc71027d23e01cab66a70565e788ffe017c.zip |
setup-apkrepos: Allow the script to pick a server with 0.00sec download time and
replaced the awk script with tee-sort-head-cut magic
-rw-r--r-- | setup-apkrepos.in | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/setup-apkrepos.in b/setup-apkrepos.in index 91c2806..81e768e 100644 --- a/setup-apkrepos.in +++ b/setup-apkrepos.in @@ -57,19 +57,7 @@ find_fastest_mirror() { if [ -n "$time" ]; then echo "$time $url" fi - done | awk ' { - if (!current) { - current=$1 - url=$2 - } else { - if ($1 < current) { - current=$1 - url=$2 - } - } - printf("%6.2f %s\n", $1, $2) > "/dev/stderr" - } - END { print url }' + done | tee /dev/stderr | sort -nk1,1 | head -n1 | cut -d' ' -f2 } add_fastest_mirror() { |