Correctly use CT_DoExecLog with wget and curl.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Mar 13 10:34:53 2009 +0000 (2009-03-13)
changeset 1257ded91847b3b5
parent 1256 acf1944ef6a4
child 1258 67daa585467b
Correctly use CT_DoExecLog with wget and curl.

/trunk/scripts/functions | 16 8 8 0 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
scripts/functions
     1.1 --- a/scripts/functions	Wed Mar 11 20:56:27 2009 +0000
     1.2 +++ b/scripts/functions	Fri Mar 13 10:34:53 2009 +0000
     1.3 @@ -112,7 +112,7 @@
     1.4  }
     1.5  
     1.6  # Execute an action, and log its messages
     1.7 -# Usage: CT_DoExecLog <level> <[VAR=val...] command [parameters...]>
     1.8 +# Usage: [VAR=val...] CT_DoExecLog <level> <command [parameters...]>
     1.9  CT_DoExecLog() {
    1.10      local level="$1"
    1.11      shift
    1.12 @@ -399,8 +399,8 @@
    1.13      # Some company networks have firewalls to connect to the internet, but it's
    1.14      # not easy to detect them, and wget does not timeout by default while
    1.15      # connecting, so force a global ${CT_CONNECT_TIMEOUT}-second timeout.
    1.16 -    wget -T ${CT_CONNECT_TIMEOUT} -nc --progress=dot:binary --tries=3 --passive-ftp "$1"    \
    1.17 -    || wget -T ${CT_CONNECT_TIMEOUT} -nc --progress=dot:binary --tries=3 "$1"               \
    1.18 +    CT_DoExecLog ALL wget -T ${CT_CONNECT_TIMEOUT} -nc --progress=dot:binary --tries=3 --passive-ftp "$1"    \
    1.19 +    || CT_DoExecLog ALL wget -T ${CT_CONNECT_TIMEOUT} -nc --progress=dot:binary --tries=3 "$1"               \
    1.20      || true
    1.21  }
    1.22  
    1.23 @@ -409,9 +409,9 @@
    1.24  CT_DoGetFileCurl() {
    1.25      # Note: comments about wget method (above) are also valid here
    1.26      # Plus: no good progress indicator is available with curl,
    1.27 -    #       so output is consigned to oblivion
    1.28 -    curl --ftp-pasv -O --retry 3 "$1" --connect-timeout ${CT_CONNECT_TIMEOUT} >/dev/null    \
    1.29 -    || curl -O --retry 3 "$1" --connect-timeout ${CT_CONNECT_TIMEOUT} >/dev/null            \
    1.30 +    #       so, be silent.
    1.31 +    CT_DoExecLog ALL curl -s --ftp-pasv -O --retry 3 "$1" --connect-timeout ${CT_CONNECT_TIMEOUT}    \
    1.32 +    || CT_DoExecLog ALL curl -s -O --retry 3 "$1" --connect-timeout ${CT_CONNECT_TIMEOUT}            \
    1.33      || true
    1.34  }
    1.35  
    1.36 @@ -422,8 +422,8 @@
    1.37  CT_DoGetFile() {
    1.38      case "${_wget},${_curl}" in
    1.39          ,)  CT_Abort "Could find neither wget nor curl";;
    1.40 -        ,*) CT_DoExecLog ALL CT_DoGetFileCurl "$1" 2>&1;;
    1.41 -        *)  CT_DoExecLog ALL CT_DoGetFileWget "$1" 2>&1;;
    1.42 +        ,*) CT_DoGetFileCurl "$1";;
    1.43 +        *)  CT_DoGetFileWget "$1";;
    1.44      esac
    1.45  }
    1.46