[bootstrap.sh] Minor refactoring for clarity

This commit is contained in:
Alexander Karatarakis 2018-04-25 22:23:45 -07:00
parent aa423c999b
commit ef59460782
1 changed files with 6 additions and 6 deletions

View File

@ -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