diff options
author | 2022-08-11 20:13:23 +0200 | |
---|---|---|
committer | 2023-01-17 03:04:11 +0000 | |
commit | b7ff4649798526382d732ef805d51e1a9cdea01d (patch) | |
tree | a63b13ad8a52cc1b1b2a6c0928525481a3a777e9 | |
parent | sys-devel/binutils: use app-alternatives/yacc (diff) | |
download | prefix-b7ff4649798526382d732ef805d51e1a9cdea01d.tar.gz prefix-b7ff4649798526382d732ef805d51e1a9cdea01d.tar.bz2 prefix-b7ff4649798526382d732ef805d51e1a9cdea01d.zip |
Add support for fetching from local GENTOO_MIRRORS
Signed-off-by: Esteve Varela Colominas <esteve.varela@gmail.com>
Closes: https://github.com/gentoo/prefix/pull/14
Signed-off-by: Sam James <sam@gentoo.org>
-rwxr-xr-x | scripts/bootstrap-prefix.sh | 20 |
1 files 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 |