alpine-rankmirrors

on kitten's pastes | raw

expires: 27 Apr, 2024

 1#!/bin/sh
 2
 3time() {
 4	while read -r uptime _; do
 5		echo "$uptime"
 6	done < /proc/uptime
 7}
 8
 9rank() {
10	while read -r mirror; do
11		printf '%s ' "$mirror"
12		start="$(time)"
13	
14		wget -q -O /dev/null -T 1 -t 1 "$mirror/${1:?}" >/dev/null 2>&1 || {
15			printf '\033[2K\r'
16			continue
17		}
18	
19		echo "$(time) - $start" | bc -l
20	done
21}
22
23wget -qO- https://mirrors.alpinelinux.org/mirrors.txt |
24	rank "edge/community/x86_64/dwm-6.4-r1.apk"