SHA2 support shouldn't be a pre-req for MD5 checksum verification

This commit is contained in:
Jason Karns 2016-01-15 16:41:20 -05:00
parent 018357fefb
commit abc69bd630

View file

@ -247,8 +247,6 @@ compute_md5() {
}
verify_checksum() {
# If there's no SHA2 support, return success
[ -n "$HAS_SHA2_SUPPORT" ] || return 0
local checksum_command="compute_sha2"
# If the specified filename doesn't exist, return success
@ -256,7 +254,7 @@ verify_checksum() {
[ -e "$filename" ] || return 0
# If there's no expected checksum, return success
local expected_checksum=`echo "$2" | tr [A-Z] [a-z]`
local expected_checksum="$(echo "$2" | tr [A-Z] [a-z])"
[ -n "$expected_checksum" ] || return 0
case "${#expected_checksum}" in
@ -264,6 +262,10 @@ verify_checksum() {
[ -n "$HAS_MD5_SUPPORT" ] || return 0
checksum_command="compute_md5"
;;
64) # SHA2 256
[ -n "$HAS_SHA2_SUPPORT" ] || return 0
checksum_command="compute_sha2"
;;
esac
# If the computed checksum is empty, return failure