Move empty-checksum handling into case stmt

This commit is contained in:
Jason Karns 2016-01-15 16:47:34 -05:00
parent 26af69a9d3
commit a187b07dab

View file

@ -248,16 +248,16 @@ compute_md5() {
verify_checksum() {
local checksum_command
local filename="$1"
local expected_checksum="$(echo "$2" | tr [A-Z] [a-z])"
# If the specified filename doesn't exist, return success
local filename="$1"
[ -e "$filename" ] || return 0
# If there's no expected checksum, return success
local expected_checksum="$(echo "$2" | tr [A-Z] [a-z])"
[ -n "$expected_checksum" ] || return 0
case "${#expected_checksum}" in
0) # If there's no expected checksum, return success
return 0
;;
32) # MD5
[ -n "$HAS_MD5_SUPPORT" ] || return 0
checksum_command="compute_md5"