mirror of
https://github.com/zen-browser/surfer.git
synced 2025-07-07 17:05:33 +02:00
🎉 Copy all the melon code over
This commit is contained in:
parent
f32d867abc
commit
5777e350af
38 changed files with 2727 additions and 0 deletions
89
src/commands/bootstrap.ts
Normal file
89
src/commands/bootstrap.ts
Normal file
|
@ -0,0 +1,89 @@
|
|||
/// <reference path="./linus.d.ts"/>
|
||||
|
||||
import distro from "linus";
|
||||
import { bin_name } from "..";
|
||||
import { log } from "../";
|
||||
import { ENGINE_DIR } from "../constants";
|
||||
import { dispatch } from "../utils";
|
||||
import { pacmanInstall } from "./bootstrap/arch";
|
||||
|
||||
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...`);
|
||||
|
||||
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"
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
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"
|
||||
)
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
log.error(`Unimplemented distro '${distro}'`);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue