diff options
author | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2007-07-07 09:58:14 (GMT) |
---|---|---|
committer | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2007-07-07 09:58:14 (GMT) |
commit | 674ee531e604751354c8998a3aced5f0d26b2713 (patch) | |
tree | 67de9d600afa94db4516fe31306470f21ead7983 /scripts/functions | |
parent | 8331b26c77eeef984d787a1c1db3aa384ebd2964 (diff) |
Silence "which" being verbose in some distros. (eg. Mandriva's which spawns "foobar was not found in /bin:/usr/bin:...." directly on stderr)
Diffstat (limited to 'scripts/functions')
-rw-r--r-- | scripts/functions | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/scripts/functions b/scripts/functions index 18ee969..aedb436 100644 --- a/scripts/functions +++ b/scripts/functions @@ -158,10 +158,18 @@ CT_TestOrAbort() { # Test the presence of a tool, or abort if not found # Usage: CT_HasOrAbort <tool> CT_HasOrAbort() { - CT_TestAndAbort "\"${1}\" not found and needed for successfull toolchain build." -z "`which \"${1}\"`" + CT_TestAndAbort "\"${1}\" not found and needed for successfull toolchain build." -z "`CT_Which \"${1}\"`" return 0 } +# Search a program: wrap "which" for those system where +# "which" verbosely says there is no match (Mdk are such +# suckers...) +# Usage: CT_Which <filename> +CT_Which() { + which "$1" 2>/dev/null || true +} + # Get current date with nanosecond precision # On those system not supporting nanosecond precision, faked with rounding down # to the highest entire second @@ -292,8 +300,8 @@ CT_DoGetFileCurl() { # Wrapper function to call one of curl or wget # Usage: CT_DoGetFile <URL> CT_DoGetFile() { - local _wget=`which wget` - local _curl=`which curl` + local _wget=`CT_Which wget` + local _curl=`CT_Which curl` case "${_wget},${_curl}" in ,) CT_DoError "Could find neither wget nor curl";; ,*) CT_DoGetFileCurl "$1" 2>&1 |CT_DoLog ALL;; |