arisa 2.2.5 → 2.2.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 +14 -8
- package/package.json +1 -1
package/bin/arisa.js
CHANGED
|
@@ -414,7 +414,7 @@ function arisaUserExists() {
|
|
|
414
414
|
}
|
|
415
415
|
|
|
416
416
|
function isProvisioned() {
|
|
417
|
-
return arisaUserExists() && existsSync("/home/arisa/.bun/bin/bun");
|
|
417
|
+
return arisaUserExists() && existsSync("/home/arisa/.bun/bin/bun") && existsSync(SHARED_ARISA_ROOT);
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
function isArisaConfigured() {
|
|
@@ -438,6 +438,8 @@ function step(ok, msg) {
|
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
const ARISA_BUN_ENV = 'export BUN_INSTALL=/home/arisa/.bun && export PATH=/home/arisa/.bun/bin:$PATH';
|
|
441
|
+
const SHARED_ARISA_ROOT = "/opt/arisa/node_modules/arisa";
|
|
442
|
+
const sharedDaemonEntry = join(SHARED_ARISA_ROOT, "src", "daemon", "index.ts");
|
|
441
443
|
|
|
442
444
|
function runAsInherit(cmd) {
|
|
443
445
|
return spawnSync("su", ["-", "arisa", "-c", `${ARISA_BUN_ENV} && ${cmd}`], {
|
|
@@ -483,9 +485,13 @@ function provisionArisaUser() {
|
|
|
483
485
|
spawnSync("chown", ["arisa:arisa", profilePath], { stdio: "ignore" });
|
|
484
486
|
}
|
|
485
487
|
|
|
486
|
-
// 3.
|
|
487
|
-
|
|
488
|
-
|
|
488
|
+
// 3. Copy global node_modules to shared location (lightweight cp, no bun)
|
|
489
|
+
const sharedDir = "/opt/arisa";
|
|
490
|
+
const globalModules = resolve(pkgRoot, "..");
|
|
491
|
+
mkdirSync(sharedDir, { recursive: true });
|
|
492
|
+
spawnSync("cp", ["-r", globalModules, join(sharedDir, "node_modules")], { stdio: "pipe" });
|
|
493
|
+
spawnSync("chown", ["-R", "arisa:arisa", sharedDir], { stdio: "pipe" });
|
|
494
|
+
step(true, "Arisa copied to /opt/arisa");
|
|
489
495
|
|
|
490
496
|
// 4. Migrate data
|
|
491
497
|
const rootArisa = "/root/.arisa";
|
|
@@ -510,11 +516,11 @@ Wants=network-online.target
|
|
|
510
516
|
[Service]
|
|
511
517
|
Type=simple
|
|
512
518
|
User=arisa
|
|
513
|
-
WorkingDirectory=${
|
|
514
|
-
ExecStart=/home/arisa/.bun/bin/bun ${
|
|
519
|
+
WorkingDirectory=${SHARED_ARISA_ROOT}
|
|
520
|
+
ExecStart=/home/arisa/.bun/bin/bun ${sharedDaemonEntry}
|
|
515
521
|
Restart=always
|
|
516
522
|
RestartSec=5
|
|
517
|
-
Environment=ARISA_PROJECT_DIR=${
|
|
523
|
+
Environment=ARISA_PROJECT_DIR=${SHARED_ARISA_ROOT}
|
|
518
524
|
Environment=BUN_INSTALL=/home/arisa/.bun
|
|
519
525
|
Environment=PATH=/home/arisa/.bun/bin:/usr/local/bin:/usr/bin:/bin
|
|
520
526
|
|
|
@@ -574,7 +580,7 @@ function canUseSystemdSystem() {
|
|
|
574
580
|
}
|
|
575
581
|
|
|
576
582
|
function runArisaForeground() {
|
|
577
|
-
const su = spawnSync("su", ["-", "arisa", "-c", `${ARISA_BUN_ENV} && export ARISA_PROJECT_DIR=${
|
|
583
|
+
const su = spawnSync("su", ["-", "arisa", "-c", `${ARISA_BUN_ENV} && export ARISA_PROJECT_DIR=${SHARED_ARISA_ROOT} && /home/arisa/.bun/bin/bun ${sharedDaemonEntry}`], {
|
|
578
584
|
stdio: "inherit",
|
|
579
585
|
});
|
|
580
586
|
return su.status ?? 1;
|