Продакшн рефактор без легаси
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { InstallContext } from "../types/context";
|
||||
import type { RuntimeContext } from "../types/context";
|
||||
import { exists, readText } from "../lib/fs";
|
||||
import { fail, info } from "../lib/log";
|
||||
import { run } from "../lib/process";
|
||||
@@ -21,8 +21,8 @@ async function isUnitActive(unit: string): Promise<boolean> {
|
||||
}
|
||||
}
|
||||
|
||||
export async function preflight(context: InstallContext): Promise<void> {
|
||||
const isReconfigure = context.packageVersion === "reconfigure";
|
||||
export async function preflight(context: RuntimeContext): Promise<void> {
|
||||
const isReconfigure = context.mode === "reconfigure";
|
||||
|
||||
if (process.getuid?.() !== 0) {
|
||||
fail("installer must run as root");
|
||||
@@ -33,7 +33,16 @@ export async function preflight(context: InstallContext): Promise<void> {
|
||||
fail("HY2XS baseline supports only clean Debian 12");
|
||||
}
|
||||
|
||||
if (!(await exists(`${context.options.packageDir}/ui/hy2xs-admin`))) {
|
||||
if (!(await exists(`${context.options.packageDir}/systemd/hy2xs-admin.service`))) {
|
||||
fail("missing hy2xs-admin systemd unit in package");
|
||||
}
|
||||
if (!(await exists(`${context.options.packageDir}/systemd/hysteria-server.service`))) {
|
||||
fail("missing hysteria-server systemd unit in package");
|
||||
}
|
||||
if (!(await exists(`${context.options.packageDir}/templates/hysteria/config.yaml.tpl`))) {
|
||||
fail("missing Hysteria config template in package");
|
||||
}
|
||||
if (context.mode === "install" && !(await exists(`${context.options.packageDir}/ui/hy2xs-admin/hy2xs-admin`))) {
|
||||
fail("bundled HY2XS admin is missing from install package");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user