diff options
author | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2009-12-30 15:36:22 +0100 |
---|---|---|
committer | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2009-12-30 15:36:22 +0100 |
commit | 04c68600ea03e032d0cebac79336b71dc9f976f5 (patch) | |
tree | af0aeff6724a541784d433bb7cd2b9cde04f1400 /scripts/functions | |
parent | 2c077d6fac6a21227ddfd4b2403f24a8ad01dda1 (diff) | |
download | crosstool-ng-04c68600ea03e032d0cebac79336b71dc9f976f5.tar.gz crosstool-ng-04c68600ea03e032d0cebac79336b71dc9f976f5.tar.bz2 crosstool-ng-04c68600ea03e032d0cebac79336b71dc9f976f5.zip |
scripts/functions: add aria2, a powerfull downloader
aria2 is a powerfull downloader that is capable of chunking and
parallel retrieval.
Due to li;itations in crosstool-NG retrieval facilities, it's not possible
to take fully advantage of aria2. It might happen that, in the future,
those limitations get lifted away, so we can take use features such as
parallel downloading from more than one server at the same time. For now,
it should still speed up downloads thanks to parallel downloading of chunks.
Diffstat (limited to 'scripts/functions')
-rw-r--r-- | scripts/functions | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/scripts/functions b/scripts/functions index 8d318724..fbf86f3b 100644 --- a/scripts/functions +++ b/scripts/functions @@ -348,12 +348,31 @@ CT_DoGetFileCurl() { || true } +# Download using aria2 +# Usage: CT_DoGetFileAria2 <URL> +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 <URL> 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" |