MCPcopy
hub / github.com/electerm/electerm / main

Function main

npm/install.js:469–537  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

467// ---------------------------------------------------------------------------
468
469async function main () {
470 console.log('')
471 console.log('========================================')
472 console.log('electerm binary installer')
473 console.log('========================================')
474 console.log(`Platform: ${plat}, Architecture: ${arch}`)
475
476 if (GITHUB_PROXY) {
477 console.log(`GitHub Proxy: ${GITHUB_PROXY}`)
478 }
479
480 console.log('')
481
482 // Check for legacy systems
483 const win7 = isWindows7OrEarlier(plat, os.release())
484 const mac10 = isMacOS10(plat, os.release())
485 const linuxLegacy = isLinuxLegacy(plat)
486
487 if (win7) console.log(' Detected: Windows 7 or earlier')
488 if (mac10) console.log(' Detected: macOS 10.x')
489 if (linuxLegacy) console.log(' Detected: Linux with glibc < 2.34 (legacy)')
490
491 console.log(' Fetching release information...')
492
493 try {
494 if (plat === 'win32') {
495 if (win7) {
496 await runWin7()
497 } else if (arch === 'arm64') {
498 await runWin('arm64')
499 } else {
500 await runWin('x64')
501 }
502 } else if (plat === 'darwin') {
503 if (mac10) {
504 await runMac10()
505 } else if (arch === 'arm64') {
506 await runMac('arm64')
507 } else {
508 await runMac('x64')
509 }
510 } else if (plat === 'linux') {
511 const suffix = linuxLegacy ? '-legacy' : ''
512 if (arch === 'arm64' || arch === 'aarch64') {
513 await runLinux(`linux-arm64${suffix}`, `linux-arm64${suffix}.tar.gz`)
514 } else if (arch === 'arm') {
515 await runLinux(`linux-armv7l${suffix}`, `linux-armv7l${suffix}.tar.gz`)
516 } else if (arch.includes('loong')) {
517 await runLinux(`linux-loong64${suffix}`, `linux-loong64${suffix}.tar.gz`)
518 } else {
519 await runLinux(`linux-x64${suffix}`, `linux-x64${suffix}.tar.gz`)
520 }
521 } else {
522 throw new Error(`Platform "${plat}" is not supported.`)
523 }
524 } catch (err) {
525 console.error('')
526 console.error('========================================')

Callers 1

install.jsFile · 0.70

Calls 8

isWindows7OrEarlierFunction · 0.85
isMacOS10Function · 0.85
isLinuxLegacyFunction · 0.85
runWin7Function · 0.85
runWinFunction · 0.85
runMac10Function · 0.85
runMacFunction · 0.85
runLinuxFunction · 0.85

Tested by

no test coverage detected