tools/check-hash.sh: Add shasum to use checking hash
In macOS, sha*sum tools not found, but shasum can be use instead of them.
This commit is contained in:
parent
fb26ef28c6
commit
381b83ea90
@ -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?
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user