commit: b7ff4649798526382d732ef805d51e1a9cdea01d Author: Esteve Varela Colominas <esteve.varela <AT> gmail <DOT> com> AuthorDate: Thu Aug 11 18:13:23 2022 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Tue Jan 17 03:04:11 2023 +0000 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=b7ff4649
Add support for fetching from local GENTOO_MIRRORS Signed-off-by: Esteve Varela Colominas <esteve.varela <AT> gmail.com> Closes: https://github.com/gentoo/prefix/pull/14 Signed-off-by: Sam James <sam <AT> gentoo.org> scripts/bootstrap-prefix.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh index 48f6b686cc..857017581a 100755 --- a/scripts/bootstrap-prefix.sh +++ b/scripts/bootstrap-prefix.sh @@ -45,11 +45,20 @@ emake() { efetch() { if [[ ! -e ${DISTDIR}/${1##*/} ]] ; then - if [[ ${OFFLINE_MODE} ]]; then - echo "I need ${1##*/} from $1 in $DISTDIR, can you give it to me?" - read - [[ -e ${DISTDIR}/${1##*/} ]] && return 0 - # Give fetch a try + mkdir -p "${DISTDIR}" >& /dev/null + + # Try fetching from local mirrors first, as this requires no connection + for loc in ${GENTOO_MIRRORS} ; do + if [[ ${loc} = /* && -e "${loc}/${1##*/}" ]]; then + cp "${loc}/${1##*/}" "${DISTDIR}/${1##*/}" && return 0 + fi + done + + if [[ ${OFFLINE_MODE} ]] ; then + echo "I need ${1##*/} from $1 in $DISTDIR, can you give it to me?" + read + [[ -e ${DISTDIR}/${1##*/} ]] && return 0 + # Give fetch a try fi if [[ -z ${FETCH_COMMAND} ]] ; then @@ -75,7 +84,6 @@ efetch() { fi fi - mkdir -p "${DISTDIR}" >& /dev/null einfo "Fetching ${1##*/}" estatus "stage1: fetching ${1##*/}" pushd "${DISTDIR}" > /dev/null
