@ebowwa/seedinstallation 0.4.0 → 0.4.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/bootstrap.js +5 -3
- package/dist/device-auth.js +5 -3
- package/dist/index.js +7 -5
- package/dist/runtime.js +5 -3
- package/dist/sudo.js +5 -3
- package/dist/systemd.js +7 -5
- package/package.json +2 -2
package/dist/bootstrap.js
CHANGED
|
@@ -68,7 +68,8 @@ function buildSshPrefix(ctx) {
|
|
|
68
68
|
return parts;
|
|
69
69
|
}
|
|
70
70
|
async function exec(args, opts) {
|
|
71
|
-
const
|
|
71
|
+
const ctx = opts.context ?? { type: "local" };
|
|
72
|
+
const finalArgs = ctx.type === "ssh" ? [...buildSshPrefix(ctx), args.map(shellEscape).join(" ")] : args;
|
|
72
73
|
const proc = Bun.spawn(finalArgs, {
|
|
73
74
|
stdout: "pipe",
|
|
74
75
|
stderr: "pipe",
|
|
@@ -80,8 +81,9 @@ async function exec(args, opts) {
|
|
|
80
81
|
return { stdout, stderr, exitCode, ok: exitCode === 0 };
|
|
81
82
|
}
|
|
82
83
|
async function execPipe(input, args, opts) {
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
const ctx = opts.context ?? { type: "local" };
|
|
85
|
+
if (ctx.type === "ssh") {
|
|
86
|
+
const sshPrefix = buildSshPrefix(ctx);
|
|
85
87
|
const remoteCmd = args.join(" ");
|
|
86
88
|
const fullArgs = [...sshPrefix, remoteCmd];
|
|
87
89
|
const proc2 = Bun.spawn(fullArgs, {
|
package/dist/device-auth.js
CHANGED
|
@@ -68,7 +68,8 @@ function buildSshPrefix(ctx) {
|
|
|
68
68
|
return parts;
|
|
69
69
|
}
|
|
70
70
|
async function exec(args, opts) {
|
|
71
|
-
const
|
|
71
|
+
const ctx = opts.context ?? { type: "local" };
|
|
72
|
+
const finalArgs = ctx.type === "ssh" ? [...buildSshPrefix(ctx), args.map(shellEscape).join(" ")] : args;
|
|
72
73
|
const proc = Bun.spawn(finalArgs, {
|
|
73
74
|
stdout: "pipe",
|
|
74
75
|
stderr: "pipe",
|
|
@@ -80,8 +81,9 @@ async function exec(args, opts) {
|
|
|
80
81
|
return { stdout, stderr, exitCode, ok: exitCode === 0 };
|
|
81
82
|
}
|
|
82
83
|
async function execPipe(input, args, opts) {
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
const ctx = opts.context ?? { type: "local" };
|
|
85
|
+
if (ctx.type === "ssh") {
|
|
86
|
+
const sshPrefix = buildSshPrefix(ctx);
|
|
85
87
|
const remoteCmd = args.join(" ");
|
|
86
88
|
const fullArgs = [...sshPrefix, remoteCmd];
|
|
87
89
|
const proc2 = Bun.spawn(fullArgs, {
|
package/dist/index.js
CHANGED
|
@@ -68,7 +68,8 @@ function buildSshPrefix(ctx) {
|
|
|
68
68
|
return parts;
|
|
69
69
|
}
|
|
70
70
|
async function exec(args, opts) {
|
|
71
|
-
const
|
|
71
|
+
const ctx = opts.context ?? { type: "local" };
|
|
72
|
+
const finalArgs = ctx.type === "ssh" ? [...buildSshPrefix(ctx), args.map(shellEscape).join(" ")] : args;
|
|
72
73
|
const proc = Bun.spawn(finalArgs, {
|
|
73
74
|
stdout: "pipe",
|
|
74
75
|
stderr: "pipe",
|
|
@@ -80,8 +81,9 @@ async function exec(args, opts) {
|
|
|
80
81
|
return { stdout, stderr, exitCode, ok: exitCode === 0 };
|
|
81
82
|
}
|
|
82
83
|
async function execPipe(input, args, opts) {
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
const ctx = opts.context ?? { type: "local" };
|
|
85
|
+
if (ctx.type === "ssh") {
|
|
86
|
+
const sshPrefix = buildSshPrefix(ctx);
|
|
85
87
|
const remoteCmd = args.join(" ");
|
|
86
88
|
const fullArgs = [...sshPrefix, remoteCmd];
|
|
87
89
|
const proc2 = Bun.spawn(fullArgs, {
|
|
@@ -402,7 +404,7 @@ function generateServiceUnit(name, opts) {
|
|
|
402
404
|
lines.push(`SystemCallFilter=${opts.systemCallFilter.join(" ")}`);
|
|
403
405
|
if (opts.restrictNamespaces === true)
|
|
404
406
|
lines.push("RestrictNamespaces=true");
|
|
405
|
-
else if (opts.restrictNamespaces
|
|
407
|
+
else if (Array.isArray(opts.restrictNamespaces) && opts.restrictNamespaces.length > 0)
|
|
406
408
|
lines.push(`RestrictNamespaces=${opts.restrictNamespaces.join(" ")}`);
|
|
407
409
|
if (opts.personality)
|
|
408
410
|
lines.push(`Personality=${opts.personality}`);
|
|
@@ -467,7 +469,7 @@ async function getServiceStatus(name, opts) {
|
|
|
467
469
|
quiet: true
|
|
468
470
|
});
|
|
469
471
|
if (!result.ok) {
|
|
470
|
-
return { loaded: false, active: false, subState: "unknown", mainPid: 0 };
|
|
472
|
+
return { loaded: false, active: false, subState: "unknown", mainPid: 0, description: "" };
|
|
471
473
|
}
|
|
472
474
|
const parse = (key) => {
|
|
473
475
|
const match = result.stdout.match(new RegExp(`^${key}=(.+)$`, "m"));
|
package/dist/runtime.js
CHANGED
|
@@ -68,7 +68,8 @@ function buildSshPrefix(ctx) {
|
|
|
68
68
|
return parts;
|
|
69
69
|
}
|
|
70
70
|
async function exec(args, opts) {
|
|
71
|
-
const
|
|
71
|
+
const ctx = opts.context ?? { type: "local" };
|
|
72
|
+
const finalArgs = ctx.type === "ssh" ? [...buildSshPrefix(ctx), args.map(shellEscape).join(" ")] : args;
|
|
72
73
|
const proc = Bun.spawn(finalArgs, {
|
|
73
74
|
stdout: "pipe",
|
|
74
75
|
stderr: "pipe",
|
|
@@ -80,8 +81,9 @@ async function exec(args, opts) {
|
|
|
80
81
|
return { stdout, stderr, exitCode, ok: exitCode === 0 };
|
|
81
82
|
}
|
|
82
83
|
async function execPipe(input, args, opts) {
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
const ctx = opts.context ?? { type: "local" };
|
|
85
|
+
if (ctx.type === "ssh") {
|
|
86
|
+
const sshPrefix = buildSshPrefix(ctx);
|
|
85
87
|
const remoteCmd = args.join(" ");
|
|
86
88
|
const fullArgs = [...sshPrefix, remoteCmd];
|
|
87
89
|
const proc2 = Bun.spawn(fullArgs, {
|
package/dist/sudo.js
CHANGED
|
@@ -68,7 +68,8 @@ function buildSshPrefix(ctx) {
|
|
|
68
68
|
return parts;
|
|
69
69
|
}
|
|
70
70
|
async function exec(args, opts) {
|
|
71
|
-
const
|
|
71
|
+
const ctx = opts.context ?? { type: "local" };
|
|
72
|
+
const finalArgs = ctx.type === "ssh" ? [...buildSshPrefix(ctx), args.map(shellEscape).join(" ")] : args;
|
|
72
73
|
const proc = Bun.spawn(finalArgs, {
|
|
73
74
|
stdout: "pipe",
|
|
74
75
|
stderr: "pipe",
|
|
@@ -80,8 +81,9 @@ async function exec(args, opts) {
|
|
|
80
81
|
return { stdout, stderr, exitCode, ok: exitCode === 0 };
|
|
81
82
|
}
|
|
82
83
|
async function execPipe(input, args, opts) {
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
const ctx = opts.context ?? { type: "local" };
|
|
85
|
+
if (ctx.type === "ssh") {
|
|
86
|
+
const sshPrefix = buildSshPrefix(ctx);
|
|
85
87
|
const remoteCmd = args.join(" ");
|
|
86
88
|
const fullArgs = [...sshPrefix, remoteCmd];
|
|
87
89
|
const proc2 = Bun.spawn(fullArgs, {
|
package/dist/systemd.js
CHANGED
|
@@ -68,7 +68,8 @@ function buildSshPrefix(ctx) {
|
|
|
68
68
|
return parts;
|
|
69
69
|
}
|
|
70
70
|
async function exec(args, opts) {
|
|
71
|
-
const
|
|
71
|
+
const ctx = opts.context ?? { type: "local" };
|
|
72
|
+
const finalArgs = ctx.type === "ssh" ? [...buildSshPrefix(ctx), args.map(shellEscape).join(" ")] : args;
|
|
72
73
|
const proc = Bun.spawn(finalArgs, {
|
|
73
74
|
stdout: "pipe",
|
|
74
75
|
stderr: "pipe",
|
|
@@ -80,8 +81,9 @@ async function exec(args, opts) {
|
|
|
80
81
|
return { stdout, stderr, exitCode, ok: exitCode === 0 };
|
|
81
82
|
}
|
|
82
83
|
async function execPipe(input, args, opts) {
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
const ctx = opts.context ?? { type: "local" };
|
|
85
|
+
if (ctx.type === "ssh") {
|
|
86
|
+
const sshPrefix = buildSshPrefix(ctx);
|
|
85
87
|
const remoteCmd = args.join(" ");
|
|
86
88
|
const fullArgs = [...sshPrefix, remoteCmd];
|
|
87
89
|
const proc2 = Bun.spawn(fullArgs, {
|
|
@@ -272,7 +274,7 @@ function generateServiceUnit(name, opts) {
|
|
|
272
274
|
lines.push(`SystemCallFilter=${opts.systemCallFilter.join(" ")}`);
|
|
273
275
|
if (opts.restrictNamespaces === true)
|
|
274
276
|
lines.push("RestrictNamespaces=true");
|
|
275
|
-
else if (opts.restrictNamespaces
|
|
277
|
+
else if (Array.isArray(opts.restrictNamespaces) && opts.restrictNamespaces.length > 0)
|
|
276
278
|
lines.push(`RestrictNamespaces=${opts.restrictNamespaces.join(" ")}`);
|
|
277
279
|
if (opts.personality)
|
|
278
280
|
lines.push(`Personality=${opts.personality}`);
|
|
@@ -337,7 +339,7 @@ async function getServiceStatus(name, opts) {
|
|
|
337
339
|
quiet: true
|
|
338
340
|
});
|
|
339
341
|
if (!result.ok) {
|
|
340
|
-
return { loaded: false, active: false, subState: "unknown", mainPid: 0 };
|
|
342
|
+
return { loaded: false, active: false, subState: "unknown", mainPid: 0, description: "" };
|
|
341
343
|
}
|
|
342
344
|
const parse = (key) => {
|
|
343
345
|
const match = result.stdout.match(new RegExp(`^${key}=(.+)$`, "m"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ebowwa/seedinstallation",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Composable server installation utilities for edge deployment automation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"homepage": "https://github.com/ebowwa/codespaces/tree/main/packages/src/installations",
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@types/bun": "
|
|
68
|
+
"@types/bun": "^1.3.8",
|
|
69
69
|
"@types/node": "^22.10.2",
|
|
70
70
|
"typescript": "^5.7.2"
|
|
71
71
|
},
|