extract_utils: Use shasum on macOS
macOS doesn't have sha1sum but instead shasum, so use that
if 'uname -s' returns Darwin
Change-Id: I1ab8721327a561e8df78562bbc0b12e884cc4a93
diff --git a/build/tools/extract_utils.sh b/build/tools/extract_utils.sh
index 6e8baa3..1253700 100644
--- a/build/tools/extract_utils.sh
+++ b/build/tools/extract_utils.sh
@@ -858,13 +858,21 @@
if [ ! -f "$DEST" ]; then
KEEP="1"
else
- local DEST_HASH=$(sha1sum "$DEST" | awk '{print $1}' )
+ if [ "$(uname)" == "Darwin" ]; then
+ local DEST_HASH=$(shasum "$DEST" | awk '{print $1}' )
+ else
+ local DEST_HASH=$(sha1sum "$DEST" | awk '{print $1}' )
+ fi
if [ "$DEST_HASH" != "$HASH" ]; then
KEEP="1"
fi
fi
if [ "$KEEP" = "1" ]; then
- local TMP_HASH=$(sha1sum "$TMP" | awk '{print $1}' )
+ if [ "$(uname)" == "Darwin" ]; then
+ local TMP_HASH=$(shasum "$TMP" | awk '{print $1}' )
+ else
+ local TMP_HASH=$(sha1sum "$TMP" | awk '{print $1}' )
+ fi
if [ "$TMP_HASH" = "$HASH" ]; then
printf ' + (keeping pinned file with hash %s)\n' "$HASH"
cp -p "$TMP" "$DEST"