summarylogtreecommitdiffstats
path: root/reflector-simple
diff options
context:
space:
mode:
authorMikhail Velichko2022-09-25 13:56:50 +0300
committerMikhail Velichko2022-09-25 13:56:50 +0300
commitf629ee5459d63df33304e6e5d1b2a47fb14e8f97 (patch)
tree1249006117e24a889ac81ac4a7ba60a7570c65c4 /reflector-simple
parent2bf84a6e871a1315be2ca20f94448a84fefd655f (diff)
downloadaur-f629ee5459d63df33304e6e5d1b2a47fb14e8f97.tar.gz
Version 3.3: Some bugfixes from EOS upstream
Diffstat (limited to 'reflector-simple')
-rwxr-xr-xreflector-simple18
1 files changed, 12 insertions, 6 deletions
diff --git a/reflector-simple b/reflector-simple
index 97ec179283a1..f770a74f3874 100755
--- a/reflector-simple
+++ b/reflector-simple
@@ -521,11 +521,17 @@ BuildReflectorCommand() {
fi
reflector_cmd+=(--sort $(echo "${reflector_info[$ix]}" | tr -d '|')) # with echo incrementing ix with ++ does not work
((ix++))
+
+ xx="${reflector_info[$ix]}"
+ [ $xx -le 0 ] && xx=5
+ export _MAX_MIRROR_LINES_TO_SHOW="$xx"
+
if [ "$use_number_instead_of_latest" = "yes" ] ; then
- reflector_cmd+=(--number "${reflector_info[$((ix++))]}")
+ reflector_cmd+=(--number "$xx")
else
- reflector_cmd+=(--latest "${reflector_info[$((ix++))]}")
+ reflector_cmd+=(--latest "$xx")
fi
+ ((ix++))
reflector_cmd+=(--download-timeout "${reflector_info[$((ix++))]}")
# add optional free parameters to the command and save free params to file
@@ -792,11 +798,11 @@ Main() {
Verbose "Starting ranking..."
"${reflector_cmd[@]}" 2>&1 > $tmpfile | tee $ranklog | {
- local line="" max_lines=0 value=0 line_count=-2
+ local line=""
+ local max_lines="$_MAX_MIRROR_LINES_TO_SHOW"
+ local value=0
+ local line_count=-2
while read line ; do
- if [[ "$line" == *"mirror(s) by"* ]]; then
- max_lines=$(echo "$line" | sed -e 's/.*rating \(.*\) mirror.*/\1/')
- fi
if [[ "$line" != *"WARNING:"* ]]; then
((line_count++))
fi