termux-tools: avoid duplicate slashes in URLs when checking mirror availability

Really this is not an issue, but double slashes make logs looking a bit weird:

... "HEAD //dists/stable/Release HTTP/1.1" ...
This commit is contained in:
Leonid Pliushch 2020-08-11 20:38:35 +03:00
parent 9e68f57a73
commit 46425818bc
2 changed files with 3 additions and 3 deletions

View File

@ -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.93
TERMUX_PKG_VERSION=0.94
TERMUX_PKG_SKIP_SRC_EXTRACT=true
TERMUX_PKG_PLATFORM_INDEPENDENT=true
TERMUX_PKG_ESSENTIAL=true

View File

@ -63,7 +63,7 @@ select_mirror() {
if [ -n "$(find /data/data/com.termux/cache/apt/pkgcache.bin -mmin -360 2>/dev/null)" ]; then
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
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
@ -77,7 +77,7 @@ select_mirror() {
local w total_mirror_weight=0
for w in "${!mirrors[@]}"; do
echo -n "[*] ${mirrors[$w]}: "
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
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