mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
installer: add gawk
This commit is contained in:
3 files changed
+45
-11
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import { execSync } from 'child_process';
|
||||
import fs from 'fs';
|
||||
import { Context, Schema, UserModel } from 'hydrooj';
|
||||
import { startPerformanceTest } from './performance-test';
|
||||
|
||||
@@ -7,4 +9,17 @@ export async function apply(ctx: Context) {
|
||||
if (that.session.uid === 2) await UserModel.setSuperAdmin(2);
|
||||
});
|
||||
ctx.addScript('performance-test', 'test', Schema.object({ enable5: Schema.boolean().default(false) }), startPerformanceTest);
|
||||
const installerFileExists = fs.existsSync('/etc/HYDRO_INSTALLER');
|
||||
if (!installerFileExists) return;
|
||||
const content = fs.readFileSync('/etc/HYDRO_INSTALLER', 'utf-8');
|
||||
const val: Record<string, string> = {};
|
||||
for (const line of content.split('\n')) {
|
||||
const [key, value] = line.split('=').map((i) => i?.trim());
|
||||
if (key && value) val[key] = value;
|
||||
}
|
||||
if (val.layout === '1') {
|
||||
execSync('nix-env -iA nixpkgs.gawk');
|
||||
execSync('pm2 restart hydro-sandbox');
|
||||
fs.writeFileSync('/etc/HYDRO_INSTALLER', content.replace('layout=1', 'layout=2'));
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"name": "@hydrooj/a11y",
|
||||
"version": "0.0.2"
|
||||
"version": "0.0.3"
|
||||
}
|
||||
Reference in new issue
Block a user