1.1 --- a/scripts/functions Mon Jul 14 21:56:58 2008 +0000
1.2 +++ b/scripts/functions Sun Jul 20 13:21:54 2008 +0000
1.3 @@ -361,18 +361,50 @@
1.4 return 0
1.5 fi
1.6 done
1.7 - # Try to download it
1.8 +
1.9 + # Not found locally, try from the network
1.10 CT_DoLog EXTRA "Retrieving '${file}' from network"
1.11 +
1.12 + # Start with LAN mirror
1.13 + if [ "${CT_USE_LAN_MIRROR}" = "y" ]; then
1.14 + LAN_URLs=
1.15 + for pat in ${CT_LAN_MIRROR_PATTERNS}; do
1.16 + # Please note: we just have the file's basename in a single piece.
1.17 + # So we have to just try and split it back into name and version... :-(
1.18 + pat="${pat//\%pkg/${file%-*}}"
1.19 + pat="${pat//\%ver/${file##*-}}"
1.20 + LAN_URLs="${LAN_URLs} ${CT_LAN_MIRROR_SCHEME}://${CT_LAN_MIRROR_HOSTNAME}/${pat}"
1.21 + done
1.22 + for ext in ${first_ext} .tar.bz2 .tar.gz .tgz .tar ''; do
1.23 + for url in ${LAN_URLs}; do
1.24 + CT_DoLog DEBUG "Trying '${url}/${file}${ext}'"
1.25 + CT_DoGetFile "${url}/${file}${ext}"
1.26 + if [ -f "${file}${ext}" ]; then
1.27 + if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
1.28 + # No need to test if the file already exists because
1.29 + # it does NOT. If it did exist, we'd have been stopped
1.30 + # above, when looking for local copies.
1.31 + CT_DoLog EXTRA "Saving '${file}' to local storage"
1.32 + mv "${file}${ext}" "${CT_LOCAL_TARBALLS_DIR}" |CT_DoLog ALL
1.33 + ln -sv "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" |CT_DoLog ALL
1.34 + fi
1.35 + return 0
1.36 + fi
1.37 + done
1.38 + done
1.39 + fi
1.40 +
1.41 + # OK, available neither localy, nor from the LAN mirror (if any).
1.42 for ext in ${first_ext} .tar.bz2 .tar.gz .tgz .tar ''; do
1.43 # Try all urls in turn
1.44 for url in "$@"; do
1.45 CT_DoLog DEBUG "Trying '${url}/${file}${ext}'"
1.46 CT_DoGetFile "${url}/${file}${ext}"
1.47 if [ -f "${file}${ext}" ]; then
1.48 - # No need to test if the file already exists because
1.49 - # it does NOT. If it did exist, we'd have been stopped
1.50 - # above, when looking for local copies.
1.51 if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
1.52 + # No need to test if the file already exists because
1.53 + # it does NOT. If it did exist, we'd have been stopped
1.54 + # above, when looking for local copies.
1.55 CT_DoLog EXTRA "Saving '${file}' to local storage"
1.56 mv "${file}${ext}" "${CT_LOCAL_TARBALLS_DIR}" |CT_DoLog ALL
1.57 ln -sv "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" |CT_DoLog ALL