[coreboot-gerrit] Patch set updated for coreboot: buildgcc: Search the cksum command without checking OS type
Zheng Bao (fishbaozi@gmail.com)
gerrit at coreboot.org
Sat Aug 6 17:00:42 CEST 2016
Zheng Bao (fishbaozi at gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/11483
-gerrit
commit 9e85ae5d81d629bff219b00afc890f7dd91b6cdc
Author: zbao <fishbaozi at gmail.com>
Date: Thu Nov 5 20:08:50 2015 +0800
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 at amd.com>
Signed-off-by: Zheng Bao <fishbaozi at gmail.com>
---
util/crossgcc/buildgcc | 42 ++++++++++++++++++++++++------------------
1 file changed, 24 insertions(+), 18 deletions(-)
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index 3f5f562..c3f9aa4 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -165,24 +165,30 @@ searchtool()
fi
fi
fi
- if [ "$(echo $1 | cut -b -3)" = "sha" ]; then
- if [ $UNAME = "FreeBSD" ]; then
- if [ -x "$(which sha1 2>/dev/null)" ]; then
- echo sha1
- return
- fi
- fi
- if [ $UNAME = "NetBSD" ]; 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 [ -x "$(which openssl 2>/dev/null)" ]; then
- echo openssl $(echo $1 | sed -e 's,sum,,')
- return
- fi
+ if echo $1 | grep -q "sum" ; then
+ algor=$(echo $1 | sed -e 's,sum,,') #algor=sha1
+ if [ -x "$(which $1 2>/dev/null)" ]; then
+ #sha1sum [file]
+ echo $1
+ return
+ elif [ -x "$(which shasum 2>/dev/null)" ]; then
+ #shasum -a 1 [file]
+ echo shasum -a $(echo $algor | cut -c 4-)
+ return
+ elif [ -x "$(which $algor 2>/dev/null)" ]; then
+ #sha1 [file]
+ echo $algor
+ return
+ elif [ -x "$(which openssl 2>/dev/null)" ]; then
+ #openssl sha1 [file]
+ echo openssl $algor
+ return
+ elif [ -x "$(which cksum 2>/dev/null)" ]; then
+ #cksum -a sha1 [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
fi
fi
More information about the coreboot-gerrit
mailing list