Browse Source

sde-download: Enhanced mirror test to use KB/s or MB/s when proper

karasz/new-early
Alejandro Mery 16 years ago
parent
commit
f7f7205516
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      lib/sde-download/mirror-test.sh

+ 10
- 1
lib/sde-download/mirror-test.sh

@ -19,6 +19,8 @@ maxspeed=0 mirror=
. $SDEROOT/lib/libsde.in
DC="$( type -p dc )"
OLDIFS="$IFS" IFS=":"
while read name country admin url ; do
# translate $country
@ -42,7 +44,14 @@ while read name country admin url ; do
if [ "${speed:-0}" = "0" ]; then
echo ' failed' 1>&2
else
echo " $speed B/s" 1>&2
if [ -z "$DC" -o $speed -lt 4096 ]; then
echo " $speed B/s" 1>&2
elif [ $speed -lt 1048576 ]; then
echo " $($DC -e "2k $speed 1024 / p" ) KB/s" 1>&2
else
echo " $($DC -e "2k $speed 1048576 / p" ) MB/s" 1>&2
fi
# and make a choice
if [ "$speed" -gt "$maxspeed" ]; then
maxspeed="$speed"; mirror="$url"

Loading…
Cancel
Save