arisa 2.2.11 → 2.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/arisa.js +0 -37
- package/package.json +1 -1
package/bin/arisa.js
CHANGED
|
@@ -448,46 +448,9 @@ function runAsInherit(cmd) {
|
|
|
448
448
|
});
|
|
449
449
|
}
|
|
450
450
|
|
|
451
|
-
function ensureSwap() {
|
|
452
|
-
// Check if swap already exists
|
|
453
|
-
const swapon = spawnSync("swapon", ["--show"], { stdio: "pipe" });
|
|
454
|
-
const swapOutput = (swapon.stdout || "").toString().trim();
|
|
455
|
-
if (swapOutput.includes("/")) return; // swap already active
|
|
456
|
-
|
|
457
|
-
// Create 512MB swap file (essential on 1GB VPS for bun add)
|
|
458
|
-
process.stdout.write(" Creating swap file (512MB)...\n");
|
|
459
|
-
const cmds = [
|
|
460
|
-
["fallocate", ["-l", "512M", "/swapfile"]],
|
|
461
|
-
["chmod", ["600", "/swapfile"]],
|
|
462
|
-
["mkswap", ["/swapfile"]],
|
|
463
|
-
["swapon", ["/swapfile"]],
|
|
464
|
-
];
|
|
465
|
-
for (const [cmd, cmdArgs] of cmds) {
|
|
466
|
-
const result = spawnSync(cmd, cmdArgs, { stdio: "pipe" });
|
|
467
|
-
if (result.status !== 0) {
|
|
468
|
-
step(false, "Failed to create swap file");
|
|
469
|
-
return;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
// Make persistent across reboots
|
|
474
|
-
const fstabPath = "/etc/fstab";
|
|
475
|
-
if (existsSync(fstabPath)) {
|
|
476
|
-
const fstab = readFileSync(fstabPath, "utf8");
|
|
477
|
-
if (!fstab.includes("/swapfile")) {
|
|
478
|
-
writeFileSync(fstabPath, fstab.trimEnd() + "\n/swapfile none swap sw 0 0\n");
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
step(true, "Swap file created (512MB)");
|
|
483
|
-
}
|
|
484
|
-
|
|
485
451
|
function provisionArisaUser() {
|
|
486
452
|
process.stdout.write("Running as root \u2014 creating dedicated user 'arisa'...\n");
|
|
487
453
|
|
|
488
|
-
// 0. Ensure swap exists (prevents OOM on 1GB VPS during CLI installs)
|
|
489
|
-
ensureSwap();
|
|
490
|
-
|
|
491
454
|
// 1. Create user
|
|
492
455
|
const useradd = spawnSync("useradd", ["-m", "-s", "/bin/bash", "arisa"], {
|
|
493
456
|
stdio: "pipe",
|