Skip to content

Commit 77fe23a

Browse files
hgeraldinomarc0der
authored andcommitted
"sdkman_checksum_enable" feature flag
1 parent f4b21c1 commit 77fe23a

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/main/bash/sdkman-install.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,13 @@ function __sdkman_checksum_zip() {
204204
__sdkman_echo_yellow "Metadata file not found at '${headers_file}', skipping checksum..."
205205
return
206206
fi
207-
207+
208+
if [[ "$sdkman_checksum_enable" != "true" ]]; then
209+
echo ""
210+
__sdkman_echo_yellow "Checksums are disabled, skipping verification..."
211+
return
212+
fi
213+
208214
#Check for the appropriate checksum tools
209215
if command -v shasum > /dev/null 2>&1; then
210216
shasum_avail=true

src/test/resources/features/checksum_verification.feature

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Feature: Verify checksums
33
Background:
44
Given the internet is reachable
55
And an initialised environment
6+
And I have configured "sdkman_checksum_enable" to "true"
67

78
Scenario: Install a specific Version with a valid SHA-256 checksum
89
Given the system is bootstrapped
@@ -85,7 +86,18 @@ Feature: Verify checksums
8586
And the candidate "grails" version "1.3.9" is installed
8687
And the response headers file is created for candidate "grails" and version "1.3.9"
8788
And the exit code is 0
88-
89+
90+
Scenario: Do not fail if checksums are disabled
91+
Given the system is bootstrapped
92+
And I have configured "sdkman_checksum_enable" to "false"
93+
And the candidate "grails" version "1.3.9" is available for download with checksum "abc-checksum-00000" using algorithm "SHA-256"
94+
When I enter "sdk install grails 1.3.9"
95+
Then I see "Checksums are disabled, skipping verification"
96+
And I see "Done installing!"
97+
And the candidate "grails" version "1.3.9" is installed
98+
And the response headers file is created for candidate "grails" and version "1.3.9"
99+
And the exit code is 0
100+
89101
Scenario: Abort installation after download of a binary with invalid SHA checksum
90102
Given the system is bootstrapped
91103
And the candidate "grails" version "1.3.9" is available for download with checksum "c68e386a6deec9fc4c1e18df21f927000000000e" using algorithm "SHA-256"

0 commit comments

Comments
 (0)