From ef594607829ad6ed2bd462a0ddcbb0ee698b3f4f Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 25 Apr 2018 22:23:45 -0700 Subject: [bootstrap.sh] Minor refactoring for clarity --- scripts/bootstrap.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 2225f029d..95ee75af1 100644 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -29,15 +29,15 @@ vcpkgCheckRepoTool() vcpkgCheckEqualFileHash() { url=$1; filePath=$2; expectedHash=$3 - - SHASUM="shasum -a 512" # sha512sum is not available on osx - # checking for sha512sum on os which doesn't have shasum - if which sha512sum >/dev/null 2>&1; then - SHASUM=sha512sum + if command -v "sha512sum" >/dev/null 2>&1 ; then + actualHash=$(sha512sum "$filePath") + else + # sha512sum is not available by default on osx + # shasum is not available by default on Fedora + actualHash=$(shasum -a 512 "$filePath") fi - actualHash=$("$SHASUM" "$filePath") actualHash="${actualHash%% *}" # shasum returns [hash filename], so get the first word if ! [ "$expectedHash" = "$actualHash" ]; then -- cgit v1.2.3