From 9a30610d1aa7bebcddd0f70529e9d497f7f60019 Mon Sep 17 00:00:00 2001 From: Jose Date: Tue, 3 Dec 2019 00:57:47 -0400 Subject: [PATCH] Provide alternative fetch urls --- usr/local/share/bastille/bootstrap.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/usr/local/share/bastille/bootstrap.sh b/usr/local/share/bastille/bootstrap.sh index ada5cb85..04801028 100644 --- a/usr/local/share/bastille/bootstrap.sh +++ b/usr/local/share/bastille/bootstrap.sh @@ -441,7 +441,13 @@ case "${1}" in NAME_VERIFY=$(echo "${RELEASE}" | grep -iwE '^([1-9]{2,2})\.[0-9](-RELEASE|-RC[1-2])$' | tr '[:lower:]' '[:upper:]') if [ -n "${NAME_VERIFY}" ]; then RELEASE="${NAME_VERIFY}" - UPSTREAM_URL="http://ftp.freebsd.org/pub/FreeBSD/releases/${HW_MACHINE}/${HW_MACHINE_ARCH}/${RELEASE}" + if [ "$(ping -c1 ftp.freebsd.org 2>/dev/null)" ]; then + ## main http + UPSTREAM_URL="http://ftp.freebsd.org/pub/FreeBSD/releases/${HW_MACHINE}/${HW_MACHINE_ARCH}/${RELEASE}" + else + ## main ftp + UPSTREAM_URL="ftp://ftp.freebsd.org/pub/FreeBSD/releases/${HW_MACHINE}/${HW_MACHINE_ARCH}/${RELEASE}" + fi bootstrap_directories bootstrap_release else @@ -467,7 +473,13 @@ NAME_RELEASE=$(echo ${NAME_VERIFY} | sed 's/-build-[0-9]\{1,2\}//g') NAME_BUILD=$(echo ${NAME_VERIFY} | sed 's/[0-9]\{1,2\}-stable-//g') if [ -n "${NAME_VERIFY}" ]; then RELEASE="${NAME_VERIFY}" - UPSTREAM_URL="http://ci-01.nyi.hardenedbsd.org/pub/hardenedbsd/${NAME_RELEASE}/${HW_MACHINE}/${HW_MACHINE_ARCH}/${NAME_BUILD}" + if [ "$(ping -c1 installer.hardenedbsd.org 2>/dev/null)" ]; then + ## main site + UPSTREAM_URL="http://installer.hardenedbsd.org/pub/hardenedbsd/${NAME_RELEASE}/${HW_MACHINE}/${HW_MACHINE_ARCH}/${NAME_BUILD}" + else + ## alternate mirror + UPSTREAM_URL="http://ci-01.nyi.hardenedbsd.org/pub/hardenedbsd/${NAME_RELEASE}/${HW_MACHINE}/${HW_MACHINE_ARCH}/${NAME_BUILD}" + fi bootstrap_directories bootstrap_release else