arisa 2.1.3 → 2.1.5
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 +32 -24
- package/package.json +1 -1
package/bin/arisa.js
CHANGED
|
@@ -430,10 +430,10 @@ function step(ok, msg) {
|
|
|
430
430
|
process.stdout.write(` ${ok ? "\u2713" : "\u2717"} ${msg}\n`);
|
|
431
431
|
}
|
|
432
432
|
|
|
433
|
-
function
|
|
433
|
+
function runAsInherit(cmd) {
|
|
434
434
|
return spawnSync("su", ["-", "arisa", "-c", cmd], {
|
|
435
|
-
stdio: "
|
|
436
|
-
timeout:
|
|
435
|
+
stdio: "inherit",
|
|
436
|
+
timeout: 180_000,
|
|
437
437
|
});
|
|
438
438
|
}
|
|
439
439
|
|
|
@@ -456,10 +456,11 @@ function provisionArisaUser() {
|
|
|
456
456
|
spawnSync("usermod", ["-aG", group, "arisa"], { stdio: "ignore" });
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
-
// 2. Install bun
|
|
460
|
-
|
|
459
|
+
// 2. Install bun (downloads ~30 MB, may take a minute)
|
|
460
|
+
process.stdout.write(" Installing bun (this may take a minute)...\n");
|
|
461
|
+
const bunInstall = runAsInherit("curl -fsSL https://bun.sh/install | bash");
|
|
461
462
|
if (bunInstall.status !== 0) {
|
|
462
|
-
step(false,
|
|
463
|
+
step(false, "Failed to install bun");
|
|
463
464
|
process.exit(1);
|
|
464
465
|
}
|
|
465
466
|
step(true, "Bun installed for arisa");
|
|
@@ -470,9 +471,10 @@ function provisionArisaUser() {
|
|
|
470
471
|
spawnSync("chown", ["-R", "arisa:arisa", dest], { stdio: "pipe" });
|
|
471
472
|
|
|
472
473
|
// Install deps + global
|
|
473
|
-
|
|
474
|
+
process.stdout.write(" Installing dependencies...\n");
|
|
475
|
+
const install = runAsInherit("cd ~/arisa && ~/.bun/bin/bun install && ~/.bun/bin/bun add -g .");
|
|
474
476
|
if (install.status !== 0) {
|
|
475
|
-
step(false,
|
|
477
|
+
step(false, "Failed to install dependencies");
|
|
476
478
|
process.exit(1);
|
|
477
479
|
}
|
|
478
480
|
step(true, "Arisa installed for arisa");
|
|
@@ -562,17 +564,23 @@ if (isRoot()) {
|
|
|
562
564
|
provisionArisaUser();
|
|
563
565
|
writeSystemdSystemUnit();
|
|
564
566
|
spawnSync("systemctl", ["daemon-reload"], { stdio: "inherit" });
|
|
565
|
-
spawnSync("systemctl", ["enable", "
|
|
566
|
-
step(true, "Systemd service enabled");
|
|
567
|
+
spawnSync("systemctl", ["enable", "arisa"], { stdio: "inherit" });
|
|
568
|
+
step(true, "Systemd service enabled (auto-starts on reboot)");
|
|
569
|
+
|
|
570
|
+
process.stdout.write("\nStarting interactive setup as user arisa...\n\n");
|
|
571
|
+
const su = spawnSync("su", ["-", "arisa", "-c", "/home/arisa/.bun/bin/arisa"], {
|
|
572
|
+
stdio: "inherit",
|
|
573
|
+
});
|
|
567
574
|
|
|
568
575
|
process.stdout.write(`
|
|
569
|
-
Arisa
|
|
576
|
+
Arisa management:
|
|
577
|
+
Start: systemctl start arisa
|
|
570
578
|
Status: systemctl status arisa
|
|
571
579
|
Logs: journalctl -u arisa -f
|
|
572
580
|
Restart: systemctl restart arisa
|
|
573
581
|
Stop: systemctl stop arisa
|
|
574
582
|
`);
|
|
575
|
-
process.exit(0);
|
|
583
|
+
process.exit(su.status ?? 0);
|
|
576
584
|
}
|
|
577
585
|
|
|
578
586
|
// Already provisioned — route commands to system-level systemd
|
|
@@ -585,6 +593,15 @@ Arisa is now running as a service.
|
|
|
585
593
|
process.exit(0);
|
|
586
594
|
}
|
|
587
595
|
|
|
596
|
+
// No args → systemd management
|
|
597
|
+
if (isDefaultInvocation) {
|
|
598
|
+
if (isSystemdActive()) {
|
|
599
|
+
process.exit(statusSystemdSystem());
|
|
600
|
+
} else {
|
|
601
|
+
process.exit(startSystemdSystem());
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
|
|
588
605
|
switch (command) {
|
|
589
606
|
case "start":
|
|
590
607
|
process.exit(startSystemdSystem());
|
|
@@ -600,25 +617,16 @@ Arisa is now running as a service.
|
|
|
600
617
|
break;
|
|
601
618
|
case "daemon":
|
|
602
619
|
case "run": {
|
|
603
|
-
//
|
|
604
|
-
const su = spawnSync("su", ["-", "arisa", "-c", "arisa"], {
|
|
620
|
+
// Explicit "arisa daemon/run" → foreground as arisa user
|
|
621
|
+
const su = spawnSync("su", ["-", "arisa", "-c", "/home/arisa/.bun/bin/arisa"], {
|
|
605
622
|
stdio: "inherit",
|
|
606
623
|
});
|
|
607
624
|
process.exit(su.status ?? 1);
|
|
608
625
|
}
|
|
609
|
-
default:
|
|
610
|
-
// No args or unknown — start if not active, otherwise show status
|
|
611
|
-
if (isDefaultInvocation) {
|
|
612
|
-
if (isSystemdActive()) {
|
|
613
|
-
process.exit(statusSystemdSystem());
|
|
614
|
-
} else {
|
|
615
|
-
process.exit(startSystemdSystem());
|
|
616
|
-
}
|
|
617
|
-
}
|
|
626
|
+
default:
|
|
618
627
|
process.stderr.write(`Unknown command: ${command}\n\n`);
|
|
619
628
|
printHelp();
|
|
620
629
|
process.exit(1);
|
|
621
|
-
}
|
|
622
630
|
}
|
|
623
631
|
}
|
|
624
632
|
|