From 811b14aa48a8f91ce9ec70cb7bf3e20390f3d527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Sat, 30 Apr 2022 18:58:43 +0200 Subject: [PATCH] Remove dead mirrors to suppress rootfs download errors (#3721) * Remove dead mirrors to suppress rootfs download errors * Typo --- config/templates/Dockerfile | 1 + lib/general.sh | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/config/templates/Dockerfile b/config/templates/Dockerfile index 5ca50014f3..65f8aab651 100644 --- a/config/templates/Dockerfile +++ b/config/templates/Dockerfile @@ -82,6 +82,7 @@ RUN apt-get update \ openssh-client \ p7zip-full \ parted \ + parallel \ patchutils \ pigz \ pixz \ diff --git a/lib/general.sh b/lib/general.sh index 58ef582858..04951be39e 100644 --- a/lib/general.sh +++ b/lib/general.sh @@ -1376,7 +1376,7 @@ prepare_host() dialog dirmngr dosfstools dwarves f2fs-tools fakeroot flex gawk \ gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu gdisk gpg \ imagemagick jq kmod libbison-dev libc6-dev-armhf-cross libcrypto++-dev \ - libelf-dev libfdt-dev libfile-fcntllock-perl \ + libelf-dev libfdt-dev libfile-fcntllock-perl parallel \ libfl-dev liblz4-tool libncurses-dev libpython2.7-dev libssl-dev \ libusb-1.0-0-dev linux-base locales lzop ncurses-base ncurses-term \ nfs-kernel-server ntpdate p7zip-full parted patchutils pigz pixz \ @@ -1600,6 +1600,18 @@ function webseed () # Hardcoded to EU mirrors since local CCODE=$(curl -s redirect.armbian.com/geoip | jq '.continent.code' -r) WEBSEED=($(curl -s https://redirect.armbian.com/mirrors | jq -r '.'${CCODE}' | .[] | values')) + # remove dead mirrors to suppress download errors + FILE=".control" + while read -r line + do + REMOVE=$(echo $line | egrep -o 'https?://[^ ]+/') + WEBSEED=( "${WEBSEED[@]/$REMOVE}" ) + done < <( + for k in ${WEBSEED[@]} + do + echo "$k$FILE" + done | parallel --halt soon,fail=10 --jobs 32 wget -q --spider --timeout=15 --tries=4 --retry-connrefused {} 2>&1 >/dev/null) + # aria2 simply split chunks based on sources count not depending on download speed # when selecting china mirrors, use only China mirror, others are very slow there if [[ $DOWNLOAD_MIRROR == china ]]; then