diff -r 383c37e754df -r 61edd9d19e3c scripts/functions --- a/scripts/functions Tue Dec 29 22:11:09 2009 +0100 +++ b/scripts/functions Wed Dec 30 15:36:22 2009 +0100 @@ -348,12 +348,31 @@ || true } +# Download using aria2 +# Usage: CT_DoGetFileAria2 +CT_DoGetFileAria2() { + # Note: comments about curl method (above) are also valid here + # Plus: default progress indicator is a single line, so use verbose log + # so that the CT-NG's ouput is 'live'. + CT_DoExecLog ALL aria2c -l - -s ${CT_DOWNLOAD_MAX_CHUNKS} -m 3 --retry-wait 5 -t ${CT_CONNECT_TIMEOUT} -p "$1" \ + || CT_DoExecLog ALL aria2c -l - -s ${CT_DOWNLOAD_MAX_CHUNKS} -m 3 --retry-wait 5 -t ${CT_CONNECT_TIMEOUT} "$1" \ + || true +} + +# OK, just look if we have them... +_aria2c=$(CT_Which aria2c) _wget=$(CT_Which wget) _curl=$(CT_Which curl) -# Wrapper function to call one of curl or wget + +# Wrapper function to call one of, in order of preference: +# aria2 +# curl +# wget # Usage: CT_DoGetFile CT_DoGetFile() { - if [ -n "${_curl}" ]; then + if [ -n "${_aria2c}" ]; then + CT_DoGetFileAria2 "$1" + elif [ -n "${_curl}" ]; then CT_DoGetFileCurl "$1" elif [ -n "${_wget}" ]; then CT_DoGetFileWget "$1"