scripts/functions
changeset 2594 b132d22c912a
parent 2593 2472b2f24e3a
child 2595 d6b2354d9d17
     1.1 --- a/scripts/functions	Tue Aug 02 23:11:25 2011 +0200
     1.2 +++ b/scripts/functions	Wed Aug 03 00:00:44 2011 +0200
     1.3 @@ -513,7 +513,8 @@
     1.4  # Usage: CT_GetFile <basename> [.extension] <url> [url ...]
     1.5  CT_GetFile() {
     1.6      local ext
     1.7 -    local url URLS
     1.8 +    local -a URLS
     1.9 +    local url
    1.10      local file="$1"
    1.11      local first_ext
    1.12      shift
    1.13 @@ -535,17 +536,18 @@
    1.14      # Add URLs on the LAN mirror
    1.15      if [ "${CT_USE_MIRROR}" = "y" ]; then
    1.16          CT_TestOrAbort "Please set the mirror base URL" -n "${CT_MIRROR_BASE_URL}"
    1.17 -        URLS="${CT_MIRROR_BASE_URL}/${file%-*} ${CT_MIRROR_BASE_URL}"
    1.18 +        URLS+=( "${CT_MIRROR_BASE_URL}/${file%-*}" )
    1.19 +        URLS+=( "${CT_MIRROR_BASE_URL}" )
    1.20      fi
    1.21  
    1.22 -    URLS+="${URLS:+ }${*}"
    1.23 +    URLS+=( "${@}" )
    1.24  
    1.25      # Scan all URLs in turn, and try to grab a tarball from there
    1.26      # Do *not* try git trees (ext=/.git), this is handled in a specific
    1.27      # wrapper, below
    1.28      for ext in ${first_ext} .tar.bz2 .tar.gz .tgz .tar ''; do
    1.29          # Try all urls in turn
    1.30 -        for url in ${URLS}; do
    1.31 +        for url in "${URLS[@]}"; do
    1.32              [ -n "${url}" ] || continue
    1.33              CT_DoLog DEBUG "Trying '${url}/${file}${ext}'"
    1.34              CT_DoGetFile "${url}/${file}${ext}"