From b36ecbc71027d23e01cab66a70565e788ffe017c Mon Sep 17 00:00:00 2001 From: Katie Holly Date: Tue, 15 May 2018 22:06:12 +0200 Subject: 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 --- setup-apkrepos.in | 14 +------------- 1 file changed, 1 insertion(+), 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() { -- cgit v1.2.3