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
This commit is contained in:
parent
73a3965995
commit
5b38c4fb34
1 changed files with 10 additions and 2 deletions
|
@ -858,13 +858,21 @@ function extract() {
|
|||
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"
|
||||
|
|
Loading…
Reference in a new issue