Simplify mirror logs and use http for custom mirror
Reduce noisy mirror-related output and clarify messages across misc/build.func and misc/install.func. Reword various apt/mirror status lines (hash mismatch, SSL/certificate, apt-get update failed, package install failed) and standardize success to "Using mirror"/msg_ok. Remove verbose scan/try/skip/count logs and suppression of detailed apt output to make output cleaner for automated runs. Also change the custom_mirror sed replacement to use http:// instead of https:// to support non-HTTPS local mirrors.
This commit is contained in:
@@ -238,16 +238,13 @@ pkg_update() {
|
||||
local out
|
||||
out=$(apt-get update 2>&1)
|
||||
if echo "$out" | grep -qi "hashsum\|hash sum"; then
|
||||
msg_warn "Mirror failed: ${m} (hash mismatch)"
|
||||
echo "$out" | grep -i "hash" | head -3 | sed 's/^/ /'
|
||||
msg_warn "Mirror ${m}: hash mismatch, trying next..."
|
||||
return 1
|
||||
elif echo "$out" | grep -qi "SSL\|certificate"; then
|
||||
msg_warn "Mirror failed: ${m} (SSL error)"
|
||||
echo "$out" | grep -i "SSL\|certificate" | head -3 | sed 's/^/ /'
|
||||
msg_warn "Mirror ${m}: SSL/certificate error, trying next..."
|
||||
return 1
|
||||
elif echo "$out" | grep -q "^E:"; then
|
||||
msg_warn "Mirror failed: ${m} (apt-get update error)"
|
||||
echo "$out" | grep "^E:" | head -3 | sed 's/^/ /'
|
||||
msg_warn "Mirror ${m}: apt-get update failed, trying next..."
|
||||
return 1
|
||||
else
|
||||
msg_ok "Using mirror: ${m}"
|
||||
@@ -260,8 +257,6 @@ pkg_update() {
|
||||
for m in $1; do
|
||||
if timeout 2 bash -c "echo >/dev/tcp/$m/80" 2>/dev/null; then
|
||||
result="$result $m"
|
||||
else
|
||||
msg_info "Mirror skip: ${m} (unreachable)"
|
||||
fi
|
||||
done
|
||||
echo "$result" | xargs
|
||||
@@ -270,17 +265,12 @@ pkg_update() {
|
||||
local apt_ok=false
|
||||
|
||||
# Phase 1: Scan global mirrors first (independent of local CDN issues)
|
||||
msg_info "Scanning global mirrors..."
|
||||
local others_ok
|
||||
others_ok=$(_scan_reachable "$others")
|
||||
local others_pick
|
||||
others_pick=$(printf '%s\n' $others_ok | shuf | head -3 | xargs)
|
||||
local o_count
|
||||
o_count=$(echo "$others_pick" | wc -w)
|
||||
msg_info "Found ${o_count} global mirrors to try"
|
||||
|
||||
for mirror in $others_pick; do
|
||||
msg_info "Trying mirror: ${mirror}"
|
||||
if _try_apt_mirror "$mirror"; then
|
||||
apt_ok=true
|
||||
break
|
||||
@@ -290,7 +280,6 @@ pkg_update() {
|
||||
# Phase 2: Try ftp.debian.org
|
||||
if [[ "$apt_ok" != true ]]; then
|
||||
if timeout 2 bash -c "echo >/dev/tcp/ftp.debian.org/80" 2>/dev/null; then
|
||||
msg_info "Trying mirror: ftp.debian.org"
|
||||
if _try_apt_mirror "ftp.debian.org"; then
|
||||
apt_ok=true
|
||||
fi
|
||||
@@ -299,17 +288,12 @@ pkg_update() {
|
||||
|
||||
# Phase 3: Fall back to regional mirrors
|
||||
if [[ "$apt_ok" != true ]]; then
|
||||
msg_info "Scanning regional mirrors..."
|
||||
local regional_ok
|
||||
regional_ok=$(_scan_reachable "$regional")
|
||||
local regional_pick
|
||||
regional_pick=$(printf '%s\n' $regional_ok | shuf | head -3 | xargs)
|
||||
local r_count
|
||||
r_count=$(echo "$regional_pick" | wc -w)
|
||||
msg_info "Found ${r_count} regional mirrors to try"
|
||||
|
||||
for mirror in $regional_pick; do
|
||||
msg_info "Trying mirror: ${mirror}"
|
||||
if _try_apt_mirror "$mirror"; then
|
||||
apt_ok=true
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user