Skip to content

Commit

Permalink
fix(checksum): when platform doesn't contains shaXXXsum commands pass…
Browse files Browse the repository at this point in the history
… --algorithm to shasum command as well
  • Loading branch information
kamontat committed Sep 17, 2023
1 parent 7c62e22 commit 93729a8
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@ kc_asdf_checksum() {
fi

local cs_algorithm="{{ checksum_conf_algorithm }}"
local shasum="sha${cs_algorithm}sum"
command -v "$shasum" >/dev/null ||
local shasum="sha${cs_algorithm}sum" args=()
if ! command -v "$shasum" >/dev/null; then
shasum="shasum"
args+=(--algorithm "$cs_algorithm")
fi
args+=(--check "$cs_txt")

local tmp="$PWD"
cd "$dirpath" &&
kc_asdf_exec "$shasum" --check "$cs_txt" >/dev/null &&
kc_asdf_exec "$shasum" "${args[@]}" >/dev/null &&
cd "$tmp" || return 1
}

0 comments on commit 93729a8

Please sign in to comment.