From b3c8621bdadd03d74af2abcc73e297d0fe26075e Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Sat, 21 Oct 2017 13:56:29 +0200 Subject: bin/build-packages: try other mirrors if download of x86_64 package fails --- bin/build-packages | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'bin/build-packages') diff --git a/bin/build-packages b/bin/build-packages index 4f2ed68..61b32a2 100755 --- a/bin/build-packages +++ b/bin/build-packages @@ -306,11 +306,27 @@ while [ "${count}" -ne 0 ]; do -printf '%f\n' | \ sponge | \ while read -r pkg_file; do - url=$( + { pacman -Spdd --print-format '%l' --noconfirm "${pkg_file%-*-*-*}" - ) - wget -q -nd "${url}" || \ - true + # shellcheck disable=SC2016 + curl -Ss 'https://www.archlinux.org/mirrorlist/?country=all&protocol=https&tier=1&use_mirror_status=on' | \ + sed -n ' + s/^#Server = // + T + s/\$repo/'"${repository}"'/g + s/\$arch/x86_64/g + s|/$|| + s|$|/'"${pkg_file}"'| + s/-i686\(\.pkg\.tar\.xz\)$/-x86_64\1/ + p + ' | \ + shuf + } | \ + while read -r url; do + if wget -q -nd "${url}"; then + break; + fi + done done if [ "${repository}" = 'multilib' ]; then x86_64_build_command='multilib-build' -- cgit v1.2.3-54-g00ecf