summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-08-02 21:11:25 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-08-02 21:11:25 (GMT)
commitbb3519ad377c4c9abaf9322614c9f9f0fd2b201d (patch)
treefa49406be72003f61fcffa3060271ce82b2a1ebb /scripts
parentcba626981033b209266dfe19538f3e6edb0e63a3 (diff)
scripts/functions: always prefer the mirror
Currently, the mirror can be used either: - as a fallback in case upstream is unavailable (default behavior) - as the preferred source for downloads But the most common use-case seems to provide a truely-LAN mirror to speed up downloads in big corpos', and/or provide a 'trusted' source for the tarballs. So, make the following changes; - if a mirror is specified, always try that before trying upstream Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/functions18
1 files changed, 4 insertions, 14 deletions
diff --git a/scripts/functions b/scripts/functions
index 42c456c..d6dc6b0 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -513,7 +513,7 @@ CT_SaveLocal() {
# Usage: CT_GetFile <basename> [.extension] <url> [url ...]
CT_GetFile() {
local ext
- local url URLS LAN_URLS
+ local url URLS
local file="$1"
local first_ext
shift
@@ -532,24 +532,14 @@ CT_GetFile() {
# Try to retrieve the file
CT_DoLog EXTRA "Retrieving '${file}'"
- URLS="$@"
-
# Add URLs on the LAN mirror
- LAN_URLS=
if [ "${CT_USE_MIRROR}" = "y" ]; then
CT_TestOrAbort "Please set the mirror base URL" -n "${CT_MIRROR_BASE_URL}"
- LAN_URLS="${LAN_URLS} ${CT_MIRROR_BASE_URL}/${file%-*}"
- LAN_URLS="${LAN_URLS} ${CT_MIRROR_BASE_URL}"
-
- if [ "${CT_PREFER_MIRROR}" = "y" ]; then
- CT_DoLog DEBUG "Pre-pending LAN mirror URLs"
- URLS="${LAN_URLS} ${URLS}"
- else
- CT_DoLog DEBUG "Appending LAN mirror URLs"
- URLS="${URLS} ${LAN_URLS}"
- fi
+ URLS="${CT_MIRROR_BASE_URL}/${file%-*} ${CT_MIRROR_BASE_URL}"
fi
+ URLS+="${URLS:+ }${*}"
+
# Scan all URLs in turn, and try to grab a tarball from there
# Do *not* try git trees (ext=/.git), this is handled in a specific
# wrapper, below