# HG changeset patch # User "Yann E. MORIN" # Date 1312322444 -7200 # Node ID b132d22c912afd0b9d2538b45c222ea01f0f70fa # Parent 2472b2f24e3a6a375e123573bf3258048f756768 scripts/functions: use array variables for URLs list This is needed later, when we'll conditionnally use both the upstream and the mirror URLs. Signed-off-by: "Yann E. MORIN" diff -r 2472b2f24e3a -r b132d22c912a scripts/functions --- a/scripts/functions Tue Aug 02 23:11:25 2011 +0200 +++ b/scripts/functions Wed Aug 03 00:00:44 2011 +0200 @@ -513,7 +513,8 @@ # Usage: CT_GetFile [.extension] [url ...] CT_GetFile() { local ext - local url URLS + local -a URLS + local url local file="$1" local first_ext shift @@ -535,17 +536,18 @@ # Add URLs on the LAN mirror if [ "${CT_USE_MIRROR}" = "y" ]; then CT_TestOrAbort "Please set the mirror base URL" -n "${CT_MIRROR_BASE_URL}" - URLS="${CT_MIRROR_BASE_URL}/${file%-*} ${CT_MIRROR_BASE_URL}" + URLS+=( "${CT_MIRROR_BASE_URL}/${file%-*}" ) + URLS+=( "${CT_MIRROR_BASE_URL}" ) fi - URLS+="${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 for ext in ${first_ext} .tar.bz2 .tar.gz .tgz .tar ''; do # Try all urls in turn - for url in ${URLS}; do + for url in "${URLS[@]}"; do [ -n "${url}" ] || continue CT_DoLog DEBUG "Trying '${url}/${file}${ext}'" CT_DoGetFile "${url}/${file}${ext}"