diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-03-01 14:20:04 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-03-01 14:20:04 +0000 |
commit | 64c155141aee8bd5f25cb5f8b89556b394a3a43a (patch) | |
tree | 6a4ec13a4cc46cdb0e2acc657366c961e51d9744 /setup-apkrepos.in | |
parent | ee9312c528a47e1170b975fc33167dbe35079b67 (diff) | |
download | alpine-conf-64c155141aee8bd5f25cb5f8b89556b394a3a43a.zip |
setup-apkrepos: minor simplification
We only need the hostname after we found the mirror we want
Diffstat (limited to 'setup-apkrepos.in')
-rwxr-xr-x | setup-apkrepos.in | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/setup-apkrepos.in b/setup-apkrepos.in index 8447e19..275734c 100755 --- a/setup-apkrepos.in +++ b/setup-apkrepos.in @@ -63,38 +63,33 @@ get_random_mirror() { } get_fastest_mirror() { - local mirror_hostname local tmp_mirror_nslookup local tmp_mirror_time local tmp_mirror_time_failed local tmp_mirror_rtt local mirror_lowest_rtt - local mirror_lowest_rtt_hostname local mirror_lowest_rtt_mirror echo -n "Finding fastest mirror... " mirror_lowest_rtt=-1 for mirror in $MIRRORS; do - mirror_hostname=`echo $mirror | awk -F '://' '{print $2}' | awk -F '/' '{print $1}'` tmp_mirror_time="`(time wget -qO - $mirror) 2>&1 || echo "E_MIRROR_FAILED"`" tmp_mirror_time_failed=`echo $tmp_mirror_time | grep "E_MIRROR_FAILED"` if [ ${#tmp_mirror_time_failed} -eq 0 ]; then tmp_mirror_rtt=`echo "$tmp_mirror_time" | grep -E "^real" | sed -r "s/^real[ ]+[0-9]+m[ ]+([0-9]+)\.([0-9]+)s$/\1\2/"` if [ $mirror_lowest_rtt -eq -1 ]; then mirror_lowest_rtt=$tmp_mirror_rtt - mirror_lowest_rtt_hostname=$mirror_hostname mirror_lowest_rtt_mirror=$mirror else if [ $tmp_mirror_rtt -lt $mirror_lowest_rtt ]; then mirror_lowest_rtt=$tmp_mirror_rtt - mirror_lowest_rtt_hostname=$mirror_hostname mirror_lowest_rtt_mirror=$mirror fi fi fi done - echo "using $mirror_lowest_rtt_hostname." mirror=$mirror_lowest_rtt_mirror + echo "using $(get_hostname_from_url $mirror)" } prompt_mirror_list() { |