scripts/functions
changeset 265 4d5beae7cb87
parent 242 8e5b994260d0
child 305 00a7e6c275da
     1.1 --- a/scripts/functions	Thu Jul 12 19:52:09 2007 +0000
     1.2 +++ b/scripts/functions	Sun Jul 15 17:00:30 2007 +0000
     1.3 @@ -334,24 +334,31 @@
     1.4      # or, as a failover, a file without extension.
     1.5      # Try local copy first, if it exists
     1.6      for ext in ${first_ext} .tar.bz2 .tar.gz .tgz .tar ''; do
     1.7 +        CT_DoLog DEBUG "Trying \"${CT_LOCAL_TARBALLS_DIR}/${file}${ext}\""
     1.8          if [ -r "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" -a \
     1.9               "${CT_FORCE_DOWNLOAD}" != "y" ]; then
    1.10 -            CT_DoLog EXTRA "Copying \"${file}\" from local copy"
    1.11 +            CT_DoLog EXTRA "Retrieving \"${file}\" from local storage"
    1.12              cp -v "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" |CT_DoLog ALL
    1.13              return 0
    1.14          fi
    1.15      done
    1.16      # Try to download it
    1.17 -    CT_DoLog EXTRA "Retrieving \"${file}\""
    1.18 +    CT_DoLog EXTRA "Retrieving \"${file}\" from network"
    1.19      for ext in ${first_ext} .tar.bz2 .tar.gz .tgz .tar ''; do
    1.20          # Try all urls in turn
    1.21          for url in "$@"; do
    1.22 -            case "${url}" in
    1.23 -                *)  CT_DoLog DEBUG "Trying \"${url}/${file}${ext}\""
    1.24 -                    CT_DoGetFile "${url}/${file}${ext}"
    1.25 -                    ;;
    1.26 -            esac
    1.27 -            [ -f "${file}${ext}" ] && return 0 || true
    1.28 +            CT_DoLog DEBUG "Trying \"${url}/${file}${ext}\""
    1.29 +            CT_DoGetFile "${url}/${file}${ext}"
    1.30 +            if [ -f "${file}${ext}" ]; then
    1.31 +                # No need to test if the file already exists because
    1.32 +                # it does NOT. If it did exist, we'd have been stopped
    1.33 +                # above, when looking for local copies.
    1.34 +                if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
    1.35 +                    CT_DoLog EXTRA "Saving \"${file}\" to local storage"
    1.36 +                    cp -v "${file}${ext}" "${CT_LOCAL_TARBALLS_DIR}" |CT_DoLog ALL
    1.37 +                fi
    1.38 +                return 0
    1.39 +            fi
    1.40          done
    1.41      done
    1.42      CT_Popd