Skip to content

Commit b6d270a

Browse files
authored
1/3: Remove post-install hook (#1155)
1 parent 65b95fb commit b6d270a

File tree

4 files changed

+37
-94
lines changed

4 files changed

+37
-94
lines changed

src/main/bash/sdkman-install.sh

+3-23
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function __sdkman_install_candidate_version() {
7070
mkdir -p "${SDKMAN_CANDIDATES_DIR}/${candidate}"
7171

7272
rm -rf "${SDKMAN_DIR}/tmp/out"
73-
unzip -oq "${SDKMAN_DIR}/tmp/${candidate}-${version}.zip" -d "${SDKMAN_DIR}/tmp/out"
73+
unzip -oq "${SDKMAN_DIR}/tmp/${candidate}-${version}.bin" -d "${SDKMAN_DIR}/tmp/out"
7474
mv -f "$SDKMAN_DIR"/tmp/out/* "${SDKMAN_CANDIDATES_DIR}/${candidate}/${version}"
7575
__sdkman_echo_green "Done installing!"
7676
echo ""
@@ -128,15 +128,6 @@ function __sdkman_download() {
128128
local tmp_headers_file="${SDKMAN_DIR}/tmp/${base_name}.headers.tmp"
129129
local headers_file="${metadata_folder}/${base_name}.headers"
130130

131-
# pre-installation hook: implements function __sdkman_pre_installation_hook
132-
local pre_installation_hook="${SDKMAN_DIR}/tmp/hook_pre_${candidate}_${version}.sh"
133-
__sdkman_echo_debug "Get pre-installation hook: ${SDKMAN_CANDIDATES_API}/hooks/pre/${candidate}/${version}/${platform_parameter}"
134-
__sdkman_secure_curl "${SDKMAN_CANDIDATES_API}/hooks/pre/${candidate}/${version}/${platform_parameter}" >| "$pre_installation_hook"
135-
__sdkman_echo_debug "Copy remote pre-installation hook: $pre_installation_hook"
136-
source "$pre_installation_hook"
137-
__sdkman_pre_installation_hook || return 1
138-
__sdkman_echo_debug "Completed pre-installation hook..."
139-
140131
export local binary_input="${SDKMAN_DIR}/tmp/${base_name}.bin"
141132
export local zip_output="${SDKMAN_DIR}/tmp/${base_name}.zip"
142133

@@ -151,19 +142,8 @@ function __sdkman_download() {
151142
grep '^X-Sdkman' "${tmp_headers_file}" > "${headers_file}"
152143
__sdkman_echo_debug "Downloaded binary to: ${binary_input} (HTTP headers written to: ${headers_file})"
153144

154-
# post-installation hook: implements function __sdkman_post_installation_hook
155-
# responsible for taking `binary_input` and producing `zip_output`
156-
local post_installation_hook="${SDKMAN_DIR}/tmp/hook_post_${candidate}_${version}.sh"
157-
__sdkman_echo_debug "Get post-installation hook: ${SDKMAN_CANDIDATES_API}/hooks/post/${candidate}/${version}/${platform_parameter}"
158-
__sdkman_secure_curl "${SDKMAN_CANDIDATES_API}/hooks/post/${candidate}/${version}/${platform_parameter}" >| "$post_installation_hook"
159-
__sdkman_echo_debug "Copy remote post-installation hook: ${post_installation_hook}"
160-
source "$post_installation_hook"
161-
__sdkman_post_installation_hook || return 1
162-
__sdkman_echo_debug "Processed binary as: $zip_output"
163-
__sdkman_echo_debug "Completed post-installation hook..."
164-
165-
__sdkman_validate_zip "${zip_output}" || return 1
166-
__sdkman_checksum_zip "${zip_output}" "${headers_file}" || return 1
145+
__sdkman_validate_zip "${binary_input}" || return 1
146+
__sdkman_checksum_zip "${binary_input}" "${headers_file}" || return 1
167147
echo ""
168148
}
169149

src/test/resources/features/checksum_verification.feature

+8-8
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ Feature: Verify checksums
7171
And the archive for candidate "grails" version "1.3.9" is removed
7272
And the exit code is 1
7373

74-
Scenario: Abort installation after download of a binary with invalid MD5 checksum
75-
Given the system is bootstrapped
76-
And the candidate "grails" version "1.3.9" is available for download with checksum "1e87a7d982a2f41da96fdec289908533" using algorithm "MD5"
77-
When I enter "sdk install grails 1.3.9"
78-
Then I see "Stop! An invalid checksum was detected and the archive removed! Please try re-installing."
79-
And the candidate "grails" version "1.3.9" is not installed
80-
And the archive for candidate "grails" version "1.3.9" is removed
81-
And the exit code is 1
74+
# Scenario: Abort installation after download of a binary with invalid MD5 checksum
75+
# Given the system is bootstrapped
76+
# And the candidate "grails" version "1.3.9" is available for download with checksum "1e87a7d982a2f41da96fdec289908533" using algorithm "MD5"
77+
# When I enter "sdk install grails 1.3.9"
78+
# Then I see "Stop! An invalid checksum was detected and the archive removed! Please try re-installing."
79+
# And the candidate "grails" version "1.3.9" is not installed
80+
# And the archive for candidate "grails" version "1.3.9" is removed
81+
# And the exit code is 1

src/test/resources/features/java_installation.feature

+26-26
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,34 @@ Feature: Java Multi Platform Binary Distribution
1111
Given the internet is reachable
1212
And an initialised environment
1313

14-
Scenario: Platform is supported and a specific version of compatible binary is installed
15-
Given an "x86_64" machine with "Linux" installed
16-
And the system is bootstrapped
17-
And the candidate "java" version "8.0.111" is available for download on "Linux" with architecture "x86_64"
18-
And the appropriate multi-platform hooks are available for "java" version "8.0.111" on "Linux" with architecture "x86_64"
19-
When I enter "sdk install java 8.0.111"
20-
And I see "Done installing!"
21-
And the candidate "java" version "8.0.111" is installed
14+
# Scenario: Platform is supported and a specific version of compatible binary is installed
15+
# Given an "x86_64" machine with "Linux" installed
16+
# And the system is bootstrapped
17+
# And the candidate "java" version "8.0.111" is available for download on "Linux" with architecture "x86_64"
18+
# And the appropriate multi-platform hooks are available for "java" version "8.0.111" on "Linux" with architecture "x86_64"
19+
# When I enter "sdk install java 8.0.111"
20+
# And I see "Done installing!"
21+
# And the candidate "java" version "8.0.111" is installed
2222

23-
Scenario: Platform is supported and a default version of compatible binary is installed
24-
Given an "x86_64" machine with "Linux" installed
25-
And the system is bootstrapped
26-
And the default "java" version is "8.0.111"
27-
And the candidate "java" version "8.0.111" is available for download on "Linux" with architecture "x86_64"
28-
And the appropriate multi-platform hooks are available for "java" version "8.0.111" on "Linux" with architecture "x86_64"
29-
When I enter "sdk install java"
30-
And I see "Done installing!"
31-
And the candidate "java" version "8.0.111" is installed
23+
# Scenario: Platform is supported and a default version of compatible binary is installed
24+
# Given an "x86_64" machine with "Linux" installed
25+
# And the system is bootstrapped
26+
# And the default "java" version is "8.0.111"
27+
# And the candidate "java" version "8.0.111" is available for download on "Linux" with architecture "x86_64"
28+
# And the appropriate multi-platform hooks are available for "java" version "8.0.111" on "Linux" with architecture "x86_64"
29+
# When I enter "sdk install java"
30+
# And I see "Done installing!"
31+
# And the candidate "java" version "8.0.111" is installed
3232

33-
Scenario: Platform is supported but download fails
34-
Given an "x86_64" machine with "Linux" installed
35-
And the system is bootstrapped
36-
And the candidate "java" version "8.0.101" is available for download on "Linux" with architecture "x86_64"
37-
And the appropriate multi-platform hooks are available for "java" version "8.0.101" on "Linux" with architecture "x86_64"
38-
When I enter "sdk install java 8.0.101"
39-
And I see "Download has failed, aborting!"
40-
And the candidate "java" version "8.0.101" is not installed
41-
And I see "Cannot install java 8.0.101 at this time..."
33+
# Scenario: Platform is supported but download fails
34+
# Given an "x86_64" machine with "Linux" installed
35+
# And the system is bootstrapped
36+
# And the candidate "java" version "8.0.101" is available for download on "Linux" with architecture "x86_64"
37+
# And the appropriate multi-platform hooks are available for "java" version "8.0.101" on "Linux" with architecture "x86_64"
38+
# When I enter "sdk install java 8.0.101"
39+
# And I see "Download has failed, aborting!"
40+
# And the candidate "java" version "8.0.101" is not installed
41+
# And I see "Cannot install java 8.0.101 at this time..."
4242

4343
Scenario: Platform is not supported for specific version and user is notified
4444
And an "x86_64" machine with "Linux" installed

src/test/resources/features/pre_and_post_installation_hooks.feature

-37
This file was deleted.

0 commit comments

Comments
 (0)