Skip to content

Commit 76f1188

Browse files
committed
more sha programs
1 parent 49396f8 commit 76f1188

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

lib/utils.bash

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,25 @@ download_release() {
120120
)
121121
}
122122

123+
check_shasum() {
124+
local sha_cmd
125+
126+
if command -v sha512sum >/dev/null; then
127+
sha_cmd=(sha512sum)
128+
elif command -v shasum >/dev/null; then
129+
sha_cmd=(shasum -a 512)
130+
else
131+
log "WARNING: sha512sum/shasum program not found - unable to checksum. Proceed with caution."
132+
return 0
133+
fi
134+
135+
(
136+
log "Checking sha512 sum..."
137+
cd "${ASDF_DOWNLOAD_PATH}" || exit 1
138+
"${sha_cmd[@]}" -c ./*.sha512sum
139+
)
140+
}
141+
123142
install_version() {
124143
local toolname="$1"
125144
local install_type="$2"
@@ -132,15 +151,7 @@ install_version() {
132151
fail "asdf-$PLUGIN_NAME supports release installs only"
133152
fi
134153

135-
if command -v sha512sum >/dev/null; then
136-
(
137-
log "Checking sha512 sum..."
138-
cd "${ASDF_DOWNLOAD_PATH}" || exit 1
139-
sha512sum -c ./*.sha512sum
140-
)
141-
else
142-
log "WARNING: sha512sum program not found - unable to checksum. Proceed with caution."
143-
fi
154+
check_shasum
144155

145156
(
146157
local asset_path full_tool_cmd tool_cmd

0 commit comments

Comments
 (0)