🔥 Do not provide a custom boostraper

This commit is contained in:
trickypr 2022-05-08 13:28:41 +10:00
parent 904cf370a4
commit 7d59b51260
7 changed files with 7 additions and 152 deletions

View file

@ -1,109 +1,20 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
/// <reference path="./linus.d.ts"/>
import distro from 'linus'
import { bin_name } from '..'
import { config } from '..'
import { ENGINE_DIR } from '../constants'
import { log } from '../log'
import { dispatch } from '../utils'
import { pacmanInstall } from './bootstrap/arch'
import { aptInstall } from './bootstrap/debian'
import { configDispatch } from '../utils'
export const bootstrap = async () => {
if (process.platform == 'win32')
log.error(
`You do not need to bootstrap on Windows. As long as you ran |${bin_name} download-artifacts| everything should work fine.`
)
log.info(`Bootstrapping Dot Browser for Desktop...`)
log.info(`Bootstrapping ${config.name}...`)
const args = ['--application-choice', 'browser']
if (process.platform === 'linux') {
linuxBootstrap()
} else {
console.info(
`Custom bootstrapping doesn't work on ${process.platform}. Consider contributing to improve support`
)
console.info(`Passing through to |mach bootstrap|`)
await dispatch(`./mach`, ['bootstrap', ...args], ENGINE_DIR)
}
}
function getDistro(): Promise<string> {
return new Promise((resolve, reject) => {
distro.name((err: Error, name: string) => {
if (name) resolve(name)
else {
reject(err || 'Failed to get linux distro')
}
})
console.debug(`Passing through to |mach bootstrap|`)
await configDispatch('./mach', {
args: ['bootstrap', ...args],
cwd: ENGINE_DIR,
})
}
async function linuxBootstrap() {
const distro = await getDistro()
switch (distro) {
// Both arch and manjaro use the same package repo and the same package manager
case 'ManjaroLinux':
case 'ArchLinux':
console.log(
await pacmanInstall(
// Shared packages
'base-devel',
'nodejs',
'unzip',
'zip',
// Needed for desktop apps
'alsa-lib',
'dbus-glib',
'gtk3',
'libevent',
'libvpx',
'libxt',
'mime-types',
'nasm',
'startup-notification',
'gst-plugins-base-libs',
'libpulse',
'xorg-server-xvfb',
'gst-libav',
'gst-plugins-good',
'wasi-libc'
)
)
break
case 'Debian':
case 'Ubuntu':
case 'Pop':
console.log(
await aptInstall(
'python3-distutils',
'libssl-dev',
'build-essential',
'libpulse-dev',
'clang',
'nasm',
'libpango1.0-dev',
'libx11-dev',
'libx11-xcb-dev',
'libgtk-3-dev',
'm4',
'libgtk2.0-dev',
'libdbus-glib-1-dev',
'libxt-dev'
)
)
break
default:
log.error(`Unimplemented distro '${distro}'`)
}
}