Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion lib/foojay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ local foojay = {}
local URL =
"https://api.foojay.io/disco/v3.0/packages/jdks?version=%s&distribution=%s&architecture=%s&archive_type=%s&operating_system=%s&lib_c_type=%s&release_status=ga&directly_downloadable=true"

--- Detects the libc type on Linux systems (glibc or musl)
--- @return string "glibc" or "musl"
local function detect_lib_c_type()
local handle = io.popen("ldd --version 2>&1")
if handle then
local result = handle:read("*a")
handle:close()
if result and result:lower():find("musl") then
return "musl"
end
end
return "glibc"
end

foojay.fetchtJdkList= function (distribution, version)

local os = RUNTIME.osType
Expand All @@ -24,7 +38,7 @@ foojay.fetchtJdkList= function (distribution, version)

local lib_c_type = ""
if os == "linux" then
lib_c_type = "glibc"
lib_c_type = detect_lib_c_type()
end

-- Convert arm64 to aarch64 for foojay API compatibility
Expand Down