@christoph-teichmeister/shub 1.0.0 → 1.0.1
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/dist/service.js +7 -1
- package/package.json +1 -1
package/dist/service.js
CHANGED
|
@@ -5,6 +5,7 @@ import { execFileSync } from 'node:child_process';
|
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
6
6
|
import { homedir } from 'node:os';
|
|
7
7
|
import { dirname, join } from 'node:path';
|
|
8
|
+
import { shubHome } from "./versions.js";
|
|
8
9
|
const MARKER = 'Written by `shub service install`';
|
|
9
10
|
export const UNIT = 'shub.service';
|
|
10
11
|
export const LABEL = 'com.github.christoph-teichmeister.shub';
|
|
@@ -130,7 +131,12 @@ export function service(platform = process.platform, env = process.env, run = ru
|
|
|
130
131
|
active(home) {
|
|
131
132
|
const unit = text();
|
|
132
133
|
const forHome = darwin ? `<string>${xml(home)}</string>` : `SHUB_HOME=${home}"`;
|
|
133
|
-
if (!unit
|
|
134
|
+
if (!unit)
|
|
135
|
+
return false;
|
|
136
|
+
const handWritten = !darwin &&
|
|
137
|
+
/^ExecStart=.*\bshub"?\s+start\s*$/m.test(unit) &&
|
|
138
|
+
(unit.includes('SHUB_HOME=') ? unit.includes(forHome) : home === shubHome({ ...env, SHUB_HOME: undefined }));
|
|
139
|
+
if (!handWritten && (!unit.includes(MARKER) || !unit.includes(forHome)))
|
|
134
140
|
return false;
|
|
135
141
|
return darwin
|
|
136
142
|
? succeeds(run, 'launchctl', ['print', `${target}/${LABEL}`])
|