buildgcc: Search the cksum command without checking OS type

The checksum command might appear to be unpredictable only by
checking the OS. Just list the candidates, sorted by possibility.

Change-Id: Ia3f4f5f0f98ff47d322a4f70689cca0bd4fa79fa
Signed-off-by: Zheng Bao <zheng.bao@amd.com>
Signed-off-by: Zheng Bao <fishbaozi@gmail.com>
Reviewed-on: https://review.coreboot.org/11483
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
zbao 2015-09-01 22:28:57 -04:00 committed by Martin Roth
parent 26d484a237
commit 5cf758d45b
1 changed files with 22 additions and 19 deletions

View File

@ -165,24 +165,26 @@ searchtool()
fi fi
fi fi
fi fi
if [ "$(echo $1 | cut -b -3)" = "sha" ]; then if echo $1 | grep -q "sum" ; then
if [ $UNAME = "FreeBSD" ]; then algor=$(echo $1 | sed -e 's,sum,,')
if [ -x "$(which sha1 2>/dev/null)" ]; then if [ -x "$(which $1 2>/dev/null)" ]; then
echo sha1 #xxxsum [file]
echo $1
return return
fi elif [ -x "$(which $algor 2>/dev/null)" ]; then
fi #xxx [file]
if [ $UNAME = "NetBSD" ]; then echo $algor
if [ -x "$(which cksum 2>/dev/null)" ]; then
echo cksum -a $(echo $1 | sed -e 's,sum,,')
return return
fi elif [ -x "$(which openssl 2>/dev/null)" ]; then
fi #openssl xxx [file]
if [ $UNAME = "Darwin" ]; then echo openssl $algor
if [ -x "$(which openssl 2>/dev/null)" ]; then return
echo openssl $(echo $1 | sed -e 's,sum,,') elif [ -x "$(which cksum 2>/dev/null)" ]; then
#cksum -a xxx [file]
#cksum has special options in NetBSD. Actually, NetBSD will use the second case above.
echo "buildgcc" | cksum -a $algor > /dev/null 2>/dev/null && \
echo cksum -a $algor
return return
fi
fi fi
fi fi
@ -790,7 +792,8 @@ TAR=$(searchtool tar) || exit $?
PATCH=$(searchtool patch) || exit $? PATCH=$(searchtool patch) || exit $?
MAKE=$(searchtool make) || exit $? MAKE=$(searchtool make) || exit $?
SHA1SUM=$(searchtool sha1sum) SHA1SUM=$(searchtool sha1sum)
SHA512SUM=$(searchtool sha512sum) #SHA512SUM=$(searchtool sha512sum)
#MD5SUM=$(searchtool md5sum)
CHECKSUM=$SHA1SUM CHECKSUM=$SHA1SUM
LBZIP2=$(searchtool lbzip2 "" nofail) LBZIP2=$(searchtool lbzip2 "" nofail)
PIGZ=$(searchtool pigz "" nofail) PIGZ=$(searchtool pigz "" nofail)