mb-service-linux 2.0.0-dev-20260701-ef3f9ac → 2.0.1-dev-20260701-8a1ecee
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/CHANGELOG.md +10 -1
- package/README.md +10 -2
- package/bin/mb-service +0 -0
- package/dist/module.js +38 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -24,7 +24,15 @@ If you like this project and find it useful, please consider giving it a star on
|
|
|
24
24
|
|
|
25
25
|
<a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="120"></a>
|
|
26
26
|
|
|
27
|
-
## [2.0.
|
|
27
|
+
## [2.0.1] - Dev branch
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- [service]: Add path of service file.
|
|
32
|
+
|
|
33
|
+
<a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
|
|
34
|
+
|
|
35
|
+
## [2.0.0] - 2026-07-01
|
|
28
36
|
|
|
29
37
|
### Added
|
|
30
38
|
|
|
@@ -36,6 +44,7 @@ If you like this project and find it useful, please consider giving it a star on
|
|
|
36
44
|
- [service]: Check for `package.json` before running package manager `link` and `unlink`.
|
|
37
45
|
- [service]: Run package manager `link` and `unlink` commands for development links.
|
|
38
46
|
- [service]: Require root privileges for npm `link` and `unlink` commands on Linux.
|
|
47
|
+
- [service]: Show a `loginctl enable-linger` hint after creating a user-owned service.
|
|
39
48
|
|
|
40
49
|
### Changed
|
|
41
50
|
|
package/README.md
CHANGED
|
@@ -55,8 +55,16 @@ See the complete guidelines on [Matterbridge](https://matterbridge.io) for more
|
|
|
55
55
|
|
|
56
56
|
## How to install the Matterbridge service cli
|
|
57
57
|
|
|
58
|
+
Install it with Node.js:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
sudo npm install mb-service-linux --global --omit=dev
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Or install it with Bun:
|
|
65
|
+
|
|
58
66
|
```bash
|
|
59
|
-
|
|
67
|
+
bun add mb-service-linux --global --omit=dev
|
|
60
68
|
```
|
|
61
69
|
|
|
62
70
|
Create a root-owned service file when Matterbridge is installed globally with npm:
|
|
@@ -67,7 +75,7 @@ sudo mb-service enable
|
|
|
67
75
|
sudo mb-service start
|
|
68
76
|
```
|
|
69
77
|
|
|
70
|
-
Create a user-owned service file when Matterbridge is installed for the current user:
|
|
78
|
+
Create a user-owned service file when Matterbridge is installed for the current user with npm:
|
|
71
79
|
|
|
72
80
|
```bash
|
|
73
81
|
mb-service create
|
package/bin/mb-service
CHANGED
|
File without changes
|
package/dist/module.js
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
1
|
+
import { execFileSync, spawnSync } from 'node:child_process';
|
|
2
2
|
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
3
3
|
const HAS_BUN_GLOBAL = typeof Bun !== 'undefined';
|
|
4
|
+
const MB_SERVICE_VERSION = '2.0.0';
|
|
4
5
|
export function isBun() {
|
|
5
6
|
return HAS_BUN_GLOBAL || typeof process?.versions?.bun === 'string';
|
|
6
7
|
}
|
|
8
|
+
export function bunAvailable() {
|
|
9
|
+
if (isBun()) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
const home = process.env.HOME ?? '';
|
|
13
|
+
if (home && existsSync(`${home}/.bun/bin/bun`))
|
|
14
|
+
return true;
|
|
15
|
+
try {
|
|
16
|
+
execFileSync('bun', ['--version'], { stdio: 'ignore' });
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
7
23
|
function isRoot() {
|
|
8
24
|
return process.getuid?.() === 0;
|
|
9
25
|
}
|
|
@@ -19,6 +35,9 @@ function getServicePath(root) {
|
|
|
19
35
|
function getUserServiceDirectory() {
|
|
20
36
|
return `${process.env.HOME}/.config/systemd/user`;
|
|
21
37
|
}
|
|
38
|
+
function getDiagnosticUser() {
|
|
39
|
+
return process.env.SUDO_USER ?? process.env.USER ?? 'unknown';
|
|
40
|
+
}
|
|
22
41
|
function existsServiceFile(root) {
|
|
23
42
|
return existsSync(getServicePath(root));
|
|
24
43
|
}
|
|
@@ -136,7 +155,16 @@ export function main() {
|
|
|
136
155
|
}
|
|
137
156
|
}
|
|
138
157
|
function printHelp() {
|
|
139
|
-
console.log(`\x1b[
|
|
158
|
+
console.log(`\x1b[90mEnvironment:\n` +
|
|
159
|
+
` mb-service version: ${MB_SERVICE_VERSION}\n` +
|
|
160
|
+
` Runtime: ${isBun() ? 'Bun' : 'Node.js'}\n` +
|
|
161
|
+
` Node version: ${process.version}${isBun() ? ' (reported by Bun for Node.js compatibility)' : ''}\n` +
|
|
162
|
+
` Bun available: ${bunAvailable() ? 'yes' : 'no'}\n` +
|
|
163
|
+
` Bun version: ${process.versions.bun ?? 'not running'}\n` +
|
|
164
|
+
` Running as root: ${isRoot() ? 'yes' : 'no'}\n` +
|
|
165
|
+
` Service user: ${getDiagnosticUser()}\n` +
|
|
166
|
+
` Root service file: ${existsServiceFile(true) ? `found at "${getServicePath(true)}"` : 'not found'}\n` +
|
|
167
|
+
` User service file: ${existsServiceFile(false) ? `found at "${getServicePath(false)}"` : 'not found'}\x1b[0m`);
|
|
140
168
|
console.log(`Usage: mb-service [start|stop|restart|logs|status]\n\n` +
|
|
141
169
|
` Please provide a command:\n` +
|
|
142
170
|
` start start the matterbridge service\n` +
|
|
@@ -169,6 +197,8 @@ function createServiceConfig(root) {
|
|
|
169
197
|
`StandardOutput=inherit\n` +
|
|
170
198
|
`StandardError=inherit\n` +
|
|
171
199
|
`Restart=always\n` +
|
|
200
|
+
`RestartSec=5\n` +
|
|
201
|
+
`TimeoutStopSec=60\n` +
|
|
172
202
|
`User=${user}\n` +
|
|
173
203
|
`Group=${user}\n` +
|
|
174
204
|
`\n` +
|
|
@@ -182,11 +212,13 @@ function createServiceConfig(root) {
|
|
|
182
212
|
`StartLimitBurst=5\n` +
|
|
183
213
|
`[Service]\n` +
|
|
184
214
|
`Type=simple\n` +
|
|
185
|
-
(isBun() ? `ExecStart=%h/.bun/bin/bun --bun %h/.bun/bin/matterbridge --service\n` : `ExecStart=matterbridge --service\n`) +
|
|
215
|
+
(isBun() ? `ExecStart=%h/.bun/bin/bun --bun run %h/.bun/bin/matterbridge --service\n` : `ExecStart=matterbridge --service\n`) +
|
|
186
216
|
`WorkingDirectory=%h\n` +
|
|
187
217
|
`StandardOutput=inherit\n` +
|
|
188
218
|
`StandardError=inherit\n` +
|
|
189
219
|
`Restart=always\n` +
|
|
220
|
+
`RestartSec=5\n` +
|
|
221
|
+
`TimeoutStopSec=60\n` +
|
|
190
222
|
`\n` +
|
|
191
223
|
`[Install]\n` +
|
|
192
224
|
`WantedBy=default.target\n`;
|
|
@@ -205,6 +237,9 @@ function createServiceConfig(root) {
|
|
|
205
237
|
}
|
|
206
238
|
writeFileSync(servicePath, root ? rootConfig : userConfig, { mode: 0o644 });
|
|
207
239
|
console.log(`Service configuration written to ${servicePath} successfully for user ${user}.`);
|
|
240
|
+
if (!root) {
|
|
241
|
+
console.warn(`To keep the user service active after logout, run once: sudo loginctl enable-linger ${user}`);
|
|
242
|
+
}
|
|
208
243
|
}
|
|
209
244
|
catch (err) {
|
|
210
245
|
console.error(`Failed to write service file: ${String(err)}`);
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mb-service-linux",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1-dev-20260701-8a1ecee",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "mb-service-linux",
|
|
9
|
-
"version": "2.0.
|
|
9
|
+
"version": "2.0.1-dev-20260701-8a1ecee",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"bin": {
|
|
12
12
|
"mb-service": "bin/mb-service"
|
package/package.json
CHANGED