Commit 018357fe by Jason Karns

Convert checksum algorithm chooser to switch case

parent 6bdc16c0
...@@ -259,11 +259,12 @@ verify_checksum() { ...@@ -259,11 +259,12 @@ verify_checksum() {
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 [ -n "$expected_checksum" ] || return 0
# If the checksum length is 32 chars, assume MD5, otherwise SHA2 case "${#expected_checksum}" in
if [ "${#expected_checksum}" -eq 32 ]; then 32) # MD5
[ -n "$HAS_MD5_SUPPORT" ] || return 0 [ -n "$HAS_MD5_SUPPORT" ] || return 0
checksum_command="compute_md5" checksum_command="compute_md5"
fi ;;
esac
# If the computed checksum is empty, return failure # If the computed checksum is empty, return failure
local computed_checksum=`echo "$($checksum_command < "$filename")" | tr [A-Z] [a-z]` local computed_checksum=`echo "$($checksum_command < "$filename")" | tr [A-Z] [a-z]`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment