Standardize mirror messaging; simplify apt update
Replace inconsistent msg_info calls with msg_warn for mirror-list warnings and msg_custom for "Attempting mirror" lines to unify output formatting in misc/build.func and misc/install.func. Simplify tools/pve/update-lxcs-cron.sh by removing the long mirror-probing block and using a straightforward apt-get update + noninteractive dist-upgrade (and cleanup of EXTERNALLY-MANAGED) in containers to reduce complexity and improve maintainability.
This commit is contained in:
@@ -283,7 +283,7 @@ pkg_update() {
|
||||
others_pick=$(printf '%s\n' $others_ok | shuf | head -3 | xargs)
|
||||
|
||||
for mirror in $others_pick; do
|
||||
msg_info "Attempting mirror: ${mirror}"
|
||||
msg_custom "${INFO}" "${YW}" "Attempting mirror: ${mirror}"
|
||||
if _try_apt_mirror "$mirror"; then
|
||||
apt_ok=true
|
||||
break
|
||||
@@ -299,7 +299,7 @@ pkg_update() {
|
||||
primary="ftp.debian.org"
|
||||
fi
|
||||
if timeout 2 bash -c "echo >/dev/tcp/$primary/80" 2>/dev/null; then
|
||||
msg_info "Attempting mirror: ${primary}"
|
||||
msg_custom "${INFO}" "${YW}" "Attempting mirror: ${primary}"
|
||||
if _try_apt_mirror "$primary"; then
|
||||
apt_ok=true
|
||||
fi
|
||||
@@ -314,7 +314,7 @@ pkg_update() {
|
||||
regional_pick=$(printf '%s\n' $regional_ok | shuf | head -3 | xargs)
|
||||
|
||||
for mirror in $regional_pick; do
|
||||
msg_info "Attempting mirror: ${mirror}"
|
||||
msg_custom "${INFO}" "${YW}" "Attempting mirror: ${mirror}"
|
||||
if _try_apt_mirror "$mirror"; then
|
||||
apt_ok=true
|
||||
break
|
||||
@@ -326,9 +326,9 @@ pkg_update() {
|
||||
if [[ "$apt_ok" != true ]]; then
|
||||
msg_warn "Multiple mirrors failed (possible CDN synchronization issue)."
|
||||
if [[ "$distro" == "ubuntu" ]]; then
|
||||
msg_info "Find Ubuntu mirrors at: https://launchpad.net/ubuntu/+archivemirrors"
|
||||
msg_warn "Find Ubuntu mirrors at: https://launchpad.net/ubuntu/+archivemirrors"
|
||||
else
|
||||
msg_info "Find Debian mirrors at: https://www.debian.org/mirror/list"
|
||||
msg_warn "Find Debian mirrors at: https://www.debian.org/mirror/list"
|
||||
fi
|
||||
while true; do
|
||||
read -rp " Enter a mirror hostname (or 'skip' to abort): " custom_mirror </dev/tty
|
||||
@@ -359,7 +359,7 @@ pkg_update() {
|
||||
local apk_ok=false
|
||||
for m in $(printf '%s\n' $alpine_mirrors | shuf); do
|
||||
if timeout 2 bash -c "echo >/dev/tcp/$m/80" 2>/dev/null; then
|
||||
msg_info "Attempting mirror: ${m}"
|
||||
msg_custom "${INFO}" "${YW}" "Attempting mirror: ${m}"
|
||||
cat <<EOF >/etc/apk/repositories
|
||||
http://$m/alpine/latest-stable/main
|
||||
http://$m/alpine/latest-stable/community
|
||||
|
||||
Reference in New Issue
Block a user