diff --git a/dist/setup/index.cjs b/dist/setup/index.cjs index 28ee886..ae07322 100644 --- a/dist/setup/index.cjs +++ b/dist/setup/index.cjs @@ -90506,6 +90506,7 @@ function getOSNameVersion() { } function getLinuxOSNameVersion() { const files = ["/etc/os-release", "/usr/lib/os-release"]; + let idWithoutVersion; for (const file of files) { try { const content = import_node_fs2.default.readFileSync(file, "utf8"); @@ -90522,9 +90523,15 @@ function getLinuxOSNameVersion() { if (id && buildId) { return `${id}-${buildId}`; } + if (id && idWithoutVersion === void 0) { + idWithoutVersion = id; + } } catch { } } + if (idWithoutVersion) { + return idWithoutVersion; + } throw new Error( "Failed to determine Linux distribution. Could not read /etc/os-release or /usr/lib/os-release" ); diff --git a/src/utils/platforms.ts b/src/utils/platforms.ts index 96c877d..dd8582b 100644 --- a/src/utils/platforms.ts +++ b/src/utils/platforms.ts @@ -102,6 +102,7 @@ export function getOSNameVersion(): string { function getLinuxOSNameVersion(): string { const files = ["/etc/os-release", "/usr/lib/os-release"]; + let idWithoutVersion: string | undefined; for (const file of files) { try { @@ -122,11 +123,22 @@ function getLinuxOSNameVersion(): string { if (id && buildId) { return `${id}-${buildId}`; } + // Remember the ID but keep looking: the next file might still + // provide a version field + if (id && idWithoutVersion === undefined) { + idWithoutVersion = id; + } } catch { // Try next file } } + // Fallback for rolling releases (e.g. void) that have no version + // field at all + if (idWithoutVersion) { + return idWithoutVersion; + } + throw new Error( "Failed to determine Linux distribution. " + "Could not read /etc/os-release or /usr/lib/os-release",