Skip to content

Commit

Permalink
fix: "openssl" detection on RHEL / OpenSUSE (#17092)
Browse files Browse the repository at this point in the history
* fix: fix "openssl" detection on RHEL / OpenSUSE

* chore: add regression tests for "getSSLVersion"
  • Loading branch information
jkomyno committed Jan 3, 2023
1 parent 04b5991 commit ed385dc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
12 changes: 12 additions & 0 deletions packages/get-platform/src/__tests__/getSSLVersion.test.ts
@@ -0,0 +1,12 @@
import { getSSLVersion } from '../../src/getPlatform'

const describeIf = (condition: boolean) => (condition ? describe : describe.skip)

describeIf(process.platform === 'linux')('getSSLVersion', () => {
it('should not return an error', async () => {
const arch = 'x64'
await getSSLVersion({ distro: 'debian', arch })
await getSSLVersion({ distro: 'musl', arch })
await getSSLVersion({ distro: 'rhel', arch })
})
})
6 changes: 5 additions & 1 deletion packages/get-platform/src/getPlatform.ts
Expand Up @@ -159,14 +159,18 @@ export async function getSSLVersion(args: GetOpenSSLVersionParams): Promise<GetO
return getFirstSuccessfulExec(['ls -l /lib/libssl.so.3', 'ls -l /lib/libssl.so.1.1'])
})
.with({ distro: 'debian' }, async () => {
/* Linux Debian, Ubuntu, etc */
const archFromUname = await getArchFromUname()
return getFirstSuccessfulExec([
`ls -l /usr/lib/${archFromUname}-linux-gnu/libssl.so.3*`,
`ls -l /usr/lib/${archFromUname}-linux-gnu/libssl.so.1.1*`,
`ls -l /usr/lib/${archFromUname}-linux-gnu/libssl.so.1.0*`,
])
})
.run()
.otherwise(() => {
/* Other Linux distros, we don't do anything specific and fall back to the next blocks */
return Promise.resolve(undefined)
})

if (libsslVersionSpecific) {
const matchedVersion = parseLibSSLVersion(libsslVersionSpecific)
Expand Down

0 comments on commit ed385dc

Please sign in to comment.