termux-tools: use 5 seconds connection timeout when testing mirror availability
This commit is contained in:
parent
86816e7bf0
commit
578f66a5e3
@ -1,7 +1,7 @@
|
||||
TERMUX_PKG_HOMEPAGE=https://termux.com/
|
||||
TERMUX_PKG_DESCRIPTION="Basic system tools for Termux"
|
||||
TERMUX_PKG_LICENSE="GPL-3.0"
|
||||
TERMUX_PKG_VERSION=0.91
|
||||
TERMUX_PKG_VERSION=0.92
|
||||
TERMUX_PKG_SKIP_SRC_EXTRACT=true
|
||||
TERMUX_PKG_PLATFORM_INDEPENDENT=true
|
||||
TERMUX_PKG_ESSENTIAL=true
|
||||
|
@ -61,9 +61,14 @@ select_mirror() {
|
||||
|
||||
# Mirrors are rotated if 6 hours timeout has been passed or mirror is no longer accessible.
|
||||
if [ -n "$(find /data/data/com.termux/cache/apt/pkgcache.bin -mmin -360 2>/dev/null)" ]; then
|
||||
if [ -n "${current_mirror}" ] && curl --user-agent 'Termux-PKG/1.0 mirror-checker' --head --fail --location "${current_mirror}/dists/stable/Release" >/dev/null 2>&1; then
|
||||
echo "Reusing mirror: ${current_mirror}"
|
||||
if [ -n "${current_mirror}" ]; then
|
||||
echo -n "Checking availability of current mirror: "
|
||||
if curl --connect-timeout 5 --user-agent 'Termux-PKG/1.0 mirror-checker' --head --fail --location "${current_mirror}/dists/stable/Release" >/dev/null 2>&1; then
|
||||
echo "ok"
|
||||
return
|
||||
else
|
||||
echo "bad"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -72,7 +77,7 @@ select_mirror() {
|
||||
local w total_mirror_weight=0
|
||||
for w in "${!mirrors[@]}"; do
|
||||
echo -n "[*] ${mirrors[$w]}: "
|
||||
if curl --user-agent 'Termux-PKG/1.0 mirror-checker' --head --fail --location "${mirrors[$w]}/dists/stable/Release" >/dev/null 2>&1; then
|
||||
if curl --connect-timeout 5 --user-agent 'Termux-PKG/1.0 mirror-checker' --head --fail --location "${mirrors[$w]}/dists/stable/Release" >/dev/null 2>&1; then
|
||||
echo "ok"
|
||||
total_mirror_weight=$((total_mirror_weight + w))
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user