installer: add gawk

This commit is contained in:
undefined committed 2025-06-06 18:59:45 +08:00
1 parent 1d1502d373
commit 82cea4c78f
3 files changed
+45 -11

No files matched your search

+15
View File
@@ -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 -1
View File
@@ -1,4 +1,4 @@
{
"name": "@hydrooj/a11y",
"version": "0.0.2"
"version": "0.0.3"
}