From 263c92b3eb47ec6573ca0e0b1956ac7266aa9312 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Wed, 3 Aug 2011 00:00:44 +0200 Subject: 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 --git a/scripts/functions b/scripts/functions index d6dc6b0..24bebb4 100644 --- a/scripts/functions +++ b/scripts/functions @@ -513,7 +513,8 @@ CT_SaveLocal() { # 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 @@ CT_GetFile() { # 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}" -- cgit v0.10.2-6-g49f6