2023-03-08 08:45:16 +00:00
|
|
|
import os from 'os';
|
2020-02-09 05:21:39 +00:00
|
|
|
|
|
|
|
export function getPlatform(): string {
|
2020-02-09 05:29:21 +00:00
|
|
|
// darwin and linux match already
|
|
|
|
// freebsd not supported yet but future proofed.
|
|
|
|
|
|
|
|
// 'aix', 'darwin', 'freebsd', 'linux', 'openbsd', 'sunos', and 'win32'
|
|
|
|
let plat: string = os.platform();
|
|
|
|
|
|
|
|
// wants 'darwin', 'freebsd', 'linux', 'windows'
|
|
|
|
if (plat === 'win32') {
|
|
|
|
plat = 'windows';
|
2020-02-09 05:21:39 +00:00
|
|
|
}
|
2020-02-09 05:29:21 +00:00
|
|
|
|
|
|
|
return plat;
|
|
|
|
}
|
|
|
|
|
2022-08-12 11:29:48 +01:00
|
|
|
export function getArch(arch: string): string {
|
2020-02-09 05:29:21 +00:00
|
|
|
// 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.
|
|
|
|
|
|
|
|
// wants amd64, 386, arm64, armv61, ppc641e, s390x
|
|
|
|
// currently not supported by runner but future proofed mapping
|
|
|
|
switch (arch) {
|
|
|
|
case 'x64':
|
|
|
|
arch = 'amd64';
|
|
|
|
break;
|
2020-02-09 23:22:24 +00:00
|
|
|
// case 'ppc':
|
|
|
|
// arch = 'ppc64';
|
|
|
|
// break;
|
2020-02-09 05:29:21 +00:00
|
|
|
case 'x32':
|
|
|
|
arch = '386';
|
|
|
|
break;
|
2022-08-12 11:29:48 +01:00
|
|
|
case 'arm':
|
|
|
|
arch = 'armv6l';
|
|
|
|
break;
|
2020-02-09 05:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return arch;
|
|
|
|
}
|