arisa 2.1.5 → 2.1.6
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 +23 -1
- package/package.json +1 -1
package/bin/arisa.js
CHANGED
|
@@ -417,6 +417,13 @@ function isProvisioned() {
|
|
|
417
417
|
return arisaUserExists() && existsSync("/home/arisa/.bun/bin/bun");
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
+
function isArisaConfigured() {
|
|
421
|
+
const envPath = "/home/arisa/.arisa/.env";
|
|
422
|
+
if (!existsSync(envPath)) return false;
|
|
423
|
+
const content = readFileSync(envPath, "utf8");
|
|
424
|
+
return content.includes("TELEGRAM_BOT_TOKEN=");
|
|
425
|
+
}
|
|
426
|
+
|
|
420
427
|
function detectSudoGroup() {
|
|
421
428
|
// Debian/Ubuntu use 'sudo', RHEL/Fedora use 'wheel'
|
|
422
429
|
const sudoGroup = spawnSync("getent", ["group", "sudo"], { stdio: "ignore" });
|
|
@@ -593,8 +600,23 @@ Arisa management:
|
|
|
593
600
|
process.exit(0);
|
|
594
601
|
}
|
|
595
602
|
|
|
596
|
-
// No args → systemd
|
|
603
|
+
// No args → interactive setup if not configured, otherwise systemd
|
|
597
604
|
if (isDefaultInvocation) {
|
|
605
|
+
if (!isArisaConfigured()) {
|
|
606
|
+
process.stdout.write("Arisa is not configured yet. Starting interactive setup...\n\n");
|
|
607
|
+
const su = spawnSync("su", ["-", "arisa", "-c", "/home/arisa/.bun/bin/arisa"], {
|
|
608
|
+
stdio: "inherit",
|
|
609
|
+
});
|
|
610
|
+
process.stdout.write(`
|
|
611
|
+
Arisa management:
|
|
612
|
+
Start: systemctl start arisa
|
|
613
|
+
Status: systemctl status arisa
|
|
614
|
+
Logs: journalctl -u arisa -f
|
|
615
|
+
Restart: systemctl restart arisa
|
|
616
|
+
Stop: systemctl stop arisa
|
|
617
|
+
`);
|
|
618
|
+
process.exit(su.status ?? 0);
|
|
619
|
+
}
|
|
598
620
|
if (isSystemdActive()) {
|
|
599
621
|
process.exit(statusSystemdSystem());
|
|
600
622
|
} else {
|