diff --git a/misc/build.func b/misc/build.func index 0af90274..8f92afa8 100644 --- a/misc/build.func +++ b/misc/build.func @@ -4601,8 +4601,13 @@ EOF' fi pct exec "$CTID" -- bash -c "apt-get update >/dev/null && apt-get install -y sudo curl mc gnupg2 jq >/dev/null" || { - msg_warn "apt-get base packages failed, retrying with CDN bypass..." + msg_warn "apt-get base packages failed, retrying with by-hash bypass and alternate mirror..." pct exec "$CTID" -- bash -c " + echo 'Acquire::By-Hash \"no\";' >/etc/apt/apt.conf.d/99no-by-hash + rm -rf /var/lib/apt/lists/* + if apt-get update >/dev/null 2>&1 && apt-get install -y sudo curl mc gnupg2 jq >/dev/null 2>&1; then + exit 0 + fi if [ -f /etc/apt/sources.list.d/debian.sources ]; then sed -i 's|deb.debian.org|ftp.debian.org|g' /etc/apt/sources.list.d/debian.sources elif [ -f /etc/apt/sources.list ]; then diff --git a/misc/install.func b/misc/install.func index 470ef3f7..6f8ae80e 100644 --- a/misc/install.func +++ b/misc/install.func @@ -201,14 +201,18 @@ pkg_update() { case "$PKG_MANAGER" in apt) if ! $STD apt-get update; then - msg_warn "apt-get update failed, retrying with CDN bypass..." - if [[ -f /etc/apt/sources.list.d/debian.sources ]]; then - sed -i 's|deb.debian.org|ftp.debian.org|g' /etc/apt/sources.list.d/debian.sources - elif [[ -f /etc/apt/sources.list ]]; then - sed -i 's|deb.debian.org|ftp.debian.org|g' /etc/apt/sources.list - fi + msg_warn "apt-get update failed, retrying with by-hash bypass and alternate mirror..." + echo 'Acquire::By-Hash "no";' >/etc/apt/apt.conf.d/99no-by-hash rm -rf /var/lib/apt/lists/* - $STD apt-get update + if ! $STD apt-get update; then + if [[ -f /etc/apt/sources.list.d/debian.sources ]]; then + sed -i 's|deb.debian.org|ftp.debian.org|g' /etc/apt/sources.list.d/debian.sources + elif [[ -f /etc/apt/sources.list ]]; then + sed -i 's|deb.debian.org|ftp.debian.org|g' /etc/apt/sources.list + fi + rm -rf /var/lib/apt/lists/* + $STD apt-get update + fi fi ;; apk)