Skip to content

Commit e7031f3

Browse files
Copilotabdurriq
andcommitted
Fix SDKMAN native binary removal for RHEL 8 systems
Co-authored-by: abdurriq <[email protected]>
1 parent 7b5fe46 commit e7031f3

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/java/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "java",
3-
"version": "1.7.1",
3+
"version": "1.7.2",
44
"name": "Java (via SDKMAN!)",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/java",
66
"description": "Installs Java, SDKMAN! (if not installed), and needed dependencies.",

src/java/install.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,17 @@ if [ ! -d "${SDKMAN_DIR}" ]; then
303303
export SDKMAN_NATIVE_VERSION="false"
304304
fi
305305
curl -sSL "https://get.sdkman.io?rcupdate=false" | bash
306+
# For RHEL 8 systems, also disable native version in config file and remove native binaries
307+
if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${MAJOR_VERSION_ID}" = "8" ]; then
308+
# Disable native version in config to prevent future usage
309+
if [ -f "${SDKMAN_DIR}/etc/config" ]; then
310+
sed -i 's/sdkman_native_version=.*/sdkman_native_version=false/' "${SDKMAN_DIR}/etc/config"
311+
fi
312+
# Remove native binaries if they were installed
313+
if [ -d "${SDKMAN_DIR}/libexec" ]; then
314+
rm -rf "${SDKMAN_DIR}/libexec"
315+
fi
316+
fi
306317
chown -R "${USERNAME}:sdkman" ${SDKMAN_DIR}
307318
find ${SDKMAN_DIR} -type d -print0 | xargs -d '\n' -0 chmod g+s
308319
# Add sourcing of sdkman into bashrc/zshrc files (unless disabled)

0 commit comments

Comments
 (0)