1.1 --- a/scripts/functions Tue Dec 29 22:11:09 2009 +0100
1.2 +++ b/scripts/functions Wed Dec 30 15:36:22 2009 +0100
1.3 @@ -348,12 +348,31 @@
1.4 || true
1.5 }
1.6
1.7 +# Download using aria2
1.8 +# Usage: CT_DoGetFileAria2 <URL>
1.9 +CT_DoGetFileAria2() {
1.10 + # Note: comments about curl method (above) are also valid here
1.11 + # Plus: default progress indicator is a single line, so use verbose log
1.12 + # so that the CT-NG's ouput is 'live'.
1.13 + CT_DoExecLog ALL aria2c -l - -s ${CT_DOWNLOAD_MAX_CHUNKS} -m 3 --retry-wait 5 -t ${CT_CONNECT_TIMEOUT} -p "$1" \
1.14 + || CT_DoExecLog ALL aria2c -l - -s ${CT_DOWNLOAD_MAX_CHUNKS} -m 3 --retry-wait 5 -t ${CT_CONNECT_TIMEOUT} "$1" \
1.15 + || true
1.16 +}
1.17 +
1.18 +# OK, just look if we have them...
1.19 +_aria2c=$(CT_Which aria2c)
1.20 _wget=$(CT_Which wget)
1.21 _curl=$(CT_Which curl)
1.22 -# Wrapper function to call one of curl or wget
1.23 +
1.24 +# Wrapper function to call one of, in order of preference:
1.25 +# aria2
1.26 +# curl
1.27 +# wget
1.28 # Usage: CT_DoGetFile <URL>
1.29 CT_DoGetFile() {
1.30 - if [ -n "${_curl}" ]; then
1.31 + if [ -n "${_aria2c}" ]; then
1.32 + CT_DoGetFileAria2 "$1"
1.33 + elif [ -n "${_curl}" ]; then
1.34 CT_DoGetFileCurl "$1"
1.35 elif [ -n "${_wget}" ]; then
1.36 CT_DoGetFileWget "$1"