diff options
author | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2015-06-09 11:50:05 -0700 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2015-06-09 23:31:03 +0200 |
commit | dbc0087f9e25008b2c39fb484ec9c3e3bbf07de8 (patch) | |
tree | 009e77980347f75b57ad0e05a9c141cf70f0b01d /util | |
parent | d764912e0edbbefb0331a2c7e038317a9c9e2c26 (diff) | |
download | coreboot-dbc0087f9e25008b2c39fb484ec9c3e3bbf07de8.tar.xz |
buildgcc: move from if test to if [ .. ]
Change-Id: I29fe23e377045f08b8212742d84c2ee2b4a61b15
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: http://review.coreboot.org/10485
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Tested-by: build bot (Jenkins)
Reviewed-by: Alexander Couzens <lynxis@fe80.eu>
Diffstat (limited to 'util')
-rwxr-xr-x | util/crossgcc/buildgcc | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc index a4638490ae..a30ef24e4b 100755 --- a/util/crossgcc/buildgcc +++ b/util/crossgcc/buildgcc @@ -121,9 +121,9 @@ searchtool() search="$2" fi for i in "$1" "g$1" "gnu$1"; do - if test -x "$(which $i 2>/dev/null)"; then - if test $(cat /dev/null | $i --version 2>&1 |grep -c "$search") \ - -gt 0; then + if [ -x "$(which $i 2>/dev/null)" ]; then + if [ "$(cat /dev/null | $i --version 2>&1 | grep -c "$search")" \ + -gt 0 ]; then echo $i return fi @@ -133,7 +133,7 @@ searchtool() # patch and tar also work. if [ $UNAME = "Darwin" -o $UNAME = "FreeBSD" -o $UNAME = "NetBSD" -o $UNAME = "OpenBSD" ]; then if [ "$1" = "patch" -o "$1" = "tar" ]; then - if test -x "$(which $1 2>/dev/null)"; then + if [ -x "$(which $1 2>/dev/null)" ]; then echo $1 return fi @@ -141,19 +141,19 @@ searchtool() fi if [ "$(echo $1 | cut -b -3)" = "sha" ]; then if [ $UNAME = "FreeBSD" ]; then - if test -x "$(which sha1 2>/dev/null)"; then + if [ -x "$(which sha1 2>/dev/null)" ]; then echo sha1 return fi fi if [ $UNAME = "NetBSD" ]; then - if test -x "$(which cksum 2>/dev/null)"; then + if [ -x "$(which cksum 2>/dev/null)" ]; then echo cksum -a $(echo $1 | sed -e 's,sum,,') return fi fi if [ $UNAME = "Darwin" ]; then - if test -x "$(which openssl 2>/dev/null)"; then + if [ -x "$(which openssl 2>/dev/null)" ]; then echo openssl $(echo $1 | sed -e 's,sum,,') return fi @@ -188,8 +188,11 @@ download() { printf " * $FILE " test -f tarballs/$FILE && \ - (test -z "$CHECKSUM" || \ - test "$(cat sum/$FILE.cksum 2>/dev/null | sed -e 's,.*\([0-9a-f]\{40\}\).*,\1,')" = "$($CHECKSUM tarballs/$FILE 2>/dev/null | sed -e 's,.*\([0-9a-f]\{40\}\).*,\1,')" ) && \ + ( test -z "$CHECKSUM" || \ + test "$(cat sum/$FILE.cksum 2>/dev/null | \ + sed -e 's,.*\([0-9a-f]\{40\}\).*,\1,')" = \ + "$($CHECKSUM tarballs/$FILE 2>/dev/null | \ + sed -e 's,.*\([0-9a-f]\{40\}\).*,\1,')" ) && \ printf "(cached)" || ( printf "(downloading)" rm -f tarballs/$FILE @@ -200,9 +203,10 @@ download() { (test -z "$CHECKSUM" || $CHECKSUM tarballs/$FILE > sum/$FILE.cksum ) && \ printf "(checksum created. ${RED}Note. Please upload sum/$FILE.cksum if the corresponding archive is upgraded.${NC})" ) - test -f tarballs/$FILE || \ + if [ ! -f tarballs/$FILE ]; then printf "\n${RED}Failed to download $FILE.${NC}\n" - test -f tarballs/$FILE || exit 1 + exit 1 + fi printf "\n" } |