mirror of
https://github.com/morluto/rea.git
synced 2026-10-12 02:19:24 +00:00
33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
import { access, mkdtemp, rm, symlink } from "node:fs/promises";
|
|
import { execFile } from "node:child_process";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
import { promisify } from "node:util";
|
|
|
|
import { createVerifierRun } from "./lib/verifier-run.mjs";
|
|
|
|
const execFileAsync = promisify(execFile);
|
|
createVerifierRun();
|
|
|
|
if (process.platform !== "linux")
|
|
throw new Error("Linux real-Hopper verification must run on Linux");
|
|
const launcher = process.env.HOPPER_LAUNCHER_PATH ?? "/opt/hopper/bin/Hopper";
|
|
await access(launcher);
|
|
await access("/usr/bin/Xvfb");
|
|
await access("/usr/bin/xauth");
|
|
await access("/usr/bin/python3");
|
|
const linked = await execFileAsync("ldd", [launcher]);
|
|
if (`${linked.stdout}\n${linked.stderr}`.includes("not found"))
|
|
throw new Error("Hopper has unresolved shared-library dependencies");
|
|
const alternateDirectory = await mkdtemp(
|
|
join(tmpdir(), "rea-real-hopper-launcher-"),
|
|
);
|
|
const alternateLauncher = join(alternateDirectory, "Hopper-alternate");
|
|
try {
|
|
await symlink(launcher, alternateLauncher);
|
|
process.env.HOPPER_LAUNCHER_PATH = alternateLauncher;
|
|
await import("./verify-real-hopper.mjs");
|
|
} finally {
|
|
await rm(alternateDirectory, { recursive: true, force: true });
|
|
}
|