diff --git a/tools/check-hash.sh b/tools/check-hash.sh index a61cf5c9f..7163fbb5e 100755 --- a/tools/check-hash.sh +++ b/tools/check-hash.sh @@ -71,7 +71,14 @@ esac # Calculate hash value of passed file -calc_hash=$( ${hash_algo}sum "${file_to_check}" | cut -d' ' -f1 ) +if [ `which ${hash_algo}sum 2> /dev/null` ]; then + hash_algo_cmd="${hash_algo}sum" +elif [ `which shasum 2> /dev/null` ]; then + hash_algo_len=$( echo ${hash_algo} | cut -c 4- ) + hash_algo_cmd="shasum -a ${hash_algo_len}" +fi + +calc_hash=$( ${hash_algo_cmd} "${file_to_check}" | cut -d' ' -f1 ) # Does it match expected hash?