@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.
Files changed (2) hide show
  1. package/dist/service.js +7 -1
  2. 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?.includes(MARKER) || !unit.includes(forHome))
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}`])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@christoph-teichmeister/shub",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Launcher for shub, your session hub: installs, updates and starts signed shub releases.",
5
5
  "license": "MIT",
6
6
  "type": "module",