Skip to content

Commit f262386

Browse files
committed
Validate sha256sum for v2.0.0 and above versions only
Signed-off-by: ghosind <ghosind@gmail.com>
1 parent cc816e3 commit f262386

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

dvm.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,9 @@ export DVM_VERSION="v0.9.1"
14191419
sha256sum_url="$2.sha256sum"
14201420
sha256sum_file="$download_file.sha256sum"
14211421

1422-
if [ "$DVM_INSTALL_SHA256SUM" = true ] && dvm_has sha256sum
1422+
if [ "$DVM_INSTALL_SHA256SUM" = true ] &&
1423+
dvm_has shasum &&
1424+
! dvm_compare_version "$version" "v2.0.0"
14231425
then
14241426
dvm_debug "downloading sha256sum file: $sha256sum_url"
14251427

@@ -1431,7 +1433,7 @@ export DVM_VERSION="v0.9.1"
14311433
fi
14321434

14331435
dvm_print "Computing checksum with sha256sum..."
1434-
checksum=$(sha256sum "$download_file" | cut -d " " -f 1)
1436+
checksum=$(shasum -a 256 "$download_file" | cut -d " " -f 1)
14351437
checksum_expected=$(cut -d " " -f 1 < "$sha256sum_file" )
14361438
dvm_debug "checksum: $checksum, expected checksum: $checksum_expected"
14371439

test/test_install_version.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ dvm_test_error() {
88
# shellcheck disable=SC1091
99
\. ./dvm.sh || dvm_test_error "failed to install dvm"
1010

11-
# Install deno v1.0.0
12-
TARGET_VERSION="1.45.0"
11+
# Install deno v2.0.0
12+
TARGET_VERSION="2.0.0"
1313
dvm install "v$TARGET_VERSION" --skip-validation --sha256sum || dvm_test_error "run 'dvm install v$TARGET_VERSION' failed"
1414

1515
# Check installed version directory

0 commit comments

Comments
 (0)